Author: jason.greene(a)jboss.com
Date: 2007-01-30 21:44:54 -0500 (Tue, 30 Jan 2007)
New Revision: 2202
Added:
subprojects/jbossws-sun-wsimport/
subprojects/jbossws-sun-wsimport/.build.xml.swp
subprojects/jbossws-sun-wsimport/.classpath
subprojects/jbossws-sun-wsimport/.project
subprojects/jbossws-sun-wsimport/NOTES
subprojects/jbossws-sun-wsimport/build.xml
subprojects/jbossws-sun-wsimport/jbossws/
subprojects/jbossws-sun-wsimport/jbossws/src/
subprojects/jbossws-sun-wsimport/jbossws/src/main/
subprojects/jbossws-sun-wsimport/jbossws/src/main/org/
subprojects/jbossws-sun-wsimport/jbossws/src/main/org/jboss/
subprojects/jbossws-sun-wsimport/jbossws/src/main/org/jboss/com/
subprojects/jbossws-sun-wsimport/jbossws/src/main/org/jboss/com/sun/
subprojects/jbossws-sun-wsimport/jbossws/src/main/org/jboss/com/sun/tools/
subprojects/jbossws-sun-wsimport/jbossws/src/main/org/jboss/com/sun/tools/ws/
subprojects/jbossws-sun-wsimport/jbossws/src/main/org/jboss/com/sun/tools/ws/jbossws/
subprojects/jbossws-sun-wsimport/jbossws/src/main/org/jboss/com/sun/tools/ws/jbossws/NullPrintStream.java
subprojects/jbossws-sun-wsimport/jbossws/src/main/org/jboss/com/sun/tools/ws/jbossws/WebServiceImporterImpl.java
subprojects/jbossws-sun-wsimport/jbossws/src/main/org/jboss/com/sun/tools/ws/jbossws/WebServiceImporterProviderImpl.java
subprojects/jbossws-sun-wsimport/lib/
subprojects/jbossws-sun-wsimport/lib/activation.jar
subprojects/jbossws-sun-wsimport/lib/jaxb-api.jar
subprojects/jbossws-sun-wsimport/lib/jaxb-impl.jar
subprojects/jbossws-sun-wsimport/lib/jaxb-xjc.jar
subprojects/jbossws-sun-wsimport/lib/jaxws-api.jar
subprojects/jbossws-sun-wsimport/lib/jbossws-client.jar
subprojects/jbossws-sun-wsimport/lib/jsr173_api.jar
subprojects/jbossws-sun-wsimport/lib/jsr181-api.jar
subprojects/jbossws-sun-wsimport/lib/jsr250-api.jar
subprojects/jbossws-sun-wsimport/lib/resolver.jar
subprojects/jbossws-sun-wsimport/lib/saaj-api.jar
subprojects/jbossws-sun-wsimport/lib/servlet.jar
subprojects/jbossws-sun-wsimport/lib/sun-saaj-impl.jar
subprojects/jbossws-sun-wsimport/license.txt
subprojects/jbossws-sun-wsimport/sun/
subprojects/jbossws-sun-wsimport/sun/src/
subprojects/jbossws-sun-wsimport/sun/src/etc/
subprojects/jbossws-sun-wsimport/sun/src/etc/wsgen.bat
subprojects/jbossws-sun-wsimport/sun/src/etc/wsgen.sh
subprojects/jbossws-sun-wsimport/sun/src/etc/wsimport.bat
subprojects/jbossws-sun-wsimport/sun/src/etc/wsimport.sh
subprojects/jbossws-sun-wsimport/sun/src/main/
subprojects/jbossws-sun-wsimport/sun/src/main/org/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/istack/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/istack/ws/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/istack/ws/AnnotationProcessorFactoryImpl.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/istack/ws/package-info.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/Invoker.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/ToolVersion.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/WsGen.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/WsImport.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/ant/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/ant/Apt.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/ant/WsGen.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/ant/WsImport.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/package-info.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/Processor.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/ProcessorAction.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/ProcessorActionVersion.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/ProcessorConstants.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/ProcessorException.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/ProcessorNotificationListener.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/ProcessorOptions.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/ClassModelInfo.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/Configuration.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/ConfigurationException.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/HandlerChainInfo.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/HandlerInfo.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/ModelInfo.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/WSDLModelInfo.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/parser/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/parser/ClassModelParser.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/parser/CustomizationParser.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/parser/InputParser.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/parser/JAXWSBindingInfoParser.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/parser/ParserUtil.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/parser/Reader.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/CustomExceptionGenerator.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/GeneratorBase.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/GeneratorConstants.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/GeneratorException.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/GeneratorUtil.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/JAXBTypeGenerator.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/Names.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/SeiGenerator.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/ServiceGenerator.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/SimpleToBoxedUtil.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/AbstractType.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/AsyncOperation.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/AsyncOperationType.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Block.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/ExtendedModelVisitor.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Fault.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/HeaderFault.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Message.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Model.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/ModelException.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/ModelObject.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/ModelProperties.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/ModelVisitor.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Operation.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Parameter.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Port.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Request.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Response.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Service.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/exporter/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/exporter/ExternalObject.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaArrayType.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaException.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaInterface.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaMethod.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaParameter.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaSimpleType.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaStructureMember.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaStructureType.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaType.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/JAXBElementMember.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/JAXBMapping.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/JAXBModel.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/JAXBProperty.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/JAXBStructuredType.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/JAXBType.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/JAXBTypeAndAnnotation.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/JAXBTypeVisitor.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/RpcLitMember.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/RpcLitStructure.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/Util.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/JavaSimpleTypeCreator.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/Modeler.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/ModelerConstants.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/ModelerException.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/ModelerUtils.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/AnnotationProcessorContext.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/FaultInfo.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/MakeSafeTypeVisitor.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/MemberInfo.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/ModelBuilder.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/TypeModeler.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/TypeMoniker.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/TypeMonikerFactory.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/WebServiceAP.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/WebServiceConstants.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/WebServiceReferenceCollector.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/WebServiceVisitor.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/WebServiceWrapperGenerator.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/WrapperInfo.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/wsdl/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/wsdl/AccessorElement.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/wsdl/ClassNameAllocatorImpl.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/wsdl/ConsoleErrorReporter.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/wsdl/JAXBModelBuilder.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/wsdl/MimeHelper.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/wsdl/PseudoSchemaBuilder.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/wsdl/WSDLModeler.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/wsdl/WSDLModelerBase.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/util/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/util/ClassNameCollector.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/util/ClientProcessorEnvironment.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/util/DirectoryUtil.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/util/GeneratedFileInfo.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/util/IndentingWriter.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/util/ProcessorEnvironment.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/util/ProcessorEnvironmentBase.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/resources/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/resources/configuration.properties
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/resources/generator.properties
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/resources/javacompiler.properties
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/resources/model.properties
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/resources/modeler.properties
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/resources/processor.properties
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/resources/util.properties
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/resources/webserviceap.properties
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/resources/wscompile.properties
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/resources/wsdl.properties
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/spi/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/spi/WSToolsObjectFactory.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/spi/package-info.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/ClassNameInfo.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/ForkEntityResolver.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/JAXWSClassFactory.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/JavaCompilerHelper.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/MapBase.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/ToolBase.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/WSDLParseException.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/WSToolsObjectFactoryImpl.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/xml/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/xml/NodeListIterator.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/xml/NullEntityResolver.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/xml/PrettyPrintingXmlWriter.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/xml/XmlUtil.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/xml/XmlWriter.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/version.properties
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wscompile/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wscompile/ActionConstants.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wscompile/CompileTool.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wscompile/FilerCodeWriter.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wscompile/WSCodeWriter.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Binding.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/BindingFault.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/BindingInput.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/BindingOperation.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/BindingOutput.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Definitions.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Documentation.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Fault.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Import.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Input.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Kinds.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Message.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/MessagePart.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Operation.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/OperationStyle.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Output.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Port.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/PortType.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Service.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Types.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/WSDLConstants.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/WSDLDocument.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/WSDLDocumentVisitor.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/WSDLDocumentVisitorBase.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/http/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/http/HTTPAddress.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/http/HTTPBinding.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/http/HTTPConstants.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/http/HTTPOperation.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/http/HTTPUrlEncoded.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/http/HTTPUrlReplacement.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/jaxws/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/jaxws/CustomName.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/jaxws/Exception.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/jaxws/JAXWSBinding.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/jaxws/JAXWSBindingsConstants.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/jaxws/Parameter.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/mime/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/mime/MIMEConstants.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/mime/MIMEContent.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/mime/MIMEMultipartRelated.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/mime/MIMEPart.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/mime/MIMEXml.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/schema/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/schema/BuiltInTypes.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/schema/Schema.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/schema/SchemaAttribute.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/schema/SchemaConstants.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/schema/SchemaDocument.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/schema/SchemaElement.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/schema/SchemaEntity.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/schema/SchemaKinds.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAP12Binding.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAP12Constants.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPAddress.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPBinding.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPBody.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPConstants.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPFault.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPHeader.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPHeaderFault.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPOperation.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPStyle.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPUse.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/AbstractDocument.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/Defining.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/DuplicateEntityException.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/Elemental.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/Entity.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/EntityAction.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/EntityReferenceAction.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/EntityReferenceValidator.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/ExtensibilityHelper.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/Extensible.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/Extension.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/ExtensionVisitor.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/ExtensionVisitorBase.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/ExternalEntityReference.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/GlobalEntity.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/GloballyKnown.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/Identifiable.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/Kind.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/NoSuchEntityException.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/ParseException.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/ParserContext.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/ParserListener.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/QNameAction.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/ValidationException.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/WSDLLocation.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/WriterContext.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/Constants.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/ExtensionHandler.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/ExtensionHandlerBase.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/HTTPExtensionHandler.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/Internalizer.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/JAXWSBindingExtensionHandler.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/MIMEExtensionHandler.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/NamespaceContextImpl.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/SOAP12ExtensionHandler.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/SOAPEntityReferenceValidator.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/SOAPExtensionHandler.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/SchemaExtensionHandler.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/SchemaParser.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/SchemaWriter.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/Util.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/WSDLParser.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/WSDLWriter.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/binding/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/binding/BindingImpl.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/binding/http/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/binding/http/HTTPBindingImpl.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/binding/soap/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/binding/soap/SOAPBindingImpl.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/AsyncHandlerService.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/BindingProviderProperties.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ClientConfigurationException.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ClientTransportException.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ContactInfoBase.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ContactInfoListImpl.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ContactInfoListIteratorBase.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ContentNegotiation.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ContextMap.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/EndpointIFBase.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/EndpointIFContext.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/EndpointIFInvocationHandler.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/InternalBindingProvider.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/PortInfoBase.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/RequestContext.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ResponseContext.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/SenderException.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ServiceContext.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ServiceContextBuilder.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/WSFuture.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/WSServiceDelegate.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/DispatchBase.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/DispatchContext.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/ResponseImpl.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/impl/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/impl/DispatchContactInfoList.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/impl/DispatchDelegate.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/impl/encoding/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/impl/encoding/DispatchSerializer.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/impl/encoding/DispatchUtil.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/impl/protocol/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/impl/protocol/MessageDispatcherHelper.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/package-info.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/developer/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/developer/JAXWSProperties.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/EncoderDecoderBase.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/JAXWSAttachmentMarshaller.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/JAXWSAttachmentUnmarshaller.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/internal/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/internal/InternalEncoder.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/jaxb/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/jaxb/JAXBBeanInfo.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/jaxb/JAXBBridgeInfo.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/jaxb/JAXBTypeSerializer.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/jaxb/RpcLitPayload.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/jaxb/RpcLitPayloadSerializer.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/simpletype/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/simpletype/EncoderUtils.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/simpletype/SimpleTypeConstants.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/ClientEncoderDecoder.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/DeserializationException.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/EncoderDecoder.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/SOAP12Constants.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/SOAPConstants.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/SOAPDecoder.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/SOAPEPTFactory.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/SOAPEncoder.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/SOAPVersion.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/SerializationException.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/SerializerConstants.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/ServerEncoderDecoder.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/client/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/client/SOAP12XMLDecoder.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/client/SOAP12XMLEncoder.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/client/SOAPXMLDecoder.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/client/SOAPXMLEncoder.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/internal/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/internal/AttachmentBlock.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/internal/BodyBlock.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/internal/DelegateBase.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/internal/HeaderBlock.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/internal/InternalMessage.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/internal/MessageBlock.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/internal/MessageInfoBase.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/internal/SOAP12NotUnderstoodHeaderBlock.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/FaultCode.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/FaultCodeEnum.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/FaultReason.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/FaultReasonText.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/FaultSubcode.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/SOAP12FaultInfo.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/SOAPFaultInfo.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/SOAPMsgCreateException.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/SOAPMsgFactoryCreateException.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/server/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/server/ProviderSED.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/server/SOAP12XMLDecoder.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/server/SOAP12XMLEncoder.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/server/SOAPXMLDecoder.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/server/SOAPXMLEncoder.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/streaming/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/streaming/SOAP12NamespaceConstants.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/streaming/SOAPNamespaceConstants.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/xml/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/xml/XMLDecoder.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/xml/XMLEPTFactory.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/xml/XMLEncoder.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/xml/XMLMessage.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/HandlerChainCaller.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/HandlerChainsModel.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/HandlerContext.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/HandlerException.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/HandlerResolverImpl.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/LogicalMessageContextImpl.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/LogicalMessageImpl.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/MessageContextImpl.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/MessageContextUtil.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/PortInfoImpl.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/SHDSOAPMessageContext.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/SOAPHandlerContext.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/SOAPMessageContextImpl.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/XMLHandlerContext.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/XMLLogicalMessageContextImpl.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/XMLLogicalMessageImpl.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/package-info.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/CheckedException.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/ExceptionType.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/JavaMethod.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/Mode.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/Parameter.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/ParameterBinding.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/RuntimeModel.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/WrapperParameter.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/soap/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/soap/SOAPBinding.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/soap/SOAPRuntimeModel.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/soap/Style.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/soap/Use.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/modeler/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/modeler/RuntimeModeler.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/modeler/RuntimeModelerException.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/package-info.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/Delegate.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/encoding/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/encoding/Decoder.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/encoding/Encoder.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/ept/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/ept/Acceptor.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/ept/ContactInfo.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/ept/ContactInfoList.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/ept/ContactInfoListIterator.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/ept/EPTFactory.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/ept/MessageInfo.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/presentation/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/presentation/MessageStruct.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/presentation/Stub.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/presentation/TargetFinder.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/presentation/Tie.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/protocol/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/protocol/Interceptors.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/protocol/MessageDispatcher.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/soap/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/soap/client/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/soap/client/SOAPMessageDispatcher.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/soap/server/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/soap/server/ProviderSOAPMD.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/soap/server/SOAPMessageDispatcher.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/xml/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/xml/XMLMessageException.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/xml/client/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/xml/client/XMLMessageDispatcher.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/xml/server/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/xml/server/ProviderXMLMD.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/xml/server/XMLMessageDispatcher.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/client.properties
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/dispatch.properties
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/encoding.properties
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/handler.properties
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/httpserver.properties
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/modeler.properties
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/sender.properties
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/server.properties
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/soap.properties
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/streaming.properties
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/util.properties
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/wsservlet.properties
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/xmlmessage.properties
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/AppMsgContextImpl.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/DocInfo.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/EPTFactoryBase.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/EPTFactoryFactoryBase.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/PeptTie.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/RuntimeContext.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/RuntimeEndpointInfo.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/ServerPropertyConstants.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/ServerRtException.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/TargetFinderImpl.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/Tie.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/WSDLGenResolver.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/WSDLPatcher.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/WSDLPublisher.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/XMLEPTFactoryImpl.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/package-info.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/provider/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/provider/ProviderModel.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/provider/ProviderPeptTie.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/Binding.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/ClientTransportFactory.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/ClientTransportFactoryTypes.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/InternalSoapEncoder.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/Invoker.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/MessageContext.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/MtomCallback.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/RuntimeEndpointInfo.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/SOAPMessageContext.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/StubBase.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/SystemHandlerDelegate.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/SystemHandlerDelegateFactory.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/Tie.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/WSConnection.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/WSRtObjectFactory.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/WebServiceContext.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/package-info.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/Attributes.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/DOMStreamReader.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/PrefixFactory.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/PrefixFactoryImpl.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/SourceReaderFactory.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/TidyXMLStreamReader.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/XMLReader.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/XMLReaderException.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/XMLStreamReaderException.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/XMLStreamReaderFactory.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/XMLStreamReaderUtil.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/XMLStreamWriterException.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/XMLStreamWriterFactory.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/XMLStreamWriterUtil.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/Headers.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/WSConnectionImpl.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/client/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/client/CookieJar.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/client/HttpClientTransport.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/client/HttpClientTransportFactory.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/client/HttpCookie.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/client/RfcDateParser.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/servlet/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/servlet/RuntimeEndpointInfoParser.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/servlet/ServletConnectionImpl.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/servlet/ServletDocInfo.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/servlet/WSServlet.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/servlet/WSServletContextListener.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/servlet/WSServletDelegate.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/servlet/WSServletException.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/servlet/WebServiceContextImpl.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/local/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/local/LocalMessage.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/local/client/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/local/client/LocalClientTransport.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/local/client/LocalClientTransportFactory.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/local/server/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/local/server/LocalConnectionImpl.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/local/server/LocalWSContextImpl.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/ASCIIUtility.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/Base64Util.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/ByteArrayBuffer.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/ByteArrayDataSource.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/Constants.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/DOMUtil.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/FastInfosetReflection.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/FastInfosetUtil.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/HandlerAnnotationInfo.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/HandlerAnnotationProcessor.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/JAXWSUtils.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/MessageInfoUtil.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/NamespaceSupport.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/NullIterator.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/RuntimeVersion.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/SOAPConnectionUtil.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/SOAPUtil.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/StringUtils.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/SunStAXReflection.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/UtilException.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/Version.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/VersionUtil.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/WSRtObjectFactoryImpl.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/XMLConnectionUtil.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/exception/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/exception/JAXWSExceptionBase.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/localization/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/localization/Localizable.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/localization/LocalizableMessage.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/localization/LocalizableMessageFactory.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/localization/Localizer.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/localization/NullLocalizable.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/resources/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/resources/Messages_en.properties
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/xml/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/xml/CDATA.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/xml/NamedNodeMapIterator.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/xml/NodeListIterator.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/xml/StAXSource.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/xml/XMLStreamReaderToContentHandler.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/xml/XmlUtil.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/version.properties
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/WSDLContext.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/Binding.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/BindingOperation.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/MIMEConstants.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/Message.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/ParserUtil.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/Part.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/Port.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/PortType.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/PortTypeOperation.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/RuntimeWSDLParser.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/SOAPConstants.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/Service.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/WSDLConstants.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/WSDLDocument.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/WSDLGenerator.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/WSDLOutputResolver.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Binding.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/BindingOperationType.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Definitions.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Documented.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Fault.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/FaultType.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Import.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Message.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/OpenAtts.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Operation.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/ParamType.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Part.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Port.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/PortType.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Service.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/StartWithExtensionsType.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Types.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/http/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/http/Address.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/http/Binding.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/http/Operation.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/http/package-info.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/package-info.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/Body.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/BodyType.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/Header.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/HeaderFault.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/SOAPAddress.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/SOAPBinding.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/SOAPFault.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/SOAPOperation.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/package-info.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/Body.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/BodyType.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/Header.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/HeaderFault.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/SOAPAddress.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/SOAPBinding.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/SOAPFault.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/SOAPOperation.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/package-info.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/xsd/
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/xsd/Import.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/xsd/Schema.java
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/xsd/package-info.java
Log:
import sun-wsimport plugin
Added: subprojects/jbossws-sun-wsimport/.build.xml.swp
===================================================================
(Binary files differ)
Property changes on: subprojects/jbossws-sun-wsimport/.build.xml.swp
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: subprojects/jbossws-sun-wsimport/.classpath
===================================================================
--- subprojects/jbossws-sun-wsimport/.classpath (rev 0)
+++ subprojects/jbossws-sun-wsimport/.classpath 2007-01-31 02:44:54 UTC (rev 2202)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="jbossws/src/main"/>
+ <classpathentry kind="src" path="sun/src/main"/>
+ <classpathentry kind="lib" path="lib/activation.jar"/>
+ <classpathentry kind="lib" path="lib/jaxb-api.jar"/>
+ <classpathentry kind="lib" path="lib/jaxb-impl.jar"/>
+ <classpathentry kind="lib" path="lib/jaxb-xjc.jar"/>
+ <classpathentry kind="lib" path="lib/jsr173_api.jar"/>
+ <classpathentry kind="lib" path="lib/jsr250-api.jar"/>
+ <classpathentry kind="lib" path="lib/saaj-api.jar"/>
+ <classpathentry kind="lib" path="lib/servlet.jar"/>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="lib"
path="/devel/jbossas/trunk/tools/lib/ant.jar"/>
+ <classpathentry kind="lib" path="lib/sun-saaj-impl.jar"/>
+ <classpathentry kind="lib" path="lib/jbossws-client.jar"/>
+ <classpathentry kind="lib" path="lib/jsr181-api.jar"/>
+ <classpathentry kind="lib" path="lib/jaxws-api.jar"/>
+ <classpathentry kind="output" path="eclipse-output"/>
+</classpath>
Added: subprojects/jbossws-sun-wsimport/.project
===================================================================
--- subprojects/jbossws-sun-wsimport/.project (rev 0)
+++ subprojects/jbossws-sun-wsimport/.project 2007-01-31 02:44:54 UTC (rev 2202)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>jbossws-sun-wsimport</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: subprojects/jbossws-sun-wsimport/NOTES
===================================================================
--- subprojects/jbossws-sun-wsimport/NOTES (rev 0)
+++ subprojects/jbossws-sun-wsimport/NOTES 2007-01-31 02:44:54 UTC (rev 2202)
@@ -0,0 +1,42 @@
+General Architecture
+--------------------
+(jbossws) WebServiceImporter -> (jbossws-sun) WebServiceImporterProviderImpl ->
WebServiceImporterImpl -> (sun) CompileTool
+
+Directory Layout
+----------------
+lib - compile time dependencies
+output/classes - compiled classes
+output/lib - final location for jbossws-sun-wsimport.jar
+
+sun/src/main - modified CDDL JAX-WS code
+jbossws/src/main - jbossws plugin
+
+Sun Source Tag
+--------------
+The original sun source is available at:
+cvs -d :pserver:guest@cvs.dev.java.net:/cvs co -r glassfish-90ur1-09282006
jax-ws-sources
+
+It's important to correlate the glassfish tags for TCK compatibility.
+
+Recreation Steps
+---i------------
+1. Grab jax-ws sources from
java.net (make sure to use a glassfish tag)
+2. Merge the ri and tools tree
+3. Remove all references to http.jar (delete EndpointImpl and everything that references
it)
+4. Use jarjar to rename classes in saaj-impl.jar to org/jboss/com/sun (this will ensure
no runtime references to it)
+5. Rename all sun code packages to org/jboss/com/sun
+6. Edit the source comment code to include a jbossws message
+7. build jar, and verify it works (should only have jaxb dependencies and misc apis that
jboss already has)
+
+Runtime Dependencies
+--------------------
+1. jaxb-api.jar
+2. jaxb-impl.jar
+3. jaxb-xjc.jar
+4. stax-1.1.1.jar or wstax
+5. jdk tools.jar
+6. The usual jbossws jars
+
+Compiletime Dependencies
+------------------------
+Everything in lib
Added: subprojects/jbossws-sun-wsimport/build.xml
===================================================================
--- subprojects/jbossws-sun-wsimport/build.xml (rev 0)
+++ subprojects/jbossws-sun-wsimport/build.xml 2007-01-31 02:44:54 UTC (rev 2202)
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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
+
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ See the License for the specific language governing
+ permissions and limitations under the License.
+
+ When distributing Covered Code, include this CDDL
+ Header Notice in each file and include the License file
+ at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ If applicable, add the following below the CDDL Header,
+ with the fields enclosed by brackets [] replaced by
+ you own identifying information:
+ "Portions Copyrighted [year] [name of copyright owner]"
+
+ Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+-->
+
+<!--
+ Build script for the source code bundle
+-->
+<project name="jax-ws" default="main">
+
+ <property name="Name" value="jbossws-sun-wsimport"/>
+ <property name="version" value="2.0.0"/>
+ <property name="output" value="output"/>
+ <property name="output.classes" value="output/classes"/>
+ <property name="output.lib" value="output/lib"/>
+
+ <tstamp>
+ <format property="now" pattern="MM/dd/yyyy HH:mm:ss"
unit="hour" locale="en_US"/>
+ </tstamp>
+ <property name="build.id" value="${now}(${user.name})" />
+ <property name="build.version" value="${Name}
${version}-${build.id}" />
+ <echo message="The build id is: ${build.version}" />
+
+ <macrodef name="versionProp"
+ description="generates a version property file">
+ <attribute name="file" />
+ <sequential>
+ <echo file="@{file}"
+>build-id=${build.id}
+build-version=${build.version}
+major-version=${version}
+</echo>
+ </sequential>
+ </macrodef>
+
+ <path id="compile.classpath">
+ <fileset dir="lib">
+ <include name="**/*.jar"/>
+ </fileset>
+ </path>
+
+ <target name="clean">
+ <delete dir="${output}"/>
+ </target>
+
+ <target name="main" depends="compile, jar"/>
+
+ <target name="compile">
+ <mkdir dir="${output.classes}"/>
+ <copy todir="${output.classes}">
+ <fileset dir="sun/src/main">
+ <include name="**/*.properties" />
+ </fileset>
+ </copy>
+ <versionProp
file="${output.classes}/org/jboss/com/sun/xml/ws/version.properties" />
+ <versionProp
file="${output.classes}/org/jboss/com/sun/tools/ws/version.properties" />
+ <javac destdir="${output.classes}" debug="true">
+ <src path="sun/src/main"/>
+ <src path="jbossws/src/main"/>
+ <classpath refid="compile.classpath"/>
+ </javac>
+ </target>
+
+ <target name="jar" depends="compile">
+ <mkdir dir="${output.lib}"/>
+ <jar jarfile="${output.lib}/jbossws-sun-wsimport.jar">
+ <manifest>
+ <attribute name="Implementation-Title"
value="jbossws-sun-wsimport"/>
+ <attribute name="Implementation-Version"
value="${build.version}"/>
+ <attribute name="Implementation-Vendor"
value="jboss+sun"/>
+ </manifest>
+ <fileset dir="${output.classes}"/>
+ </jar>
+ </target>
+
+<!-- Create a safe SAAJ Impl
+ <target name="jarjar">
+ <taskdef name="jarjar"
classname="com.tonicsystems.jarjar.JarJarTask"
classpath="./jarjar.jar"/>
+ <jarjar jarfile="lib/sun-saaj-impl.jar">
+ <zipfileset src="lib/saaj-impl.jar">
+ <include name="com/sun/**/*"/>
+ </zipfileset>
+ <rule pattern="com.sun.**" result="org.jboss.@0"/>
+ </jarjar>
+ </target>
+-->
+</project>
Property changes on: subprojects/jbossws-sun-wsimport/build.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/jbossws/src/main/org/jboss/com/sun/tools/ws/jbossws/NullPrintStream.java
===================================================================
---
subprojects/jbossws-sun-wsimport/jbossws/src/main/org/jboss/com/sun/tools/ws/jbossws/NullPrintStream.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/jbossws/src/main/org/jboss/com/sun/tools/ws/jbossws/NullPrintStream.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,209 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.com.sun.tools.ws.jbossws;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.util.Locale;
+
+class NullPrintStream extends PrintStream
+{
+ NullPrintStream()
+ {
+ // Doesn't actually do anything
+ super(new ByteArrayOutputStream());
+ }
+
+ @Override
+ public PrintStream append(char c)
+ {
+ return this;
+ }
+
+ @Override
+ public PrintStream append(CharSequence csq, int start, int end)
+ {
+ return this;
+ }
+
+ @Override
+ public PrintStream append(CharSequence csq)
+ {
+ return this;
+ }
+
+ @Override
+ public boolean checkError()
+ {
+ return false;
+ }
+
+ @Override
+ public void close()
+ {
+ }
+
+ @Override
+ public void flush()
+ {
+ }
+
+ @Override
+ public PrintStream format(Locale l, String format, Object... args)
+ {
+ return this;
+ }
+
+ @Override
+ public PrintStream format(String format, Object... args)
+ {
+ return this;
+ }
+
+ @Override
+ public void print(boolean b)
+ {
+ }
+
+ @Override
+ public void print(char c)
+ {
+ }
+
+ @Override
+ public void print(char[] s)
+ {
+ }
+
+ @Override
+ public void print(double d)
+ {
+ }
+
+ @Override
+ public void print(float f)
+ {
+ }
+
+ @Override
+ public void print(int i)
+ {
+ }
+
+ @Override
+ public void print(long l)
+ {
+ }
+
+ @Override
+ public void print(Object obj)
+ {
+ }
+
+ @Override
+ public void print(String s)
+ {
+ }
+
+ @Override
+ public PrintStream printf(Locale l, String format, Object... args)
+ {
+ return this;
+ }
+
+ @Override
+ public PrintStream printf(String format, Object... args)
+ {
+ return this;
+ }
+
+ @Override
+ public void println()
+ {
+ }
+
+ @Override
+ public void println(boolean x)
+ {
+ }
+
+ @Override
+ public void println(char x)
+ {
+ }
+
+ @Override
+ public void println(char[] x)
+ {
+ }
+
+ @Override
+ public void println(double x)
+ {
+ }
+
+ @Override
+ public void println(float x)
+ {
+ }
+
+ @Override
+ public void println(int x)
+ {
+ }
+
+ @Override
+ public void println(long x)
+ {
+ }
+
+ @Override
+ public void println(Object x)
+ {
+ }
+
+ @Override
+ public void println(String x)
+ {
+ }
+
+ @Override
+ protected void setError()
+ {
+ }
+
+ @Override
+ public void write(byte[] buf, int off, int len)
+ {
+ }
+
+ @Override
+ public void write(int b)
+ {
+ }
+
+ @Override
+ public void write(byte[] b) throws IOException
+ {
+ }
+}
\ No newline at end of file
Property changes on:
subprojects/jbossws-sun-wsimport/jbossws/src/main/org/jboss/com/sun/tools/ws/jbossws/NullPrintStream.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/jbossws/src/main/org/jboss/com/sun/tools/ws/jbossws/WebServiceImporterImpl.java
===================================================================
---
subprojects/jbossws-sun-wsimport/jbossws/src/main/org/jboss/com/sun/tools/ws/jbossws/WebServiceImporterImpl.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/jbossws/src/main/org/jboss/com/sun/tools/ws/jbossws/WebServiceImporterImpl.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,169 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.com.sun.tools.ws.jbossws;
+
+import java.io.File;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.com.sun.tools.ws.wscompile.CompileTool;
+import org.jboss.ws.tools.jaxws.api.WebServiceImporter;
+
+/**
+ * Sun based implementation.
+ *
+ * @author <a href="jason.greene(a)jboss.com">Jason T. Greene</a>
+ * @version $Revision$
+ */
+public class WebServiceImporterImpl extends WebServiceImporter {
+ private List<File> bindingFiles = null;
+ private File catalog = null;
+ private boolean generateSource = false;
+ private File outputDir = new File("output");
+ private File sourceDir = null;
+ private String targetPackage = null;
+ private PrintStream messageStream = null;
+ private String wsdlLocation = null;
+ private List<String> additionalCompilerClassPath = null;
+
+ @Override
+ public void setBindingFiles(List<File> bindingFiles) {
+ this.bindingFiles = bindingFiles;
+ }
+
+ @Override
+ public void setCatalog(File catalog) {
+ this.catalog = catalog;
+ }
+
+ @Override
+ public void setGenerateSource(boolean generateSource) {
+ this.generateSource = generateSource;
+ }
+
+ @Override
+ public void setMessageStream(PrintStream messageStream) {
+ // TODO Auto-generated method stub
+ this.messageStream = messageStream;
+ }
+
+ @Override
+ public void setOutputDirectory(File directory) {
+ // TODO Auto-generated method stub
+ outputDir = directory;
+ }
+
+ @Override
+ public void setSourceDirectory(File directory) {
+ sourceDir = directory;
+ }
+
+ @Override
+ public void setTargetPackage(String targetPackage) {
+ this.targetPackage = targetPackage;
+ }
+
+ @Override
+ public void setWsdlLocation(String wsdlLocation) {
+ this.wsdlLocation = wsdlLocation;
+ }
+
+ public void setAdditionalCompilerClassPath(List<String>
additionalCompilerClassPath) {
+ this.additionalCompilerClassPath = additionalCompilerClassPath;
+ }
+
+ @Override
+ public void importServices(URL wsdl) {
+ List<String> args = new ArrayList<String>();
+ if (bindingFiles != null) {
+ for (File file : bindingFiles) {
+ args.add("-b");
+ args.add(file.getAbsolutePath());
+
+ }
+ }
+
+ if (catalog != null) {
+ args.add("-catalog");
+ args.add(catalog.getAbsolutePath());
+ }
+
+ if (generateSource) {
+ args.add("-keep");
+ if (sourceDir != null) {
+ if (!sourceDir.exists() && !sourceDir.mkdirs())
+ throw new IllegalStateException("Could not make directory: " +
sourceDir.getName());
+
+ args.add("-s");
+ args.add(sourceDir.getAbsolutePath());
+ }
+ }
+
+ if (targetPackage != null) {
+ args.add("-p");
+ args.add(targetPackage);
+ }
+
+ if (wsdlLocation != null) {
+ args.add("-wsdllocation");
+ args.add(wsdlLocation);
+ }
+
+ PrintStream stream = messageStream;
+ if (stream != null) {
+ args.add("-verbose");
+ } else {
+ stream = new NullPrintStream();
+ }
+
+ if (!outputDir.exists() && !outputDir.mkdirs())
+ throw new IllegalStateException("Could not make directory: " +
outputDir.getName());
+
+ // Always add the output directory and the wsdl location
+ args.add("-d");
+ args.add(outputDir.getAbsolutePath());
+ args.add(wsdl.toString());
+
+ // WSToolsObjectFactory tools = WSToolsObjectFactory.newInstance();
+ // tools.wsimport(stream, args.toArray(new String[0]));
+
+ // We have to manipulate internals since they don't expose a way to set
+ // the classpath that is used for compilation
+ CompileTool tool = new CompileTool(stream, "wsimport") {
+ @Override
+ public boolean run(String[] args) {
+ StringBuilder builder = new StringBuilder();
+ if (additionalCompilerClassPath != null && additionalCompilerClassPath.size()
> 0) {
+ for (String entry : additionalCompilerClassPath)
+ builder.append(entry).append(File.pathSeparatorChar);
+ builder.setLength(builder.length() - 1);
+ }
+ userClasspath = builder.toString();
+ return super.run(args);
+ }
+ };
+ tool.run(args.toArray(new String[0]));
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/jbossws/src/main/org/jboss/com/sun/tools/ws/jbossws/WebServiceImporterImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/jbossws/src/main/org/jboss/com/sun/tools/ws/jbossws/WebServiceImporterProviderImpl.java
===================================================================
---
subprojects/jbossws-sun-wsimport/jbossws/src/main/org/jboss/com/sun/tools/ws/jbossws/WebServiceImporterProviderImpl.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/jbossws/src/main/org/jboss/com/sun/tools/ws/jbossws/WebServiceImporterProviderImpl.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,36 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.com.sun.tools.ws.jbossws;
+
+import org.jboss.ws.tools.jaxws.api.WebServiceImporter;
+import org.jboss.ws.tools.jaxws.spi.WebServiceImporterProvider;
+/**
+ * Provider implementation that uses SUN wsimport.
+ *
+ * @author <a href="jason.greene(a)jboss.com">Jason T. Greene</a>
+ * @version $Revision$
+ */
+public class WebServiceImporterProviderImpl implements WebServiceImporterProvider {
+ public WebServiceImporter createImporter() {
+ return new WebServiceImporterImpl();
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/jbossws/src/main/org/jboss/com/sun/tools/ws/jbossws/WebServiceImporterProviderImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: subprojects/jbossws-sun-wsimport/lib/activation.jar
===================================================================
(Binary files differ)
Property changes on: subprojects/jbossws-sun-wsimport/lib/activation.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: subprojects/jbossws-sun-wsimport/lib/jaxb-api.jar
===================================================================
(Binary files differ)
Property changes on: subprojects/jbossws-sun-wsimport/lib/jaxb-api.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: subprojects/jbossws-sun-wsimport/lib/jaxb-impl.jar
===================================================================
(Binary files differ)
Property changes on: subprojects/jbossws-sun-wsimport/lib/jaxb-impl.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: subprojects/jbossws-sun-wsimport/lib/jaxb-xjc.jar
===================================================================
(Binary files differ)
Property changes on: subprojects/jbossws-sun-wsimport/lib/jaxb-xjc.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: subprojects/jbossws-sun-wsimport/lib/jaxws-api.jar
===================================================================
(Binary files differ)
Property changes on: subprojects/jbossws-sun-wsimport/lib/jaxws-api.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: subprojects/jbossws-sun-wsimport/lib/jbossws-client.jar
===================================================================
(Binary files differ)
Property changes on: subprojects/jbossws-sun-wsimport/lib/jbossws-client.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: subprojects/jbossws-sun-wsimport/lib/jsr173_api.jar
===================================================================
(Binary files differ)
Property changes on: subprojects/jbossws-sun-wsimport/lib/jsr173_api.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: subprojects/jbossws-sun-wsimport/lib/jsr181-api.jar
===================================================================
(Binary files differ)
Property changes on: subprojects/jbossws-sun-wsimport/lib/jsr181-api.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: subprojects/jbossws-sun-wsimport/lib/jsr250-api.jar
===================================================================
(Binary files differ)
Property changes on: subprojects/jbossws-sun-wsimport/lib/jsr250-api.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: subprojects/jbossws-sun-wsimport/lib/resolver.jar
===================================================================
(Binary files differ)
Property changes on: subprojects/jbossws-sun-wsimport/lib/resolver.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: subprojects/jbossws-sun-wsimport/lib/saaj-api.jar
===================================================================
(Binary files differ)
Property changes on: subprojects/jbossws-sun-wsimport/lib/saaj-api.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: subprojects/jbossws-sun-wsimport/lib/servlet.jar
===================================================================
(Binary files differ)
Property changes on: subprojects/jbossws-sun-wsimport/lib/servlet.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: subprojects/jbossws-sun-wsimport/lib/sun-saaj-impl.jar
===================================================================
(Binary files differ)
Property changes on: subprojects/jbossws-sun-wsimport/lib/sun-saaj-impl.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: subprojects/jbossws-sun-wsimport/license.txt
===================================================================
--- subprojects/jbossws-sun-wsimport/license.txt (rev 0)
+++ subprojects/jbossws-sun-wsimport/license.txt 2007-01-31 02:44:54 UTC (rev 2202)
@@ -0,0 +1,525 @@
+COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
+
+
+ 1. Definitions.
+
+ 1.1. "Contributor" means each individual or entity that
+ creates or contributes to the creation of Modifications.
+
+ 1.2. "Contributor Version" means the combination of the
+ Original Software, prior Modifications used by a
+ Contributor (if any), and the Modifications made by that
+ particular Contributor.
+
+ 1.3. "Covered Software" means (a) the Original Software, or
+ (b) Modifications, or (c) the combination of files
+ containing Original Software with files containing
+ Modifications, in each case including portions thereof.
+
+ 1.4. "Executable" means the Covered Software in any form
+ other than Source Code.
+
+ 1.5. "Initial Developer" means the individual or entity
+ that first makes Original Software available under this
+ License.
+
+ 1.6. "Larger Work" means a work which combines Covered
+ Software or portions thereof with code not governed by the
+ terms of this License.
+
+ 1.7. "License" means this document.
+
+ 1.8. "Licensable" means having the right to grant, to the
+ maximum extent possible, whether at the time of the initial
+ grant or subsequently acquired, any and all of the rights
+ conveyed herein.
+
+ 1.9. "Modifications" means the Source Code and Executable
+ form of any of the following:
+
+ A. Any file that results from an addition to,
+ deletion from or modification of the contents of a
+ file containing Original Software or previous
+ Modifications;
+
+ B. Any new file that contains any part of the
+ Original Software or previous Modification; or
+
+ C. Any new file that is contributed or otherwise made
+ available under the terms of this License.
+
+ 1.10. "Original Software" means the Source Code and
+ Executable form of computer software code that is
+ originally released under this License.
+
+ 1.11. "Patent Claims" means any patent claim(s), now owned
+ or hereafter acquired, including without limitation,
+ method, process, and apparatus claims, in any patent
+ Licensable by grantor.
+
+ 1.12. "Source Code" means (a) the common form of computer
+ software code in which modifications are made and (b)
+ associated documentation included in or with such code.
+
+ 1.13. "You" (or "Your") means an individual or a legal
+ entity exercising rights under, and complying with all of
+ the terms of, this License. For legal entities, "You"
+ includes any entity which controls, is controlled by, or is
+ under common control with You. For purposes of this
+ definition, "control" means (a) the power, direct or
+ indirect, to cause the direction or management of such
+ entity, whether by contract or otherwise, or (b) ownership
+ of more than fifty percent (50%) of the outstanding shares
+ or beneficial ownership of such entity.
+
+ 2. License Grants.
+
+ 2.1. The Initial Developer Grant.
+
+ Conditioned upon Your compliance with Section 3.1 below and
+ subject to third party intellectual property claims, the
+ Initial Developer hereby grants You a world-wide,
+ royalty-free, non-exclusive license:
+
+ (a) under intellectual property rights (other than
+ patent or trademark) Licensable by Initial Developer,
+ to use, reproduce, modify, display, perform,
+ sublicense and distribute the Original Software (or
+ portions thereof), with or without Modifications,
+ and/or as part of a Larger Work; and
+
+ (b) under Patent Claims infringed by the making,
+ using or selling of Original Software, to make, have
+ made, use, practice, sell, and offer for sale, and/or
+ otherwise dispose of the Original Software (or
+ portions thereof).
+
+ (c) The licenses granted in Sections 2.1(a) and (b)
+ are effective on the date Initial Developer first
+ distributes or otherwise makes the Original Software
+ available to a third party under the terms of this
+ License.
+
+ (d) Notwithstanding Section 2.1(b) above, no patent
+ license is granted: (1) for code that You delete from
+ the Original Software, or (2) for infringements
+ caused by: (i) the modification of the Original
+ Software, or (ii) the combination of the Original
+ Software with other software or devices.
+
+ 2.2. Contributor Grant.
+
+ Conditioned upon Your compliance with Section 3.1 below and
+ subject to third party intellectual property claims, each
+ Contributor hereby grants You a world-wide, royalty-free,
+ non-exclusive license:
+
+ (a) under intellectual property rights (other than
+ patent or trademark) Licensable by Contributor to
+ use, reproduce, modify, display, perform, sublicense
+ and distribute the Modifications created by such
+ Contributor (or portions thereof), either on an
+ unmodified basis, with other Modifications, as
+ Covered Software and/or as part of a Larger Work; and
+
+
+ (b) under Patent Claims infringed by the making,
+ using, or selling of Modifications made by that
+ Contributor either alone and/or in combination with
+ its Contributor Version (or portions of such
+ combination), to make, use, sell, offer for sale,
+ have made, and/or otherwise dispose of: (1)
+ Modifications made by that Contributor (or portions
+ thereof); and (2) the combination of Modifications
+ made by that Contributor with its Contributor Version
+ (or portions of such combination).
+
+ (c) The licenses granted in Sections 2.2(a) and
+ 2.2(b) are effective on the date Contributor first
+ distributes or otherwise makes the Modifications
+ available to a third party.
+
+ (d) Notwithstanding Section 2.2(b) above, no patent
+ license is granted: (1) for any code that Contributor
+ has deleted from the Contributor Version; (2) for
+ infringements caused by: (i) third party
+ modifications of Contributor Version, or (ii) the
+ combination of Modifications made by that Contributor
+ with other software (except as part of the
+ Contributor Version) or other devices; or (3) under
+ Patent Claims infringed by Covered Software in the
+ absence of Modifications made by that Contributor.
+
+ 3. Distribution Obligations.
+
+ 3.1. Availability of Source Code.
+
+ Any Covered Software that You distribute or otherwise make
+ available in Executable form must also be made available in
+ Source Code form and that Source Code form must be
+ distributed only under the terms of this License. You must
+ include a copy of this License with every copy of the
+ Source Code form of the Covered Software You distribute or
+ otherwise make available. You must inform recipients of any
+ such Covered Software in Executable form as to how they can
+ obtain such Covered Software in Source Code form in a
+ reasonable manner on or through a medium customarily used
+ for software exchange.
+
+ 3.2. Modifications.
+
+ The Modifications that You create or to which You
+ contribute are governed by the terms of this License. You
+ represent that You believe Your Modifications are Your
+ original creation(s) and/or You have sufficient rights to
+ grant the rights conveyed by this License.
+
+ 3.3. Required Notices.
+
+ You must include a notice in each of Your Modifications
+ that identifies You as the Contributor of the Modification.
+ You may not remove or alter any copyright, patent or
+ trademark notices contained within the Covered Software, or
+ any notices of licensing or any descriptive text giving
+ attribution to any Contributor or the Initial Developer.
+
+ 3.4. Application of Additional Terms.
+
+ You may not offer or impose any terms on any Covered
+ Software in Source Code form that alters or restricts the
+ applicable version of this License or the recipients�
+ rights hereunder. You may choose to offer, and to charge a
+ fee for, warranty, support, indemnity or liability
+ obligations to one or more recipients of Covered Software.
+ However, you may do so only on Your own behalf, and not on
+ behalf of the Initial Developer or any Contributor. You
+ must make it absolutely clear that any such warranty,
+ support, indemnity or liability obligation is offered by
+ You alone, and You hereby agree to indemnify the Initial
+ Developer and every Contributor for any liability incurred
+ by the Initial Developer or such Contributor as a result of
+ warranty, support, indemnity or liability terms You offer.
+
+
+ 3.5. Distribution of Executable Versions.
+
+ You may distribute the Executable form of the Covered
+ Software under the terms of this License or under the terms
+ of a license of Your choice, which may contain terms
+ different from this License, provided that You are in
+ compliance with the terms of this License and that the
+ license for the Executable form does not attempt to limit
+ or alter the recipient�s rights in the Source Code form
+ from the rights set forth in this License. If You
+ distribute the Covered Software in Executable form under a
+ different license, You must make it absolutely clear that
+ any terms which differ from this License are offered by You
+ alone, not by the Initial Developer or Contributor. You
+ hereby agree to indemnify the Initial Developer and every
+ Contributor for any liability incurred by the Initial
+ Developer or such Contributor as a result of any such terms
+ You offer.
+
+ 3.6. Larger Works.
+
+ You may create a Larger Work by combining Covered Software
+ with other code not governed by the terms of this License
+ and distribute the Larger Work as a single product. In such
+ a case, You must make sure the requirements of this License
+ are fulfilled for the Covered Software.
+
+ 4. Versions of the License.
+
+ 4.1. New Versions.
+
+ Sun Microsystems, Inc. is the initial license steward and
+ may publish revised and/or new versions of this License
+ from time to time. Each version will be given a
+ distinguishing version number. Except as provided in
+ Section 4.3, no one other than the license steward has the
+ right to modify this License.
+
+ 4.2. Effect of New Versions.
+
+ You may always continue to use, distribute or otherwise
+ make the Covered Software available under the terms of the
+ version of the License under which You originally received
+ the Covered Software. If the Initial Developer includes a
+ notice in the Original Software prohibiting it from being
+ distributed or otherwise made available under any
+ subsequent version of the License, You must distribute and
+ make the Covered Software available under the terms of the
+ version of the License under which You originally received
+ the Covered Software. Otherwise, You may also choose to
+ use, distribute or otherwise make the Covered Software
+ available under the terms of any subsequent version of the
+ License published by the license steward.
+
+ 4.3. Modified Versions.
+
+ When You are an Initial Developer and You want to create a
+ new license for Your Original Software, You may create and
+ use a modified version of this License if You: (a) rename
+ the license and remove any references to the name of the
+ license steward (except to note that the license differs
+ from this License); and (b) otherwise make it clear that
+ the license contains terms which differ from this License.
+
+
+ 5. DISCLAIMER OF WARRANTY.
+
+ COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS"
+ BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
+ INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED
+ SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR
+ PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND
+ PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY
+ COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE
+ INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF
+ ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF
+ WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
+ ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS
+ DISCLAIMER.
+
+ 6. TERMINATION.
+
+ 6.1. This License and the rights granted hereunder will
+ terminate automatically if You fail to comply with terms
+ herein and fail to cure such breach within 30 days of
+ becoming aware of the breach. Provisions which, by their
+ nature, must remain in effect beyond the termination of
+ this License shall survive.
+
+ 6.2. If You assert a patent infringement claim (excluding
+ declaratory judgment actions) against Initial Developer or
+ a Contributor (the Initial Developer or Contributor against
+ whom You assert such claim is referred to as "Participant")
+ alleging that the Participant Software (meaning the
+ Contributor Version where the Participant is a Contributor
+ or the Original Software where the Participant is the
+ Initial Developer) directly or indirectly infringes any
+ patent, then any and all rights granted directly or
+ indirectly to You by such Participant, the Initial
+ Developer (if the Initial Developer is not the Participant)
+ and all Contributors under Sections 2.1 and/or 2.2 of this
+ License shall, upon 60 days notice from Participant
+ terminate prospectively and automatically at the expiration
+ of such 60 day notice period, unless if within such 60 day
+ period You withdraw Your claim with respect to the
+ Participant Software against such Participant either
+ unilaterally or pursuant to a written agreement with
+ Participant.
+
+ 6.3. In the event of termination under Sections 6.1 or 6.2
+ above, all end user licenses that have been validly granted
+ by You or any distributor hereunder prior to termination
+ (excluding licenses granted to You by any distributor)
+ shall survive termination.
+
+ 7. LIMITATION OF LIABILITY.
+
+ UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
+ (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE
+ INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF
+ COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE
+ LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR
+ CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
+ LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK
+ STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
+ COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
+ INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
+ LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL
+ INJURY RESULTING FROM SUCH PARTY�S NEGLIGENCE TO THE EXTENT
+ APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO
+ NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR
+ CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT
+ APPLY TO YOU.
+
+ 8. U.S. GOVERNMENT END USERS.
+
+ The Covered Software is a "commercial item," as that term is
+ defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial
+ computer software" (as that term is defined at 48 C.F.R. �
+ 252.227-7014(a)(1)) and "commercial computer software
+ documentation" as such terms are used in 48 C.F.R. 12.212 (Sept.
+ 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1
+ through 227.7202-4 (June 1995), all U.S. Government End Users
+ acquire Covered Software with only those rights set forth herein.
+ This U.S. Government Rights clause is in lieu of, and supersedes,
+ any other FAR, DFAR, or other clause or provision that addresses
+ Government rights in computer software under this License.
+
+ 9. MISCELLANEOUS.
+
+ This License represents the complete agreement concerning subject
+ matter hereof. If any provision of this License is held to be
+ unenforceable, such provision shall be reformed only to the
+ extent necessary to make it enforceable. This License shall be
+ governed by the law of the jurisdiction specified in a notice
+ contained within the Original Software (except to the extent
+ applicable law, if any, provides otherwise), excluding such
+ jurisdiction�s conflict-of-law provisions. Any litigation
+ relating to this License shall be subject to the jurisdiction of
+ the courts located in the jurisdiction and venue specified in a
+ notice contained within the Original Software, with the losing
+ party responsible for costs, including, without limitation, court
+ costs and reasonable attorneys� fees and expenses. The
+ application of the United Nations Convention on Contracts for the
+ International Sale of Goods is expressly excluded. Any law or
+ regulation which provides that the language of a contract shall
+ be construed against the drafter shall not apply to this License.
+ You agree that You alone are responsible for compliance with the
+ United States export administration regulations (and the export
+ control laws and regulation of any other countries) when You use,
+ distribute or otherwise make available any Covered Software.
+
+ 10. RESPONSIBILITY FOR CLAIMS.
+
+ As between Initial Developer and the Contributors, each party is
+ responsible for claims and damages arising, directly or
+ indirectly, out of its utilization of rights under this License
+ and You agree to work with Initial Developer and Contributors to
+ distribute such responsibility on an equitable basis. Nothing
+ herein is intended or shall be deemed to constitute any admission
+ of liability.
+
+
+---------------------------------------------------------------------------
+
+
+Sun Microsystems, Inc. ("Sun") ENTITLEMENT for SOFTWARE
+
+Licensee/Company: Entity receiving Software.
+
+Effective Date: Date of delivery of the Software to You.
+
+Software: Webservices Metadata for Java Platform V2.0.
+
+License Term: Perpetual (subject to termination under the SLA).
+
+Licensed Unit: Software Copy.
+
+Licensed unit Count: Unlimited.
+
+Permitted Uses:
+
+1. You may reproduce and use the Software for Your own Individual, Commercial and
Research and Instructional Use only for the purposes of designing, developing, testing,
and running Your applets and applications ("Programs").
+
+2. Subject to the terms and conditions of this Agreement and restrictions and exceptions
set forth in the Software's documentation, You may reproduce and distribute portions
of Software identified as a redistributable in the documentation (each a
"Redistributable"), provided that You comply with the following (note that You
may be entitled to reproduce and distribute other portions of the Software not defined in
the documentation as a Redistributable under certain other licenses as described in the
THIRDPARTYLICENSEREADME):
+
+(a) You distribute Redistributable complete and unmodified and only bundled as part of
Your Programs,
+
+(b) Your Programs add significant and primary functionality to the Redistributable,
+
+(c) You distribute Redistributable for the sole purpose of running Your Programs,
+
+(d) You do not distribute additional software intended to replace any
+component(s) of the Redistributable,
+
+(e) You do not remove or alter any proprietary legends or notices contained in or on the
Redistributable.
+
+(f) You only distribute the Redistributable subject to a license agreement that protects
Sun's interests consistent with the terms contained in this
+Agreement, and
+
+(g) You agree to defend and indemnify Sun and its licensors from and against any damages,
costs, liabilities, settlement amounts and/or expenses (including attorneys' fees)
incurred in connection with any claim, lawsuit or action by any third party that arises or
results from the use or distribution of any and all Programs and/or Redistributable.
+
+3. Java Technology Restrictions. You may not create, modify, or change the behavior of,
or authorize Your licensees to create, modify, or change the behavior of, classes,
interfaces, or subpackages that are in any way identified as "java",
"javax", "sun" or similar convention as specified by Sun in any naming
convention designation.
+
+
+Sun Microsystems, Inc. ("Sun")
+SOFTWARE LICENSE AGREEMENT
+
+READ THE TERMS OF THIS AGREEMENT ("AGREEMENT") CAREFULLY BEFORE OPENING
SOFTWARE MEDIA PACKAGE. BY OPENING SOFTWARE MEDIA PACKAGE, YOU AGREE TO THE TERMS OF THIS
AGREEMENT. IF YOU ARE ACCESSING SOFTWARE ELECTRONICALLY, INDICATE YOUR ACCEPTANCE OF THESE
TERMS BY SELECTING THE "ACCEPT" BUTTON AT THE END OF THIS AGREEMENT. IF YOU DO
NOT AGREE TO ALL OF THE TERMS, PROMPTLY RETURN THE UNUSED SOFTWARE TO YOUR PLACE OF
PURCHASE FOR A REFUND OR, IF SOFTWARE IS ACCESSED ELECTRONICALLY, SELECT THE
"DECLINE" (OR "EXIT") BUTTON AT THE END OF THIS AGREEMENT. IF YOU HAVE
SEPARATELY AGREED TO LICENSE TERMS ("MASTER TERMS") FOR YOUR LICENSE TO THIS
SOFTWARE, THEN SECTIONS 1-5 OF THIS AGREEMENT ("SUPPLEMENTAL LICENSE TERMS")
SHALL SUPPLEMENT AND SUPERSEDE THE MASTER TERMS IN RELATION TO THIS SOFTWARE.
+
+1. Definitions.
+
+(a) "Entitlement" means the collective set of applicable documents authorized
by Sun evidencing your obligation to pay associated fees (if any) for the license,
associated Services, and the authorized scope of use of Software under this Agreement.
+
+(b) "Licensed Unit" means the unit of measure by which your use of Software
and/or Service is licensed, as described in your Entitlement.
+
+(c) "Permitted Use" means the licensed Software use(s) authorized in this
Agreement as specified in your Entitlement. The Permitted Use for any bundled Sun software
not specified in your Entitlement will be evaluation use as provided in Section 3.
+
+(d) "Service" means the service(s) that Sun or its delegate will provide, if
any, as selected in your Entitlement and as further described in the applicable service
listings at
www.sun.com/service/servicelist.
+
+(e) "Software" means the Sun software described in your Entitlement. Also,
certain software may be included for evaluation use under Section 3.
+
+(f) "You" and "Your" means the individual or legal entity specified
in the Entitlement, or for evaluation purposes, the entity performing the evaluation.
+
+2. License Grant and Entitlement.
+
+Subject to the terms of your Entitlement, Sun grants you a nonexclusive, nontransferable
limited license to use Software for its Permitted Use for the license term. Your
Entitlement will specify (a) Software licensed, (b) the Permitted Use, (c) the license
term, and (d) the Licensed Units.
+
+Additionally, if your Entitlement includes Services, then it will also specify the (e)
Service and (f) service term.
+
+If your rights to Software or Services are limited in duration and the date such rights
begin is other than the purchase date, your Entitlement will provide that beginning
date(s).
+
+The Entitlement may be delivered to you in various ways depending on the manner in which
you obtain Software and Services, for example, the Entitlement may be provided in your
receipt, invoice or your contract with Sun or authorized Sun reseller. It may also be in
electronic format if you download Software.
+
+3. Permitted Use.
+
+As selected in your Entitlement, one or more of the following Permitted Uses will apply
to your use of Software. Unless you have an Entitlement that expressly permits it, you may
not use Software for any of the other Permitted Uses. If you don't have an
Entitlement, or if your Entitlement doesn't cover additional software delivered to
you, then such software is for your Evaluation Use.
+
+(a) Evaluation Use. You may evaluate Software internally for a period of 90 days from
your first use.
+
+(b) Research and Instructional Use. You may use Software internally to design, develop
and test, and also to provide instruction on such uses.
+
+(c) Individual Use. You may use Software internally for personal, individual use.
+
+(d) Commercial Use. You may use Software internally for your own commercial purposes.
+
+(e) Service Provider Use. You may make Software functionality accessible (but not by
providing Software itself or through outsourcing services) to your end users in an
extranet deployment, but not to your affiliated companies or to government agencies.
+
+4. Licensed Units.
+
+Your Permitted Use is limited to the number of Licensed Units stated in your Entitlement.
If you require additional Licensed Units, you will need additional Entitlement(s).
+
+5. Restrictions.
+
+(a) The copies of Software provided to you under this Agreement are licensed, not sold,
to you by Sun. Sun reserves all rights not expressly granted. (b) You may make a single
archival copy of Software, but otherwise may not copy, modify, or distribute Software.
However if the Sun documentation accompanying Software lists specific portions of
Software, such as header files, class libraries, reference source code, and/or
redistributable files, that may be handled differently, you may do so only as provided in
the Sun documentation. (c) You may not rent, lease, lend or encumber Software. (d) Unless
enforcement is prohibited by applicable law, you may not decompile, or reverse engineer
Software. (e) The terms and conditions of this Agreement will apply to any Software
updates, provided to you at Sun's discretion, that replace and/or supplement the
original Software, unless such update contains a separate license. (f) You may not publish
or provide the results of any benchmark !
or comparison tests run on Software to any third party without the prior written consent
of Sun. (g) Software is confidential and copyrighted. (h) Unless otherwise specified, if
Software is delivered with embedded or bundled software that enables functionality of
Software, you may not use such software on a stand-alone basis or use any portion of such
software to interoperate with any program(s) other than Software. (i) Software may contain
programs that perform automated collection of system data and/or automated software
updating services. System data collected through such programs may be used by Sun, its
subcontractors, and its service delivery partners for the purpose of providing you with
remote system services and/or improving Sun's software and systems. (j) Software is
not designed, licensed or intended for use in the design, construction, operation or
maintenance of any nuclear facility and Sun and its licensors disclaim any express or
implied warranty of fitness f!
or such uses. (k) No right, title or interest in or to any trademark,
service mark, logo or trade name of Sun or its licensors is granted under this Agreement.
+
+6. Term and Termination.
+
+The license and service term are set forth in your Entitlement(s). Your rights under this
Agreement will terminate immediately without notice from Sun if you materially breach it
or take any action in derogation of Sun's and/or its licensors' rights to
Software. Sun may terminate this Agreement should any Software become, or in Sun's
reasonable opinion likely to become, the subject of a claim of intellectual property
infringement or trade secret misappropriation. Upon termination, you will cease use of,
and destroy, Software and confirm compliance in writing to Sun. Sections 1, 5, 6, 7, and
9-15 will survive termination of the Agreement.
+
+7. Java Compatibility and Open Source.
+
+Software may contain Java technology. You may not create additional classes to, or
modifications of, the Java technology, except under compatibility requirements available
under a separate agreement available at
www.java.net.
+
+Sun supports and benefits from the global community of open source developers, and thanks
the community for its important contributions and open standards-based technology, which
Sun has adopted into many of its products.
+
+Please note that portions of Software may be provided with notices and open source
licenses from such communities and third parties that govern the use of those portions,
and any licenses granted hereunder do not alter any rights and obligations you may have
under such open source licenses, however, the disclaimer of warranty and limitation of
liability provisions in this Agreement will apply to all Software in this distribution.
+
+8. Limited Warranty.
+
+Sun warrants to you that for a period of 90 days from the date of purchase, as evidenced
by a copy of the receipt, the media on which Software is furnished (if any) will be free
of defects in materials and workmanship under normal use. Except for the foregoing,
Software is provided "AS IS". Your exclusive remedy and Sun's entire
liability under this limited warranty will be at Sun's option to replace Software
media or refund the fee paid for Software. Some states do not allow limitations on certain
implied warranties, so the above may not apply to you. This limited warranty gives you
specific legal rights. You may have others, which vary from state to state.
+
+9. Disclaimer of Warranty.
+
+UNLESS SPECIFIED IN THIS AGREEMENT, ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS
AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE OR NON-INFRINGEMENT ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT THESE
DISCLAIMERS ARE HELD TO BE LEGALLY INVALID.
+
+10. Limitation of Liability.
+
+TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR
ANY LOST REVENUE, PROFIT OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR
PUNITIVE DAMAGES, HOWEVER CAUSED REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR
RELATED TO THE USE OF OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES. In no event will Sun's liability to you, whether in
contract, tort (including negligence), or otherwise, exceed the amount paid by you for
Software under this Agreement. The foregoing limitations will apply even if the above
stated warranty fails of its essential purpose. Some states do not allow the exclusion of
incidental or consequential damages, so some of the terms above may not be applicable to
you.
+
+11. Export Regulations.
+
+All Software, documents, technical data, and any other materials delivered under this
Agreement are subject to U.S. export control laws and may be subject to export or import
regulations in other countries. You agree to comply strictly with these laws and
regulations and acknowledge that you have the responsibility to obtain any licenses to
export, re-export, or import as may be required after delivery to you.
+
+12. U.S. Government Restricted Rights.
+
+If Software is being acquired by or on behalf of the U.S. Government or by a U.S.
Government prime contractor or subcontractor (at any tier), then the Government's
rights in Software and accompanying documentation will be only as set forth in this
Agreement; this is in accordance with 48 CFR 227.7201 through 227.7202-4 (for Department
of Defense (DOD) acquisitions) and with 48 CFR 2.101 and 12.212 (for non-DOD
acquisitions).
+
+13. Governing Law.
+
+Any action related to this Agreement will be governed by California law and controlling
U.S. federal law. No choice of law rules of any jurisdiction will apply.
+
+14. Severability.
+
+If any provision of this Agreement is held to be unenforceable, this Agreement will
remain in effect with the provision omitted, unless omission would frustrate the intent of
the parties, in which case this Agreement will immediately terminate.
+
+15. Integration.
+
+This Agreement, including any terms contained in your Entitlement, is the entire
agreement between you and Sun relating to its subject matter. It supersedes all prior or
contemporaneous oral or written communications, proposals, representations and warranties
and prevails over any conflicting or additional terms of any quote, order, acknowledgment,
or other communication between the parties relating to its subject matter during the term
of this Agreement. No modification of this Agreement will be binding, unless in writing
and signed by an authorized representative of each party.
+
+Please contact Sun Microsystems, Inc. 4150 Network Circle, Santa Clara, California 95054
if you have questions.
+
Property changes on: subprojects/jbossws-sun-wsimport/license.txt
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: subprojects/jbossws-sun-wsimport/sun/src/etc/wsgen.bat
===================================================================
--- subprojects/jbossws-sun-wsimport/sun/src/etc/wsgen.bat (rev
0)
+++ subprojects/jbossws-sun-wsimport/sun/src/etc/wsgen.bat 2007-01-31 02:44:54 UTC (rev
2202)
@@ -0,0 +1,56 @@
+@echo off
+
+REM
+REM The contents of this file are subject to the terms
+REM of the Common Development and Distribution License
+REM (the License). You may not use this file except in
+REM compliance with the License.
+REM
+REM You can obtain a copy of the license at
+REM
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+REM See the License for the specific language governing
+REM permissions and limitations under the License.
+REM
+REM When distributing Covered Code, include this CDDL
+REM Header Notice in each file and include the License file
+REM at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+REM If applicable, add the following below the CDDL Header,
+REM with the fields enclosed by brackets [] replaced by
+REM you own identifying information:
+REM "Portions Copyrighted [year] [name of copyright owner]"
+REM
+REM Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+REM
+
+
+
+
+rem
+rem Infer JAXWS_HOME if not set
+rem
+if not "%JAXWS_HOME%" == "" goto CHECKJAVAHOME
+
+rem Try to locate JAXWS_HOME
+set JAXWS_HOME=%~dp0
+set JAXWS_HOME=%JAXWS_HOME%\..
+if exist %JAXWS_HOME%\lib\jaxws-tools.jar goto CHECKJAVAHOME
+
+rem Unable to find it
+echo JAXWS_HOME must be set before running this script
+goto END
+
+:CHECKJAVAHOME
+if not "%JAVA_HOME%" == "" goto USE_JAVA_HOME
+
+set JAVA=java
+goto LAUNCH
+
+:USE_JAVA_HOME
+set JAVA="%JAVA_HOME%\bin\java"
+goto LAUNCH
+
+:LAUNCH
+%JAVA% %WSGEN_OPTS% -cp
"%JAVA_HOME%\lib\tools.jar;%JAXWS_HOME%\lib\jaxws-tools.jar"
com.sun.tools.ws.WsGen %*
+
+:END
+%COMSPEC% /C exit %ERRORLEVEL%
Added: subprojects/jbossws-sun-wsimport/sun/src/etc/wsgen.sh
===================================================================
--- subprojects/jbossws-sun-wsimport/sun/src/etc/wsgen.sh (rev 0)
+++ subprojects/jbossws-sun-wsimport/sun/src/etc/wsgen.sh 2007-01-31 02:44:54 UTC (rev
2202)
@@ -0,0 +1,77 @@
+#!/bin/sh
+
+#
+# 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
+#
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+# See the License for the specific language governing
+# permissions and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL
+# Header Notice in each file and include the License file
+# at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+# If applicable, add the following below the CDDL Header,
+# with the fields enclosed by brackets [] replaced by
+# you own identifying information:
+# "Portions Copyrighted [year] [name of copyright owner]"
+#
+# Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+#
+
+#
+# infer JAXWS_HOME if not set
+#
+if [ -z "$JAXWS_HOME" ]
+then
+ # search the installation directory
+
+ PRG=$0
+ progname=`basename $0`
+ saveddir=`pwd`
+
+ cd `dirname $PRG`
+
+ while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '.*/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG="`dirname $PRG`/$link"
+ fi
+ done
+
+ JAXWS_HOME=`dirname "$PRG"`/..
+
+ # make it fully qualified
+ cd "$saveddir"
+ JAXWS_HOME=`cd "$JAXWS_HOME" && pwd`
+
+ cd $saveddir
+fi
+
+[ `expr \`uname\` : 'CYGWIN'` -eq 6 ] &&
+{
+ JAXWS_HOME=`cygpath -w "$JAXWS_HOME"`
+}
+
+#
+# use or infer JAVA_HOME
+#
+if [ -n "$JAVA_HOME" ]
+then
+ JAVA="$JAVA_HOME"/bin/java
+ LOCALCLASSPATH="$JAVA_HOME"/lib/tools.jar
+else
+ JAVA=java
+ JAVACMD=`which $JAVA`
+ BINDIR=`dirname $JAVACMD`
+ LOCALCLASSPATH="$BINDIR"/../lib/tools.jar
+fi
+
+
+exec $JAVA $WSGEN_OPTS -cp "$LOCALCLASSPATH:$JAXWS_HOME/lib/jaxws-tools.jar"
com.sun.tools.ws.WsGen "$@"
Added: subprojects/jbossws-sun-wsimport/sun/src/etc/wsimport.bat
===================================================================
--- subprojects/jbossws-sun-wsimport/sun/src/etc/wsimport.bat (rev
0)
+++ subprojects/jbossws-sun-wsimport/sun/src/etc/wsimport.bat 2007-01-31 02:44:54 UTC (rev
2202)
@@ -0,0 +1,56 @@
+@echo off
+
+REM
+REM The contents of this file are subject to the terms
+REM of the Common Development and Distribution License
+REM (the License). You may not use this file except in
+REM compliance with the License.
+REM
+REM You can obtain a copy of the license at
+REM
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+REM See the License for the specific language governing
+REM permissions and limitations under the License.
+REM
+REM When distributing Covered Code, include this CDDL
+REM Header Notice in each file and include the License file
+REM at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+REM If applicable, add the following below the CDDL Header,
+REM with the fields enclosed by brackets [] replaced by
+REM you own identifying information:
+REM "Portions Copyrighted [year] [name of copyright owner]"
+REM
+REM Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+REM
+
+
+
+
+rem
+rem Infer JAXWS_HOME if not set
+rem
+if not "%JAXWS_HOME%" == "" goto CHECKJAVAHOME
+
+rem Try to locate JAXWS_HOME
+set JAXWS_HOME=%~dp0
+set JAXWS_HOME=%JAXWS_HOME%\..
+if exist %JAXWS_HOME%\lib\jaxws-tools.jar goto CHECKJAVAHOME
+
+rem Unable to find it
+echo JAXWS_HOME must be set before running this script
+goto END
+
+:CHECKJAVAHOME
+if not "%JAVA_HOME%" == "" goto USE_JAVA_HOME
+
+set JAVA=java
+goto LAUNCH
+
+:USE_JAVA_HOME
+set JAVA="%JAVA_HOME%\bin\java"
+goto LAUNCH
+
+:LAUNCH
+%JAVA% %WSIMPORT_OPTS% -cp
"%JAVA_HOME%\lib\tools.jar;%JAXWS_HOME%\lib\jaxws-tools.jar"
com.sun.tools.ws.WsImport %*
+
+:END
+%COMSPEC% /C exit %ERRORLEVEL%
Added: subprojects/jbossws-sun-wsimport/sun/src/etc/wsimport.sh
===================================================================
--- subprojects/jbossws-sun-wsimport/sun/src/etc/wsimport.sh (rev
0)
+++ subprojects/jbossws-sun-wsimport/sun/src/etc/wsimport.sh 2007-01-31 02:44:54 UTC (rev
2202)
@@ -0,0 +1,76 @@
+#!/bin/sh
+
+#
+# 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
+#
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+# See the License for the specific language governing
+# permissions and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL
+# Header Notice in each file and include the License file
+# at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+# If applicable, add the following below the CDDL Header,
+# with the fields enclosed by brackets [] replaced by
+# you own identifying information:
+# "Portions Copyrighted [year] [name of copyright owner]"
+#
+# Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+#
+
+#
+# infer JAXWS_HOME if not set
+#
+if [ -z "$JAXWS_HOME" ]
+then
+ # search the installation directory
+
+ PRG=$0
+ progname=`basename $0`
+ saveddir=`pwd`
+
+ cd `dirname $PRG`
+
+ while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '.*/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG="`dirname $PRG`/$link"
+ fi
+ done
+
+ JAXWS_HOME=`dirname "$PRG"`/..
+
+ # make it fully qualified
+ cd "$saveddir"
+ JAXWS_HOME=`cd "$JAXWS_HOME" && pwd`
+
+ cd $saveddir
+fi
+
+[ `expr \`uname\` : 'CYGWIN'` -eq 6 ] &&
+{
+ JAXWS_HOME=`cygpath -w "$JAXWS_HOME"`
+}
+
+#
+# use or infer JAVA_HOME
+#
+if [ -n "$JAVA_HOME" ]
+then
+ JAVA="$JAVA_HOME"/bin/java
+ LOCALCLASSPATH="$JAVA_HOME"/lib/tools.jar
+else
+ JAVA=java
+ JAVACMD=`which $JAVA`
+ BINDIR=`dirname $JAVACMD`
+ LOCALCLASSPATH="$BINDIR"/../lib/tools.jar
+fi
+
+exec $JAVA $WSIMPORT_OPTS -cp "$LOCALCLASSPATH:$JAXWS_HOME/lib/jaxws-tools.jar"
com.sun.tools.ws.WsImport "$@"
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/istack/ws/AnnotationProcessorFactoryImpl.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/istack/ws/AnnotationProcessorFactoryImpl.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/istack/ws/AnnotationProcessorFactoryImpl.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,114 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.istack.ws;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import
org.jboss.com.sun.tools.ws.processor.modeler.annotation.AnnotationProcessorContext;
+import org.jboss.com.sun.tools.ws.processor.modeler.annotation.WebServiceAP;
+
+import com.sun.mirror.apt.*;
+import com.sun.mirror.declaration.*;
+
+
+
+/*
+ * The JAX-WS {(a)com.sun.mirror.apt.AnnotationProcessorFactory
AnnotationProcessorFactory}
+ * class used by the <a
href="http://java.sun.com/j2se/1.5.0/docs/tooldocs/share/apt.html&qu...
+ * framework.
+ */
+public class AnnotationProcessorFactoryImpl implements AnnotationProcessorFactory {
+
+ private static WebServiceAP wsAP;
+ /*
+ * Processor doesn't examine any options.
+ */
+ static final Collection<String> supportedOptions =
Collections.unmodifiableSet(new HashSet<String>());
+
+
+ /*
+ * Supports javax.jws.*, javax.jws.soap.* and javax.xml.ws.* annotations.
+ */
+ static Collection<String> supportedAnnotations;
+ static {
+ Collection<String> types = new HashSet<String>();
+ types.add("javax.jws.HandlerChain");
+ types.add("javax.jws.Oneway");
+ types.add("javax.jws.WebMethod");
+ types.add("javax.jws.WebParam");
+ types.add("javax.jws.WebResult");
+ types.add("javax.jws.WebService");
+ types.add("javax.jws.soap.InitParam");
+ types.add("javax.jws.soap.SOAPBinding");
+ types.add("javax.jws.soap.SOAPMessageHandler");
+ types.add("javax.jws.soap.SOAPMessageHandlers");
+ types.add("javax.xml.ws.BeginService");
+ types.add("javax.xml.ws.EndService");
+ types.add("javax.xml.ws.BindingType");
+ types.add("javax.xml.ws.ParameterIndex");
+ types.add("javax.xml.ws.RequestWrapper");
+ types.add("javax.xml.ws.ResponseWrapper");
+ types.add("javax.xml.ws.ServiceMode");
+ types.add("javax.xml.ws.WebEndpoint");
+ types.add("javax.xml.ws.WebFault");
+ types.add("javax.xml.ws.WebServiceClient");
+ types.add("javax.xml.ws.WebServiceProvider");
+ types.add("javax.xml.ws.WebServiceRef");
+
+ types.add("javax.xml.ws.security.MessageSecurity");
+ supportedAnnotations = Collections.unmodifiableCollection(types);
+ }
+
+ public AnnotationProcessorFactoryImpl() {
+ }
+
+
+ public Collection<String> supportedOptions() {
+ return supportedOptions;
+ }
+
+ public Collection<String> supportedAnnotationTypes() {
+ return supportedAnnotations;
+ }
+
+ /*
+ * Return an instance of the {@link org.jboss.com.sun.istack.ws.WSAP WSAP}
AnnotationProcesor.
+ */
+ public AnnotationProcessor getProcessorFor(Set<AnnotationTypeDeclaration>
atds,
+ AnnotationProcessorEnvironment apEnv) {
+
+ if (wsAP == null) {
+ AnnotationProcessorContext context = new AnnotationProcessorContext();
+ wsAP = new WebServiceAP(null, null, null, context);
+
+ }
+ wsAP.init(apEnv);
+ return wsAP;
+ }
+}
+
+
+
+
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/istack/ws/AnnotationProcessorFactoryImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/istack/ws/package-info.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/istack/ws/package-info.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/istack/ws/package-info.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,36 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+/**
+ *
+ * <P>This document describes the {@link com.sun.mirror.apt.AnnotationProcessor
AnnotationProcessor}
+ * included with JAX-WS 2.0.
+ *
+ * <p>The {@link org.jboss.com.sun.istack.ws.AnnotationProcessorFactoryImpl
AnnoatationnProcessorFactoryImpl} class
+ * tells the <a
href="http://java.sun.com/j2se/1.5.0/docs/tooldocs/share/apt.html&qu...
+ * framework that there exists an {(a)com.sun.mirror.apt.AnnotationProcessor
AnnotationProcessor}
+ * ({@link com.sun.istak.ws.WSAP WSAP}) for for processing javax.jws.*,
javax.jws.soap.*,
+ * and javax.xml.ws.* annotations.
+ *
+ * @ArchitectureDocument
+*/
+package org.jboss.com.sun.istack.ws;
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/istack/ws/package-info.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/Invoker.java
===================================================================
--- subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/Invoker.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/Invoker.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,75 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws;
+
+import com.sun.tools.xjc.api.util.APTClassLoader;
+import com.sun.tools.xjc.api.util.ToolsJarNotFoundException;
+
+import java.io.OutputStream;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+/**
+ * Invokes JAX-WS tools in a special class loader that can pick up APT classes,
+ * even if it's not available in the tool launcher classpath.
+ *
+ * @author Kohsuke Kawaguchi
+ */
+final class Invoker {
+ /**
+ * List of packages that need to be loaded in {@link APTClassLoader}.
+ */
+ private static final String[] prefixes = {
+ "com.sun.tools.jxc.",
+ "com.sun.tools.xjc.",
+ "com.sun.tools.apt.",
+ "org.jboss.com.sun.tools.ws.",
+ "com.sun.tools.javac.",
+ "com.sun.tools.javadoc.",
+ "com.sun.mirror."
+ };
+
+ static void main(String toolName, String[] args) throws Throwable {
+ ClassLoader oldcc = Thread.currentThread().getContextClassLoader();
+ try {
+ APTClassLoader cl = new
APTClassLoader(Invoker.class.getClassLoader(),prefixes);
+ Thread.currentThread().setContextClassLoader(cl);
+
+ Class compileTool =
cl.loadClass("org.jboss.com.sun.tools.ws.wscompile.CompileTool");
+ Constructor ctor =
compileTool.getConstructor(OutputStream.class,String.class);
+ Object tool = ctor.newInstance(System.out,toolName);
+ Method runMethod = compileTool.getMethod("run",String[].class);
+ boolean r = (Boolean)runMethod.invoke(tool,new Object[]{args});
+ System.exit(r ? 0 : 1);
+ } catch (ToolsJarNotFoundException e) {
+ System.err.println(e.getMessage());
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ } finally {
+ Thread.currentThread().setContextClassLoader(oldcc);
+ }
+
+ System.exit(1);
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/Invoker.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/ToolVersion.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/ToolVersion.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/ToolVersion.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,35 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws;
+
+import org.jboss.com.sun.xml.ws.util.Version;
+
+/**
+ * Obtains the version number of the JAX-WS tools.
+ * @author Kohsuke Kawaguchi
+ */
+public abstract class ToolVersion {
+ private ToolVersion() {} // no instanciation please
+
+ public static final Version VERSION =
Version.create(ToolVersion.class.getResourceAsStream("version.properties"));
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/ToolVersion.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/WsGen.java
===================================================================
--- subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/WsGen.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/WsGen.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,32 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws;
+
+/**
+ * @author Vivek Pandey
+ */
+
+public class WsGen {
+ public static void main(String[] args) throws Throwable {
+ Invoker.main("wsgen",args);
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/WsGen.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/WsImport.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/WsImport.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/WsImport.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,32 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws;
+
+/**
+ * @author Vivek Pandey
+ */
+
+public class WsImport {
+ public static void main(String[] args) throws Throwable {
+ Invoker.main("wsimport",args);
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/WsImport.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/ant/Apt.java
===================================================================
--- subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/ant/Apt.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/ant/Apt.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,486 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.ant;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.Execute;
+import org.apache.tools.ant.taskdefs.LogStreamHandler;
+import org.apache.tools.ant.types.Commandline;
+import org.apache.tools.ant.types.CommandlineJava;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.Reference;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * apt task for use with the JAXWS project.
+ */
+public class Apt extends Task {
+
+ /** -classpath option */
+ protected Path compileClasspath = null;
+
+ public Path getClasspath() { return compileClasspath; }
+ public void setClasspath(Path classpath) {
+ if (compileClasspath == null) {
+ compileClasspath = classpath;
+ } else {
+ compileClasspath.append(classpath);
+ }
+ }
+
+ /**
+ * Creates a nested classpath element.
+ */
+ public Path createClasspath() {
+ if (compileClasspath == null) {
+ compileClasspath = new Path(project);
+ }
+ return compileClasspath.createPath();
+ }
+
+ /**
+ * Adds a reference to a CLASSPATH defined elsewhere.
+ */
+ public void setClasspathRef(Reference r) {
+ createClasspath().setRefid(r);
+ }
+
+ /** -d option: directory to output processor and javac generated class files */
+ private File destDir = null;
+ public File getDestdir() { return this.destDir; }
+ public void setDestdir(File base) { this.destDir = base; }
+
+ /** -s option: directory to place processor generated source files */
+ private File sourceDestDir;
+ public void setSourcedestdir(File sourceBase) { this.sourceDestDir = sourceBase; }
+ public File getSourcedestdir() { return sourceDestDir; }
+
+
+ /** -A option */
+ protected List<Option> options = new ArrayList<Option>();
+ public List<Option> getOptions() { return options; }
+
+ public Option createOption() {
+ Option option = new Option();
+ options.add(option);
+ return option;
+ }
+
+ /** -J<flag> option: Pass <flag> directly to the runtime */
+ protected List<Jvmarg> jvmargs = new ArrayList<Jvmarg>();
+ public List<Jvmarg> getJvmargs() { return jvmargs; }
+
+ public Jvmarg createJvmarg() {
+ Jvmarg jvmarg = new Jvmarg();
+ jvmargs.add(jvmarg);
+ return jvmarg;
+ }
+
+ /** -nocompile option */
+ private boolean noCompile = false;
+ public boolean isNocompile() { return noCompile; }
+ public void setNocompile(boolean noCompile) { this.noCompile = noCompile; }
+
+ /******************** -print option **********************/
+ private boolean print = false;
+ public boolean isPrint() { return print; }
+ public void setPrint(boolean print) { this.print = print; }
+
+ /******************** -factorypath option **********************/
+ private File factoryPath = null;
+ public File getFactorypath() { return factoryPath; }
+ public void setFactorypath(File factoryPath) { this.factoryPath = factoryPath; }
+
+ /******************** -factory option **********************/
+ private String factory = null;
+ public String getFactory() { return factory; }
+ public void setFactory(String factory) { this.factory = factory; }
+
+ /******************** -XListAnnotationTypes option **********************/
+ private boolean xListAnnotationTypes = false;
+ public boolean isXlistannotationtypes() { return xListAnnotationTypes; }
+ public void setXlistannotationtypes(boolean xListAnnotationTypes) {
this.xListAnnotationTypes = xListAnnotationTypes; }
+
+ /******************** -XListDeclarations option **********************/
+ private boolean xListDeclarations = false;
+ public boolean isXlistdeclarations() { return xListDeclarations; }
+ public void setXlistdeclarations(boolean xListDeclarations) { this.xListDeclarations
= xListDeclarations; }
+
+ /******************** -XPrintAptRounds option **********************/
+ private boolean xPrintAptRounds = false;
+ public boolean isXprintaptrounds() { return xPrintAptRounds; }
+ public void setXprintaptrounds(boolean xPrintAptRounds) { this.xPrintAptRounds =
xPrintAptRounds; }
+
+ /******************** -XPrintFactoryInfo option **********************/
+ private boolean xPrintFactoryInfo = false;
+ public boolean isXprintfactoryinfo() { return xPrintFactoryInfo; }
+ public void setXprintfactoryinfo(boolean xPrintFactoryInfo) { this.xPrintFactoryInfo
= xPrintFactoryInfo; }
+
+ /******************** -XclassesAsDecls option **********************/
+ private boolean xClassesAsDecls = false;
+ public boolean isXclassesasdecls() { return xClassesAsDecls; }
+ public void setXclassesasdecls(boolean xClassesAsDecls) { this.xClassesAsDecls =
xClassesAsDecls; }
+
+ /** Inherited from javac */
+
+ /** -g option: debugging info */
+ protected boolean debug = false;
+ public boolean isDebug() { return debug; }
+ public void setDebug(boolean debug) { this.debug = debug; }
+
+ /** debug level */
+ protected String debugLevel = null;
+ public String getDebuglevel() { return debugLevel; }
+ public void setDebuglevel(String debugLevel) { this.debugLevel = debugLevel; }
+
+ /** -nowarn option: generate no warnings */
+ protected boolean nowarn = false;
+ public boolean isNowarn() { return nowarn; }
+ public void setNowarn(boolean nowarn) { this.nowarn = nowarn; }
+
+ /** -deprecation option: output source locations where deprecated APIs are used */
+ protected boolean deprecation = false;
+ public boolean isDeprecation() { return deprecation; }
+ public void setDeprecation(boolean deprecation) { this.deprecation = deprecation; }
+
+ /** -bootclasspath option: override location of bootstrap class files */
+ protected Path bootclassPath = null;
+ public Path getBootclasspath() { return bootclassPath; }
+ public void setBootclasspath(Path bootclassPath) { this.bootclassPath =
bootclassPath; }
+
+ /** -extdirs option: override location of installed extensions */
+ protected String extdirs = null;
+ public String getExtdirs() { return extdirs; }
+ public void setExtdirs(String extdirs) { this.extdirs = extdirs; }
+
+ /** -endorseddirs option: override location of endorsed standards path */
+ protected String endorseddirs = null;
+ public String getEndorseddirs() { return endorseddirs; }
+ public void setEndorseddirs(String endorseddirs) { this.endorseddirs = endorseddirs;
}
+
+ /** -verbose option: output messages about what the compiler is doing */
+ protected boolean verbose = false;
+ public boolean isVerbose() { return verbose; }
+ public void setVerbose(boolean verbose) { this.verbose = verbose; }
+
+ /** -sourcepath option: Specify where to find input source files */
+ protected Path sourcePath = null;
+ public Path getSourcepath() { return sourcePath; }
+ public void setSourcepath(Path sourcePath) { this.sourcePath = sourcePath; }
+
+ /** -encoding option: character encoding used by the source files */
+ protected String encoding = null;
+ public String getEncoding() { return encoding; }
+ public void setEncoding(String encoding) { this.encoding = encoding; }
+
+ /** -target option: generate class files for specific VM version */
+ protected String targetVM = null;
+ public String getTarget() { return targetVM; }
+ public void setTarget(String target) { this.targetVM = target; }
+
+
+
+ /** Others */
+
+ /** -fork option: */
+ protected boolean fork = false;
+ public boolean isFork() { return fork; }
+ public void setFork(boolean fork) { this.fork = fork; }
+
+ protected List<FileSet> sourceFileset = new ArrayList<FileSet>();
+ public void addConfiguredSource(FileSet fileset) {
+ sourceFileset.add(fileset);
+ }
+
+
+ private Commandline setupAptCommand() {
+ Commandline cmd = setupAptArgs();
+
+ // classpath option (cp option just uses classpath option)
+ Path classpath = getClasspath();
+
+ if (classpath != null && !classpath.toString().equals("")) {
+ cmd.createArgument().setValue("-classpath");
+ cmd.createArgument().setPath(classpath);
+ }
+ return cmd;
+ }
+
+ private Commandline setupAptForkCommand() {
+ CommandlineJava forkCmd = new CommandlineJava();
+
+ Path classpath = getClasspath();
+ forkCmd.createClasspath(getProject()).append(classpath);
+ forkCmd.setClassname("com.sun.tools.apt.Main");
+ if (null != getJvmargs()) {
+ for (Jvmarg jvmarg : jvmargs) {
+ forkCmd.createVmArgument().setLine("-J" + jvmarg.getValue());
+ }
+ }
+
+ Commandline cmd = setupAptArgs();
+ cmd.createArgument(true).setLine(forkCmd.toString());
+ return cmd;
+ }
+
+ private Commandline setupAptArgs() {
+ Commandline cmd = new Commandline();
+
+ if (null != getDestdir() && !getDestdir().getName().equals(""))
{
+ cmd.createArgument().setValue("-d");
+ cmd.createArgument().setFile(getDestdir());
+ }
+
+ if (null != getSourcedestdir() &&
!getSourcedestdir().getName().equals("")) {
+ cmd.createArgument().setValue("-s");
+ cmd.createArgument().setFile(getSourcedestdir());
+ }
+
+ if (getSourcepath() == null)
+ throw new BuildException("\"sourcePath\" attribute must be
set.");
+
+ if (getSourcepath() != null &&
!getSourcepath().toString().equals("")) {
+ cmd.createArgument().setValue("-sourcepath");
+ cmd.createArgument().setValue(getSourcepath().toString());
+ }
+
+ if (getBootclasspath() != null &&
!getBootclasspath().toString().equals("")) {
+ cmd.createArgument().setValue("-bootclasspath");
+ cmd.createArgument().setValue(getBootclasspath().toString());
+ }
+
+ if (getExtdirs() != null && !getExtdirs().equals("")) {
+ cmd.createArgument().setValue("-extdirs");
+ cmd.createArgument().setValue(getExtdirs());
+ }
+
+ if (getEndorseddirs() != null && !getEndorseddirs().equals(""))
{
+ cmd.createArgument().setValue("-endorseddirs");
+ cmd.createArgument().setValue(getEndorseddirs());
+ }
+
+ if (isDebug()) {
+ String debugOption = "";
+ debugOption = "-g";
+ if (getDebuglevel() != null &&
!getDebuglevel().equals(""))
+ debugOption += ":" + getDebuglevel();
+ cmd.createArgument().setValue(debugOption);
+ } else
+ cmd.createArgument().setValue("-g:none");
+
+ if (isVerbose())
+ cmd.createArgument().setValue("-verbose");
+
+ if (getEncoding() != null && !getEncoding().equals("")) {
+ cmd.createArgument().setValue("-encoding");
+ cmd.createArgument().setValue(getEncoding());
+ }
+
+ if (getTarget() != null && !getTarget().equals("")) {
+ cmd.createArgument().setValue("-target");
+ cmd.createArgument().setValue(getTarget());
+ }
+
+ for (Jvmarg jvmarg : jvmargs) {
+ cmd.createArgument().setValue("-J" + jvmarg.getValue());
+ }
+
+ for (Option option : options) {
+ cmd.createArgument().setValue("-A" + option.getKey() +
"=" + option.getValue());
+ }
+
+ if(isNowarn()){
+ cmd.createArgument().setValue("-nowarn");
+ }
+
+ if(isNocompile()){
+ cmd.createArgument().setValue("-nocompile");
+ }
+
+ if(isDeprecation()){
+ cmd.createArgument().setValue("-deprecation");
+ }
+
+ if(isPrint()){
+ cmd.createArgument().setValue("-print");
+ }
+
+ if(getFactorypath() != null){
+ cmd.createArgument().setValue("-factorypath");
+ cmd.createArgument().setValue(getFactorypath().toString());
+ }
+
+ if(getFactory() != null){
+ cmd.createArgument().setValue("-factory");
+ cmd.createArgument().setValue(getFactory());
+ }
+
+ if (isXlistannotationtypes()) {
+ cmd.createArgument().setValue("-XListAnnotationTypes");
+ }
+
+ if (isXlistdeclarations()) {
+ cmd.createArgument().setValue("-XListDeclarations");
+ }
+
+ if (isXprintaptrounds()) {
+ cmd.createArgument().setValue("-XPrintAptRounds");
+ }
+
+ if (isXprintfactoryinfo()) {
+ cmd.createArgument().setValue("-XPrintFactoryInfo");
+ }
+
+ if (isXprintfactoryinfo()) {
+ cmd.createArgument().setValue("-XclassesAsDecls");
+ }
+
+ Set<File> sourceFiles = new HashSet<File>();
+ prepareSourceList(sourceFiles);
+
+ if(!sourceFiles.isEmpty()){
+ for(File source : sourceFiles){
+ cmd.createArgument().setFile(source);
+ }
+ }
+
+ return cmd;
+ }
+
+ void prepareSourceList(Set<File> sourceFiles) throws BuildException {
+ if (sourceFileset != null) {
+ for (FileSet fileset : sourceFileset) {
+ DirectoryScanner ds = fileset.getDirectoryScanner(getProject());
+ String[] includedFiles = ds.getIncludedFiles();
+ File baseDir = ds.getBasedir();
+ for (int i = 0; i < includedFiles.length; ++i) {
+ sourceFiles.add(new File(baseDir, includedFiles[i]));
+ }
+ }
+ }
+ }
+
+ /** Called by the project to let the task do it's work **/
+ public void execute() throws BuildException {
+
+ PrintWriter writer = null;
+ boolean ok = false;
+ try {
+ Commandline cmd = fork ?
+ setupAptForkCommand() : setupAptCommand();
+
+ if (verbose) {
+ log("command line: " + "apt " + cmd.toString());
+ }
+ int status = 0;
+ if (fork) {
+ status = run(cmd.getCommandline());
+ } else {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ writer = new PrintWriter(baos);
+
+ ClassLoader old = Thread.currentThread().getContextClassLoader();
+
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
+ try {
+ com.sun.tools.apt.Main aptTool = new com.sun.tools.apt.Main();
+ status = aptTool.process(writer, cmd.getArguments());
+ writer.flush();
+ if (verbose || baos.size()!=0)
+ log(baos.toString());
+ } finally {
+ Thread.currentThread().setContextClassLoader(old);
+ }
+ }
+ ok = (status == 0) ? true : false;
+ if (!ok) {
+ if (!verbose) {
+ log("Command invoked: "+"apt "+cmd.toString());
+ }
+ throw new BuildException("apt failed", location);
+ }
+ } catch (Exception ex) {
+ if (ex instanceof BuildException) {
+ throw (BuildException)ex;
+ } else {
+ throw new BuildException("Error starting apt: ", ex,
+ getLocation());
+ }
+ } finally {
+ if (writer != null) {
+ writer.close();
+ }
+ }
+ }
+
+ /**
+ * Executes the given classname with the given arguments in a separate VM.
+ */
+ private int run(String[] command) throws BuildException {
+ FileOutputStream fos = null;
+ Execute exe = null;
+ LogStreamHandler logstr = new LogStreamHandler(this,
+ Project.MSG_INFO, Project.MSG_WARN);
+ exe = new Execute(logstr);
+ exe.setAntRun(project);
+ exe.setCommandline(command);
+ try {
+ int rc = exe.execute();
+ if (exe.killedProcess()) {
+ log("Timeout: killed the sub-process", Project.MSG_WARN);
+ }
+ return rc;
+ } catch (IOException e) {
+ throw new BuildException(e, location);
+ }
+ }
+
+ public static class Option {
+ protected String key;
+ protected String value;
+
+ public String getKey() { return key; }
+ public void setKey(String key) { this.key = key; }
+
+ public String getValue() { return value; }
+ public void setValue(String value) { this.value = value; }
+ }
+
+ public static class Jvmarg {
+ protected String value;
+
+ public String getValue() { return value; }
+ public void setValue(String value) { this.value = value; }
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/ant/Apt.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/ant/WsGen.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/ant/WsGen.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/ant/WsGen.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,509 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.ant;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Execute;
+import org.apache.tools.ant.taskdefs.LogOutputStream;
+import org.apache.tools.ant.taskdefs.LogStreamHandler;
+import org.apache.tools.ant.taskdefs.MatchingTask;
+import org.apache.tools.ant.types.Commandline;
+import org.apache.tools.ant.types.CommandlineJava;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.Reference;
+import org.jboss.com.sun.tools.ws.wscompile.CompileTool;
+import org.jboss.com.sun.xml.ws.util.VersionUtil;
+
+
+/**
+ * wsgen task for use with the JAXWS project.
+ *
+ */
+public class WsGen extends MatchingTask {
+ private CommandlineJava cmd = new CommandlineJava();
+ /************************* -classpath option *************************/
+ protected Path compileClasspath = null;
+
+ /**
+ * Gets the classpath.
+ */
+ public Path getClasspath() {
+ return compileClasspath;
+ }
+
+ /**
+ * Set the classpath to be used for this compilation.
+ */
+ public void setClasspath(Path classpath) {
+ if (compileClasspath == null) {
+ compileClasspath = classpath;
+ } else {
+ compileClasspath.append(classpath);
+ }
+ }
+
+ /**
+ * Creates a nested classpath element.
+ */
+ public Path createClasspath() {
+ if (compileClasspath == null) {
+ compileClasspath = new Path(project);
+ }
+ return compileClasspath.createPath();
+ }
+
+ /**
+ * Adds a reference to a CLASSPATH defined elsewhere.
+ */
+ public void setClasspathRef(Reference r) {
+ createClasspath().setRefid(r);
+ }
+
+ /************************* -cp option *************************/
+ /**
+ * Gets the classpath.
+ */
+ public Path getCP() {
+ return getClasspath();
+ }
+
+ /**
+ * Set the classpath to be used for this compilation.
+ */
+ public void setCP(Path classpath) {
+ setClasspath(classpath);
+ }
+
+ /************************* -d option *************************/
+ private File destDir = null;
+
+ /** Gets the base directory to output generated class. **/
+ public File getDestdir() {
+ return this.destDir;
+ }
+
+ /** Sets the base directory to output generated class. **/
+ public void setDestdir(File base) {
+ this.destDir = base;
+ }
+
+ /**
+ * Adds a JVM argument.
+ *
+ * @return JVM argument created
+ */
+ public Commandline.Argument createJvmarg() {
+ return cmd.createVmArgument();
+ }
+
+ /******************** -extensions option **********************/
+ protected boolean extension;
+
+ /** Gets the "extension" flag. **/
+ public boolean getExtension() {
+ return extension;
+ }
+
+ /** Sets the "extension" flag. **/
+ public void setExtension(boolean extension) {
+ this.extension = extension;
+ }
+
+ /************************* -keep option *************************/
+ private boolean keep = false;
+
+ /** Gets the "keep" flag. **/
+ public boolean getKeep() {
+ return keep;
+ }
+
+ /** Sets the "keep" flag. **/
+ public void setKeep(boolean keep) {
+ this.keep = keep;
+ }
+
+ /************************* -fork option *************************/
+ private boolean fork = false;
+
+ /** Gets the "fork" flag. **/
+ public boolean getFork() {
+ return fork;
+ }
+
+ /** Sets the "fork" flag. **/
+ public void setFork(boolean fork) {
+ this.fork = fork;
+ }
+
+ /************************* -r option *************************/
+ private File resourceDestDir = null;
+
+ /** Gets the directory for non-class generated files. **/
+ public File getResourcedestdir() {
+ return this.resourceDestDir;
+ }
+
+ /** Sets the directory for non-class generated files. **/
+ public void setResourcedestdir(File resourceDir) {
+ this.resourceDestDir = resourceDir;
+ }
+
+ /************************* -O option *************************/
+ private boolean optimize = false;
+
+ /** Gets the optimize flag. **/
+ public boolean getOptimize() {
+ return optimize;
+ }
+
+ /** Sets the optimize flag. **/
+ public void setOptimize(boolean optimize) {
+ this.optimize = optimize;
+ }
+
+ /************************* -s option *************************/
+ private File sourceDestDir;
+
+ /** Sets the directory to place generated source java files. **/
+ public void setSourcedestdir(File sourceBase) {
+ keep = true;
+ this.sourceDestDir = sourceBase;
+ }
+
+ /** Gets the directory to place generated source java files. **/
+ public File getSourcedestdir() {
+ return sourceDestDir;
+ }
+
+ /************************* -verbose option *************************/
+ protected boolean verbose = false;
+
+ /** Gets the "verbose" flag. **/
+ public boolean getVerbose() {
+ return verbose;
+ }
+
+ /** Sets the "verbose" flag. **/
+ public void setVerbose(boolean verbose) {
+ this.verbose = verbose;
+ }
+
+ /************************* -g option *************************/
+ private boolean debug = false;
+
+ /** Gets the debug flag. **/
+ public boolean getDebug() {
+ return debug;
+ }
+
+ /** Sets the debug flag. **/
+ public void setDebug(boolean debug) {
+ this.debug = debug;
+ }
+
+ /************************* -wsdl option *************************/
+ private boolean genWsdl = false;
+
+ /** Gets the genWsdl flag. **/
+ public boolean getGenwsdl() {
+ return genWsdl;
+ }
+
+ /** Sets the genWsdl flag. **/
+ public void setGenwsdl(boolean genWsdl) {
+ this.genWsdl = genWsdl;
+ }
+
+ /************* protocol option used only with -wsdl option*****************/
+ private String protocol = "";
+
+ /** Gets the protocol. **/
+ public String getProtocol() {
+ return protocol;
+ }
+
+ /** Sets the protocol. **/
+ public void setProtocol(String protocol) {
+ this.protocol = protocol;
+ }
+
+ /************* serviceName option used only with -wsdl option*****************/
+ private String serviceName = null;
+
+ /** Gets the serviceName. **/
+ public String getServicename() {
+ return serviceName;
+ }
+
+ /** Sets the serviceName. **/
+ public void setServicename(String name) {
+ this.serviceName = name;
+ }
+
+ /************* portName option used only with -wsdl option*****************/
+ private String portName = null;
+
+ /** Gets the portName. **/
+ public String getPortname() {
+ return portName;
+ }
+
+ /** Sets the serviceName. **/
+ public void setPortname(String name) {
+ this.portName = name;
+ }
+
+ /*********************** include ant runtime **********************/
+ /** not sure if these methods are needed */
+ private boolean includeAntRuntime = false;
+
+ /**
+ * Include ant's own classpath in this task's classpath?
+ */
+ public void setIncludeantruntime(boolean include) {
+ includeAntRuntime = include;
+ }
+
+ /**
+ * Gets whether or not the ant classpath is to be included in the
+ * task's classpath.
+ */
+ public boolean getIncludeantruntime() {
+ return includeAntRuntime;
+ }
+
+ /*********************** include java runtime **********************/
+ /** not sure if these methods are needed */
+ private boolean includeJavaRuntime = false;
+
+ /**
+ * Sets whether or not to include the java runtime libraries to this
+ * task's classpath.
+ */
+ public void setIncludejavaruntime(boolean include) {
+ includeJavaRuntime = include;
+ }
+
+ /**
+ * Gets whether or not the java runtime should be included in this
+ * task's classpath.
+ */
+ public boolean getIncludejavaruntime() {
+ return includeJavaRuntime;
+ }
+
+ private String sei;
+ /**
+ * @return Returns the sei.
+ */
+ public String getSei() {
+ return sei;
+ }
+ public void setSei(String endpointImplementationClass) {
+ this.sei = endpointImplementationClass;
+ }
+
+ private void setupWscompileCommand() {
+ Path classpath = getClasspath();
+ if (classpath != null && !classpath.toString().equals("")) {
+ cmd.createArgument().setValue("-classpath");
+ cmd.createArgument().setPath(classpath);
+ }
+ setupWscompileArgs();
+
+ }
+
+ private void setupWscompileForkCommand() {
+
+ Path classpath = getClasspath();
+ cmd.createClasspath(getProject()).append(classpath);
+ cmd.setClassname("org.jboss.com.sun.tools.ws.WsGen");
+ setupWscompileArgs();
+ //cmd.createArgument(true).setLine(forkCmd.toString());
+
+ }
+
+ private void setupWscompileArgs() {
+
+ // d option
+ if (null != getDestdir() && !getDestdir().getName().equals(""))
{
+ cmd.createArgument().setValue("-d");
+ cmd.createArgument().setFile(getDestdir());
+ }
+
+ // g option
+ if (getDebug()) {
+ cmd.createArgument().setValue("-g");
+ }
+
+ // extension flag
+ if (getExtension()) {
+ cmd.createArgument().setValue("-extension");
+ }
+
+ // keep option
+ if (getKeep()) {
+ cmd.createArgument().setValue("-keep");
+ }
+
+ if (getGenwsdl()) {
+ String tmp = "-wsdl";
+ if (protocol.length() > 0)
+ tmp += ":"+protocol;
+ cmd.createArgument().setValue(tmp);
+
+ if (serviceName != null && serviceName.length() > 0) {
+ cmd.createArgument().setValue("-servicename");
+ cmd.createArgument().setValue(serviceName);
+ }
+
+ if (portName != null && portName.length() > 0) {
+ cmd.createArgument().setValue("-portname");
+ cmd.createArgument().setValue(portName);
+ }
+ }
+
+
+ // r option
+ if (null != getResourcedestdir() &&
!getResourcedestdir().getName().equals("")) {
+ cmd.createArgument().setValue("-r");
+ cmd.createArgument().setFile(getResourcedestdir());
+ }
+
+ // optimize option
+ if (getOptimize()) {
+ cmd.createArgument().setValue("-O");
+ }
+
+ // s option
+ if (null != getSourcedestdir() &&
!getSourcedestdir().getName().equals("")) {
+ cmd.createArgument().setValue("-s");
+ cmd.createArgument().setFile(getSourcedestdir());
+ }
+
+ // verbose option
+ if (getVerbose()) {
+ cmd.createArgument().setValue("-verbose");
+ }
+
+
+ if (getSei() != null) {
+ cmd.createArgument().setValue(getSei());
+ }
+
+ }
+
+
+ /** Called by the project to let the task do it's work **/
+ public void execute() throws BuildException {
+ /* Create an instance of the rmic, redirecting output to
+ * the project log
+ */
+ LogOutputStream logstr = null;
+ boolean ok = false;
+ try {
+ if(fork){
+ setupWscompileForkCommand();
+ } else {
+ if (cmd.getVmCommand().size() > 1) {
+ log("JVM args ignored when same JVM is
used.",Project.MSG_WARN);
+ }
+ setupWscompileCommand();
+ }
+ if (fork) {
+ if (verbose) { // Fix for CR 6444561
+ log("command line: "+"wsgen "+cmd.toString());
+ }
+ int status = run(cmd.getCommandline());
+ ok = (status == 0) ? true : false;
+ } else {
+ if (verbose) { // Fix for CR 6444561
+ log("command line: "+"wsgen
"+cmd.getJavaCommand().toString());
+ }
+ logstr = new LogOutputStream(this, Project.MSG_WARN);
+
+ ClassLoader old = Thread.currentThread().getContextClassLoader();
+
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
+ try {
+ CompileTool compTool = new CompileTool(logstr, "wsgen");
+ ok = compTool.run(cmd.getJavaCommand().getArguments());
+ } finally {
+ Thread.currentThread().setContextClassLoader(old);
+ }
+ }
+ if (!ok) {
+ if (!verbose) {
+ log("Command invoked: "+"wsgen
"+cmd.toString());
+ }
+ throw new BuildException("wsgen failed", location);
+ }
+ } catch (Exception ex) {
+ if (ex instanceof BuildException) {
+ throw (BuildException)ex;
+ } else {
+ throw new BuildException("Error starting wsgen: ", ex,
+ getLocation());
+ }
+ } finally {
+ try {
+ if (logstr != null) {
+ logstr.close();
+ }
+ } catch (IOException e) {
+ throw new BuildException(e);
+ }
+ }
+ }
+
+ /**
+ * Executes the given classname with the given arguments in a separate VM.
+ */
+ private int run(String[] command) throws BuildException {
+ FileOutputStream fos = null;
+ Execute exe = null;
+ LogStreamHandler logstr = new LogStreamHandler(this,
+ Project.MSG_INFO, Project.MSG_WARN);
+ exe = new Execute(logstr);
+ exe.setAntRun(project);
+ exe.setCommandline(command);
+ try {
+ int rc = exe.execute();
+ if (exe.killedProcess()) {
+ log("Timeout: killed the sub-process", Project.MSG_WARN);
+ }
+ return rc;
+ } catch (IOException e) {
+ throw new BuildException(e, location);
+ }
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/ant/WsGen.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/ant/WsImport.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/ant/WsImport.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/ant/WsImport.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,475 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.ant;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Execute;
+import org.apache.tools.ant.taskdefs.LogOutputStream;
+import org.apache.tools.ant.taskdefs.LogStreamHandler;
+import org.apache.tools.ant.taskdefs.MatchingTask;
+import org.apache.tools.ant.types.Commandline;
+import org.apache.tools.ant.types.CommandlineJava;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.Reference;
+import org.apache.tools.ant.types.XMLCatalog;
+
+import org.apache.tools.ant.AntClassLoader;
+import org.jboss.com.sun.tools.ws.wscompile.CompileTool;
+import org.xml.sax.EntityResolver;
+
+/**
+ * wscompile task for use with the JAXWS project.
+ *
+ */
+public class WsImport extends MatchingTask {
+
+ private CommandlineJava cmd = new CommandlineJava();
+ /************************* -d option *************************/
+ private File destDir = null;
+
+ /** Gets the base directory to output generated class. **/
+ public File getDestdir() {
+ return this.destDir;
+ }
+
+ /** Sets the base directory to output generated class. **/
+ public void setDestdir(File base) {
+ this.destDir = base;
+ }
+
+ /** wsdllocation - set @WebService.wsdlLocation and @WebServiceClient.wsdlLocation
values */
+
+ private String wsdlLocation;
+
+ public String getWsdllocation() {
+ return wsdlLocation;
+ }
+
+ public void setWsdllocation(String wsdlLocation) {
+ this.wsdlLocation = wsdlLocation;
+ }
+
+ public void addConfiguredXMLCatalog(XMLCatalog entityResolver) {
+ if(this.xmlCatalog==null){
+ this.xmlCatalog = new XMLCatalog();
+ xmlCatalog.setProject(getProject());
+ }
+ this.xmlCatalog.addConfiguredXMLCatalog(entityResolver);
+ }
+
+ private XMLCatalog xmlCatalog;
+
+ private String pkg;
+ public void setPackage(String pkg){
+ this.pkg = pkg;
+ }
+
+ public String getPackage(){
+ return pkg;
+ }
+
+ /**
+ * Adds a JVM argument.
+ *
+ * @return JVM argument created
+ */
+ public Commandline.Argument createJvmarg() {
+ return cmd.createVmArgument();
+ }
+
+ /******************** -extensions option **********************/
+ protected boolean extension;
+
+ /** Gets the "extension" flag. **/
+ public boolean getExtension() {
+ return extension;
+ }
+
+ /** Sets the "extension" flag. **/
+ public void setExtension(boolean extension) {
+ this.extension = extension;
+ }
+
+ /************************* -keep option *************************/
+ private boolean keep = false;
+
+ /** Gets the "keep" flag. **/
+ public boolean getKeep() {
+ return keep;
+ }
+
+ /** Sets the "keep" flag. **/
+ public void setKeep(boolean keep) {
+ this.keep = keep;
+ }
+
+ /************************* -fork option *************************/
+ private boolean fork = false;
+
+ /** Gets the "fork" flag. **/
+ public boolean getFork() {
+ return fork;
+ }
+
+ /** Sets the "fork" flag. **/
+ public void setFork(boolean fork) {
+ this.fork = fork;
+ }
+
+ /************************* -O option *************************/
+ private boolean optimize = false;
+
+ /** Gets the optimize flag. **/
+ public boolean getOptimize() {
+ return optimize;
+ }
+
+ /** Sets the optimize flag. **/
+ public void setOptimize(boolean optimize) {
+ this.optimize = optimize;
+ }
+
+ /************************* -s option *************************/
+ private File sourcedestdir;
+
+ /** Sets the directory to place generated source java files. **/
+ public void setSourcedestdir(File sourceBase) {
+ keep = true;
+ this.sourcedestdir = sourceBase;
+ }
+
+ /** Gets the directory to place generated source java files. **/
+ public File getSourcedestdir() {
+ return sourcedestdir;
+ }
+
+ /************************* -verbose option *************************/
+ protected boolean verbose = false;
+
+ /** Gets the "verbose" flag. **/
+ public boolean getVerbose() {
+ return verbose;
+ }
+
+ /** Sets the "verbose" flag. **/
+ public void setVerbose(boolean verbose) {
+ this.verbose = verbose;
+ }
+
+ /************************* -g option *************************/
+ private boolean debug = false;
+
+ /** Gets the debug flag. **/
+ public boolean getDebug() {
+ return debug;
+ }
+
+ /** Sets the debug flag. **/
+ public void setDebug(boolean debug) {
+ this.debug = debug;
+ }
+
+ /*********************** include ant runtime **********************/
+ /** not sure if these methods are needed */
+ private boolean includeAntRuntime = false;
+
+ /**
+ * Include ant's own classpath in this task's classpath?
+ */
+ public void setIncludeantruntime(boolean include) {
+ includeAntRuntime = include;
+ }
+
+ /**
+ * Gets whether or not the ant classpath is to be included in the
+ * task's classpath.
+ */
+ public boolean getIncludeantruntime() {
+ return includeAntRuntime;
+ }
+
+ /*********************** include java runtime **********************/
+ /** not sure if these methods are needed */
+ private boolean includeJavaRuntime = false;
+
+ /**
+ * Sets whether or not to include the java runtime libraries to this
+ * task's classpath.
+ */
+ public void setIncludejavaruntime(boolean include) {
+ includeJavaRuntime = include;
+ }
+
+ /**
+ * Gets whether or not the java runtime should be included in this
+ * task's classpath.
+ */
+ public boolean getIncludejavaruntime() {
+ return includeJavaRuntime;
+ }
+
+ private String binding;
+ /**
+ * @return Returns the binding.
+ */
+ public String getBinding() {
+ return binding;
+ }
+ /**
+ * @param binding The binding to set.
+ */
+ public void setBinding(String binding) {
+ this.binding = binding;
+ }
+
+ /**
+ * Adds a new catalog file.
+ */
+ public void setCatalog( File catalog ) {
+ this.catalog = catalog;
+ }
+
+ public File getCatalog(){
+ return catalog;
+ }
+
+ private File catalog;
+
+
+ private String wsdl;
+ /**
+ * @return Returns the wsdl.
+ */
+ public String getWsdl() {
+ return wsdl;
+ }
+ /**
+ * @param wsdl The wsdl to set.
+ */
+ public void setWsdl(String wsdl) {
+ this.wsdl = wsdl;
+ }
+
+ public void addConfiguredBinding( FileSet fs ) {
+ DirectoryScanner ds = fs.getDirectoryScanner(project);
+ String[] includedFiles = ds.getIncludedFiles();
+ File baseDir = ds.getBasedir();
+ for (int i = 0; i < includedFiles.length; ++i) {
+ bindingFiles.add(new File(baseDir, includedFiles[i]));
+ }
+ }
+
+ private void setupWsimportForkCommand() {
+ ClassLoader loader = this.getClass().getClassLoader();
+
+ Path classpath = new Path(project);
+ if (loader instanceof AntClassLoader) {
+ classpath = new Path(project, ((AntClassLoader)loader).getClasspath());
+ }
+ cmd.createClasspath(getProject()).append(classpath);
+ cmd.setClassname("org.jboss.com.sun.tools.ws.WsImport");
+ //setupWsimportArgs();
+ //cmd.createArgument(true).setLine(forkCmd.toString());
+ }
+
+ private void setupWsimportArgs() {
+ // d option
+ if (null != getDestdir() && !getDestdir().getName().equals(""))
{
+ cmd.createArgument().setValue("-d");
+ cmd.createArgument().setFile(getDestdir());
+ }
+
+ // extension flag
+ if (getExtension()) {
+ cmd.createArgument().setValue("-extension");
+ }
+
+ // g option
+ if (getDebug()) {
+ cmd.createArgument().setValue("-g");
+ }
+
+ // keep option
+ if (getKeep()) {
+ cmd.createArgument().setValue("-keep");
+ }
+
+ // optimize option
+ if (getOptimize()) {
+ cmd.createArgument().setValue("-O");
+ }
+
+ // s option
+ if (null != getSourcedestdir() &&
!getSourcedestdir().getName().equals("")) {
+ cmd.createArgument().setValue("-s");
+ cmd.createArgument().setFile(getSourcedestdir());
+ }
+
+ //catalog
+ if((getCatalog() != null) && (getCatalog().getName().length() > 0)){
+ cmd.createArgument().setValue("-catalog");
+ cmd.createArgument().setFile(getCatalog());
+ }
+
+ // verbose option
+ if (getVerbose()) {
+ cmd.createArgument().setValue("-verbose");
+ }
+
+ //wsdl
+ if(getWsdl() != null){
+ cmd.createArgument().setValue(getWsdl());
+ }
+
+ //package
+ if((getPackage() != null) && (getPackage().length() > 0)){
+ cmd.createArgument().setValue("-p");
+ cmd.createArgument().setValue(getPackage());
+ }
+
+ if(getBinding() != null){
+ cmd.createArgument().setValue("-b");
+ cmd.createArgument().setFile(new File (getBinding()));
+ }
+
+ if((wsdlLocation != null) && (wsdlLocation.length() != 0)){
+ cmd.createArgument().setValue("-wsdllocation");
+ cmd.createArgument().setValue(wsdlLocation);
+ }
+
+ if(!bindingFiles.isEmpty()){
+ for(File binding : bindingFiles){
+ cmd.createArgument().setValue("-b");
+ cmd.createArgument().setFile(binding);
+ }
+ }
+ }
+
+
+ /** Called by the project to let the task do it's work **/
+ public void execute() throws BuildException {
+ /* Create an instance of the rmic, redirecting output to
+ * the project log
+ */
+ LogOutputStream logstr = null;
+ boolean ok = false;
+ try {
+ if(fork){
+ setupWsimportForkCommand();
+ } else {
+ if (cmd.getVmCommand().size() > 1) {
+ log("JVM args ignored when same JVM is
used.",Project.MSG_WARN);
+ }
+ }
+ setupWsimportArgs();
+ if (fork) {
+ if (verbose) {
+ log("command line: "+"wsimport
"+cmd.toString());
+ }
+ int status = run(cmd.getCommandline());
+ ok = (status == 0) ? true : false;
+ } else {
+ if (verbose) {
+ log("command line: "+"wsimport
"+cmd.getJavaCommand().toString());
+ }
+ logstr = new LogOutputStream(this, Project.MSG_WARN);
+
+ ClassLoader old = Thread.currentThread().getContextClassLoader();
+ ClassLoader loader = this.getClass().getClassLoader();
+ Thread.currentThread().setContextClassLoader(loader);
+ String sysPath = System.getProperty("java.class.path");
+ try {
+ CompileTool compTool = new CompileTool(logstr,
"wsimport");
+ if(xmlCatalog != null){
+ compTool.setEntityResolver(xmlCatalog);
+ }
+ if (loader instanceof AntClassLoader) {
+ System.setProperty("java.class.path",
((AntClassLoader)loader).getClasspath());
+ }
+ ok = compTool.run(cmd.getJavaCommand().getArguments());
+ } finally {
+ if (sysPath != null) {
+ System.setProperty("java.class.path", sysPath);
+ }
+ Thread.currentThread().setContextClassLoader(old);
+ }
+ }
+ if (!ok) {
+ if (!verbose) {
+ log("Command invoked: "+"wsimport
"+cmd.toString());
+ }
+ throw new BuildException("wsimport failed", location);
+ }
+ } catch (Exception ex) {
+ if (ex instanceof BuildException) {
+ throw (BuildException)ex;
+ } else {
+ throw new BuildException("Error starting wsimport: ", ex,
+ getLocation());
+ }
+ } finally {
+ try {
+ if (logstr != null) {
+ logstr.close();
+ }
+ } catch (IOException e) {
+ throw new BuildException(e);
+ }
+ }
+ }
+
+ /**
+ * Executes the given classname with the given arguments in a separate VM.
+ */
+ private int run(String[] command) throws BuildException {
+ FileOutputStream fos = null;
+ Execute exe = null;
+ LogStreamHandler logstr = new LogStreamHandler(this,
+ Project.MSG_INFO, Project.MSG_WARN);
+ exe = new Execute(logstr);
+ exe.setAntRun(project);
+ exe.setCommandline(command);
+ try {
+ int rc = exe.execute();
+ if (exe.killedProcess()) {
+ log("Timeout: killed the sub-process", Project.MSG_WARN);
+ }
+ return rc;
+ } catch (IOException e) {
+ throw new BuildException(e, location);
+ }
+ }
+
+ private Set<File> bindingFiles = new HashSet<File>();
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/ant/WsImport.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/package-info.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/package-info.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/package-info.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,135 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+/**
+ * <h1>JAX-WS 2.0 Tools</h1>
+ * This document describes the tools included with JAX-WS 2.0.
+ *
+ * {@DotDiagram
+ digraph G {
+ // external tools
+ APT;
+
+ // ANT tasks
+ node [style=filled,color=lightyellow];
+ "WsGen ANT Task"; "WsImport ANT Task"; "Apt ANT
Task";
+
+ // commandline
+ node [style=filled,color=lightpink];
+ wsgen; wsimport;
+
+ // libraries
+ node [style=filled,color=lightblue];
+ CompileTool; "WSAP"; WebServiceAP; Processor; Modeler; ProcessorActions;
+
+ // aps
+# node [style=filled,color=lightpink];
+# "JAX-WS"; tools; runtime; SPI; "Annotation Processor";
+
+ "Apt ANT Task" -> APT;
+ "WsGen ANT Task" -> wsgen -> CompileTool;
+ "WsImport ANT Task" -> wsimport -> CompileTool;
+
+ CompileTool -> APT -> WSAP -> WebServiceAP;
+ CompileTool -> Processor;
+ CompileTool -> Modeler;
+ CompileTool -> ProcessorActions;
+ CompileTool -> WebServiceAP;
+
+ Modeler -> WSDLModeler;
+ }
+ * }
+ * <div align=right>
+ * <b>Legend:</b> blue: implementation classes, pink: command-line toosl,
white: external tool, yellow: ANT tasks
+ * </div>
+ *
+ * <h2>ANT Tasks</h2>
+ <d1>
+ * <dt>{@link org.jboss.com.sun.tools.ws.ant.Apt Apt}
+ * <dd>An ANT task to invoke <a
href="http://java.sun.com/j2se/1.5.0/docs/tooldocs/share/apt.html&qu...;.
+
+ * <dt>{@link org.jboss.com.sun.tools.ws.ant.WsGen WsGen}
+ * <dd>
+ * An ANT task to invoke {@link org.jboss.com.sun.tools.ws.WsGen WsGen}
+
+ * <dt>{@link org.jboss.com.sun.tools.ws.ant.WsImport WsImport}
+ * <dd>
+ * An ANT task to invoke {@link org.jboss.com.sun.tools.ws.WsImport WsImport}
+ *
+ * </d1>
+ * <h2>Command-line Tools</h2>
+ <d1>
+ * <dt><a
href="http://java.sun.com/j2se/1.5.0/docs/tooldocs/share/apt.html&qu...
+ <dd>A Java SE tool and framework for processing annotations. APT will invoke a
JAX-WS AnnotationProcossor for
+ * processing Java source files with javax.jws.* annotations and making them web
services.
+ * APT will compile the Java source files and generate any additional classes needed to
make an javax.jws.WebService
+ * annotated class a Web service.
+ *
+ * <dt>{@link org.jboss.com.sun.tools.ws.WsGen WsGen}
+ * <dd>Tool to process a compiled javax.jws.WebService annotated class and to
generate the necessary classes to make
+ * it a Web service.
+
+ * <dt>{@link org.jboss.com.sun.tools.ws.ant.WsImport WsImport}
+ * <dd>
+ * Tool to import a WSDL and to generate an SEI (a javax.jws.WebService) interface
that can be either implemented
+ * on the server to build a web service, or can be used on the client to invoke the
web service.
+ * </d1>
+ * <h2>Implementation Classes</h2>
+ * <d1>
+ <dt>{@link org.jboss.com.sun.tools.ws.wscompile.CompileTool CompileTool}
+ * <dd> This is the main implementation class for both WsGen and WsImport.
+ *
+ *
+ * <dt>{@link org.jboss.com.sun.tools.ws.processor.Processor Processor}
+ * <dd>This abstract class is used to process a particular {@link
org.jboss.com.sun.tools.ws.processor.config.Configuration
+ * Configuration} to build a {@link org.jboss.com.sun.tools.ws.processor.model Model}
and to run
+ * {@link org.jboss.com.sun.tools.ws.processor.ProcessorAction ProcessorActions} on
that model.
+
+ * <dt>{@link org.jboss.com.sun.tools.ws.processor.model.Model Model}
+ * <dd>The model is used to represent the entire Web Service. The JAX-WS
ProcessorActions can process
+ * this Model to generate Java artifacts such as the service interface.
+ *
+ <dt>{@link org.jboss.com.sun.tools.ws.processor.ProcessorAction
ProcessorActions}
+ * <dd>A ProcessorAction is used to perform some operation on a Model object
such as
+ * generating a Java source file.
+ *
+ * <dt>{@link org.jboss.com.sun.tools.ws.processor.modeler.Modeler Modeler}
+ * <dd>A Modeler is used to create a Model of a Web Service from a particular
Web
+ * Web Service description such as a WSDL
+ * file.
+ *
+ * <dt>{@link org.jboss.com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler
WSDLModeler}
+ * <dd>The WSDLModeler processes a WSDL to create a Model.
+ *
+ * <dt>{@link
org.jboss.com.sun.tools.ws.processor.modeler.annotation.WebServiceAP WebServiceAP}
+ * <dd>WebServiceAP is a APT AnnotationProcessor for processing javax.jws.* and
+ * javax.xml.ws.* annotations. This class is used either by the WsGen (CompileTool)
tool or
+ * idirectly via the {@link org.jboss.com.sun.istack.ws.WSAP WSAP} when invoked by
APT.
+ *
+ * <dt>{@link org.jboss.com.sun.istack.ws.WSAP WSAP}
+ * <dd>This is the entry point for the WebServiceAP when APT is invoked on a
SEI
+ * annotated with the javax.jws.WebService annotation.
+ * </d1>
+ *
+ * @ArchitectureDocument
+ **/
+package org.jboss.com.sun.tools.ws;
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/package-info.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/Processor.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/Processor.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/Processor.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,116 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor;
+
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import org.jboss.com.sun.tools.ws.processor.config.Configuration;
+import org.jboss.com.sun.tools.ws.processor.config.ModelInfo;
+import org.jboss.com.sun.tools.ws.processor.model.Model;
+import org.jboss.com.sun.tools.ws.processor.util.ProcessorEnvironment;
+import org.jboss.com.sun.xml.ws.util.exception.JAXWSExceptionBase;
+
+/**
+ * This abstract class contains methods for getting a Modeler and creating a model
+ * from that Modeler given a particular configuration. ProcessorActions can also
+ * be registered and run with instances of this class.
+ *
+ * @author WS Development Team
+ *
+ */
+public class Processor {
+
+ public Processor(Configuration configuration, Properties options, Model model) {
+ this(configuration,options);
+ _model = model;
+ }
+
+ public Processor(Configuration configuration, Properties options) {
+ _configuration = configuration;
+ _options = options;
+
+ // find the value of the "print stack traces" property
+ _printStackTrace =
Boolean.valueOf(_options.getProperty(ProcessorOptions.PRINT_STACK_TRACE_PROPERTY));
+ _env = _configuration.getEnvironment();
+ }
+
+ public void add(ProcessorAction action) {
+ _actions.add(action);
+ }
+
+ public Model getModel() {
+ return _model;
+ }
+
+ public void run() {
+ runModeler();
+ if (_model != null) {
+ runActions();
+ }
+ }
+
+ public void runModeler() {
+ try {
+ ModelInfo modelInfo = _configuration.getModelInfo();
+ if (modelInfo == null) {
+ throw new ProcessorException("processor.missing.model");
+ }
+
+ _model = modelInfo.buildModel(_options);
+
+ } catch (JAXWSExceptionBase e) {
+ if (_printStackTrace) {
+ _env.printStackTrace(e);
+ }
+ _env.error(e);
+ }
+ }
+
+ public void runActions() {
+ try {
+ if (_model == null) {
+ // avoid reporting yet another error here
+ return;
+ }
+
+ for (ProcessorAction action : _actions) {
+ action.perform(_model, _configuration, _options);
+ }
+ } catch (JAXWSExceptionBase e) {
+ if (_printStackTrace || _env.verbose()) {
+ _env.printStackTrace(e);
+ }
+ _env.error(e);
+ }
+ }
+
+ private final Properties _options;
+ private final Configuration _configuration;
+ private final List<ProcessorAction> _actions = new
ArrayList<ProcessorAction>();
+ private Model _model;
+ private final boolean _printStackTrace;
+ private final ProcessorEnvironment _env;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/Processor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/ProcessorAction.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/ProcessorAction.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/ProcessorAction.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,40 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor;
+
+import java.util.Properties;
+
+import org.jboss.com.sun.tools.ws.processor.config.Configuration;
+import org.jboss.com.sun.tools.ws.processor.model.Model;
+
+
+/**
+ * A ProcessorAction is used to perform some operation on a
+ * {@link org.jboss.com.sun.tools.ws.processor.model.Model Model} such as
+ * generating a Java source file.
+ *
+ * @author WS Development Team
+ */
+public interface ProcessorAction {
+ public void perform(Model model, Configuration config, Properties options);
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/ProcessorAction.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/ProcessorActionVersion.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/ProcessorActionVersion.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/ProcessorActionVersion.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,41 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor;
+
+/**
+ * @author WS Development Team
+ *
+ * Typesafe enum class to hold the ProcessorActionVersion
+ */
+public enum ProcessorActionVersion {
+ PRE_20("1.1.2"), VERSION_20("2.0");
+
+ ProcessorActionVersion(String version) {
+ this.version = version;
+ }
+
+ public String value() {
+ return version;
+ }
+
+ private final String version;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/ProcessorActionVersion.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/ProcessorConstants.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/ProcessorConstants.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/ProcessorConstants.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,33 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor;
+
+/**
+ * Constants used by Model, Modelers, Config ProcessorActions
+ *
+ * @author WS Development Team
+ */
+public class ProcessorConstants {
+ public final static String SOAP_VERSION_1_1 = "SOAP 1.1";
+ public final static String SOAP_VERSION_1_2 = "SOAP 1.2";
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/ProcessorConstants.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/ProcessorException.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/ProcessorException.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/ProcessorException.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,49 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor;
+
+import org.jboss.com.sun.xml.ws.util.exception.JAXWSExceptionBase;
+import org.jboss.com.sun.xml.ws.util.localization.Localizable;
+
+/**
+ * ProcessorException represents an exception that occurred while processing
+ * a web service.
+ *
+ * @see JAXWSExceptionBase
+ *
+ * @author WS Development Team
+ */
+public class ProcessorException extends JAXWSExceptionBase {
+
+ public ProcessorException(String key, Object... args) {
+ super(key, args);
+ }
+
+ public ProcessorException(Throwable throwable) {
+ super(throwable);
+ }
+
+ public String getResourceBundleName() {
+ return "org.jboss.com.sun.tools.ws.resources.processor";
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/ProcessorException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/ProcessorNotificationListener.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/ProcessorNotificationListener.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/ProcessorNotificationListener.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,37 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor;
+
+import org.jboss.com.sun.xml.ws.util.localization.Localizable;
+
+/**
+ * A ProcessorNotificationListener is registered with a Processor and receives
+ * notifications of errors, warnings and informational messages.
+ *
+ * @author WS Development Team
+ */
+public interface ProcessorNotificationListener {
+ public void onError(Localizable msg);
+ public void onWarning(Localizable msg);
+ public void onInfo(Localizable msg);
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/ProcessorNotificationListener.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/ProcessorOptions.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/ProcessorOptions.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/ProcessorOptions.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,54 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor;
+
+/**
+ * Property names used by ProcessorActions
+ *
+ * @author WS Development Team
+ */
+public class ProcessorOptions {
+
+ public final static String SOURCE_DIRECTORY_PROPERTY = "sourceDirectory";
+ public final static String DESTINATION_DIRECTORY_PROPERTY =
+ "destinationDirectory";
+ public final static String NONCLASS_DESTINATION_DIRECTORY_PROPERTY =
+ "nonclassDestinationDirectory";
+ public final static String VALIDATE_WSDL_PROPERTY = "validationWSDL";
+ public final static String EXPLICIT_SERVICE_CONTEXT_PROPERTY =
+ "explicitServiceContext";
+ public final static String PRINT_STACK_TRACE_PROPERTY = "printStackTrace";
+ public final static String DONOT_OVERWRITE_CLASSES = "doNotOverWrite";
+ public final static String NO_DATA_BINDING_PROPERTY = "noDataBinding";
+ public final static String USE_WSI_BASIC_PROFILE = "useWSIBasicProfile";
+ public final static String STRICT_COMPLIANCE = "strictCompliance";
+ public final static String JAXWS_SOURCE_VERSION = "sourceVersion";
+ public final static String UNWRAP_DOC_LITERAL_WRAPPERS =
+ "unwrapDocLitWrappers";
+ public final static String BINDING_FILES = "bindingFiles";
+ public final static String EXTENSION = "extension";
+ public final static String PROTOCOL = "protocol";
+ public final static String TRANSPORT = "transport";
+ public final static String WSDL_LOCATION = "wsdllocation";
+ public final static String DEFAULT_PACKAGE = "defaultpackage";
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/ProcessorOptions.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/ClassModelInfo.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/ClassModelInfo.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/ClassModelInfo.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,59 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.config;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+
+import org.jboss.com.sun.tools.ws.processor.ProcessorOptions;
+import org.jboss.com.sun.tools.ws.processor.modeler.Modeler;
+import org.jboss.com.sun.xml.ws.util.VersionUtil;
+
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class ClassModelInfo extends ModelInfo {
+
+ public ClassModelInfo(String className) {
+ this.className = className;
+ }
+
+
+ public Modeler getModeler(Properties properties) {
+ return null;
+ }
+
+ public void setClassName(String className) {
+ this.className = className;
+ }
+
+ public String getClassName() {
+ return className;
+ }
+
+ private String className;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/ClassModelInfo.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/Configuration.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/Configuration.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/Configuration.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,52 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.config;
+
+import org.jboss.com.sun.tools.ws.processor.util.ProcessorEnvironment;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class Configuration {
+
+ public Configuration(ProcessorEnvironment env) {
+ _env = (ProcessorEnvironment)env;
+ }
+
+ public ModelInfo getModelInfo() {
+ return _modelInfo;
+ }
+
+ public void setModelInfo(ModelInfo i) {
+ _modelInfo = (ModelInfo)i;
+ _modelInfo.setParent(this);
+ }
+
+ public ProcessorEnvironment getEnvironment() {
+ return _env;
+ }
+
+ private ProcessorEnvironment _env;
+ private ModelInfo _modelInfo;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/Configuration.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/ConfigurationException.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/ConfigurationException.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/ConfigurationException.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,47 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.config;
+
+import org.jboss.com.sun.tools.ws.processor.ProcessorException;
+import org.jboss.com.sun.xml.ws.util.localization.Localizable;
+
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class ConfigurationException extends ProcessorException {
+
+ public ConfigurationException(String key, Object... args) {
+ super(key, args);
+ }
+
+ public ConfigurationException(Throwable throwable) {
+ super(throwable);
+ }
+
+ public String getResourceBundleName() {
+ return "org.jboss.com.sun.tools.ws.resources.configuration";
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/ConfigurationException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/HandlerChainInfo.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/HandlerChainInfo.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/HandlerChainInfo.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,79 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.config;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class HandlerChainInfo {
+
+ public HandlerChainInfo() {
+ handlers = new ArrayList();
+ roles = new HashSet();
+ }
+
+ public void add(HandlerInfo i) {
+ handlers.add(i);
+ }
+
+ public Iterator getHandlers() {
+ return handlers.iterator();
+ }
+
+ public int getHandlersCount() {
+ return handlers.size();
+ }
+
+ /* serialization */
+ public List getHandlersList() {
+ return handlers;
+ }
+
+ /* serialization */
+ public void setHandlersList(List l) {
+ handlers = l;
+ }
+
+ public void addRole(String s) {
+ roles.add(s);
+ }
+
+ public Set getRoles() {
+ return roles;
+ }
+
+ /* serialization */
+ public void setRoles(Set s) {
+ roles = s;
+ }
+
+ private List handlers;
+ private Set roles;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/HandlerChainInfo.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/HandlerInfo.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/HandlerInfo.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/HandlerInfo.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,75 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.config;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import javax.xml.namespace.QName;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class HandlerInfo {
+
+ public HandlerInfo() {
+ properties = new HashMap();
+ headerNames = new HashSet();
+ }
+
+ public String getHandlerClassName() {
+ return handlerClassName;
+ }
+
+ public void setHandlerClassName(String s) {
+ handlerClassName = s;
+ }
+
+ public Map getProperties() {
+ return properties;
+ }
+
+ /* serialization */
+ public void setProperties(Map m) {
+ properties = m;
+ }
+
+ public void addHeaderName(QName name) {
+ headerNames.add(name);
+ }
+
+ public Set getHeaderNames() {
+ return headerNames;
+ }
+
+ /* serialization */
+ public void setHeaderNames(Set s) {
+ headerNames = s;
+ }
+
+ private String handlerClassName;
+ private Map properties;
+ private Set headerNames;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/HandlerInfo.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/ModelInfo.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/ModelInfo.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/ModelInfo.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,116 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.config;
+
+import java.util.Properties;
+
+
+import org.jboss.com.sun.tools.ws.processor.model.Model;
+import org.jboss.com.sun.tools.ws.processor.modeler.Modeler;
+import org.jboss.com.sun.xml.ws.util.xml.XmlUtil;
+import org.xml.sax.EntityResolver;
+
+/**
+ * This class contiains information used by {@link
org.jboss.com.sun.tools.ws.processor.modeler.Modeler
+ * Modelers} to build {@link org.jboss.com.sun.tools.ws.processor.model.Model Models}.
+ *
+ * @author WS Development Team
+ */
+public abstract class ModelInfo {
+
+ protected ModelInfo() {}
+
+ public Configuration getParent() {
+ return _parent;
+ }
+
+ public void setParent(Configuration c) {
+ _parent = c;
+ }
+
+ public String getName() {
+ return _name;
+ }
+
+ public void setName(String s) {
+ _name = s;
+ }
+
+ public Configuration getConfiguration() {
+ return _parent;
+ }
+
+ public HandlerChainInfo getClientHandlerChainInfo() {
+ return _clientHandlerChainInfo;
+ }
+
+ public void setClientHandlerChainInfo(HandlerChainInfo i) {
+ _clientHandlerChainInfo = i;
+ }
+
+ public HandlerChainInfo getServerHandlerChainInfo() {
+ return _serverHandlerChainInfo;
+ }
+
+ public void setServerHandlerChainInfo(HandlerChainInfo i) {
+ _serverHandlerChainInfo = i;
+ }
+
+ public String getJavaPackageName() {
+ return _javaPackageName;
+ }
+
+ public void setJavaPackageName(String s) {
+ _javaPackageName = s;
+ }
+
+ public Model buildModel(Properties options){
+ return getModeler(options).buildModel();
+ }
+
+ public EntityResolver getEntityResolver() {
+ return entityResolver;
+ }
+
+ public void setEntityResolver(EntityResolver entityResolver) {
+ this.entityResolver = entityResolver;
+ }
+
+ public String getDefaultJavaPackage() {
+ return _defaultJavaPackage;
+ }
+
+ public void setDefaultJavaPackage(String _defaultJavaPackage) {
+ this._defaultJavaPackage = _defaultJavaPackage;
+ }
+
+ protected abstract Modeler getModeler(Properties options);
+
+ private Configuration _parent;
+ private String _name;
+ private String _javaPackageName;
+ private String _defaultJavaPackage;
+ private HandlerChainInfo _clientHandlerChainInfo;
+ private HandlerChainInfo _serverHandlerChainInfo;
+ private EntityResolver entityResolver;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/ModelInfo.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/WSDLModelInfo.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/WSDLModelInfo.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/WSDLModelInfo.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,89 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.config;
+
+
+import java.util.*;
+
+import org.jboss.com.sun.tools.ws.processor.modeler.Modeler;
+import org.jboss.com.sun.tools.ws.util.JAXWSClassFactory;
+import org.w3c.dom.Element;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class WSDLModelInfo extends ModelInfo {
+
+ public WSDLModelInfo() {}
+
+ protected Modeler getModeler(Properties options) {
+ return JAXWSClassFactory.newInstance().createWSDLModeler(this, options);
+ }
+
+ public String getLocation() {
+ return _location;
+ }
+
+ public void setLocation(String s) {
+ _location = s;
+ }
+
+ public Map<String, Document> getJAXWSBindings(){
+ return _jaxwsBindings;
+ }
+
+ public void putJAXWSBindings(String systemId, Document binding){
+ _jaxwsBindings.put(systemId, binding);
+ }
+
+ public Set<InputSource> getJAXBBindings(){
+ return _jaxbBindings;
+ }
+
+ public void addJAXBBIndings(InputSource jaxbBinding){
+ _jaxbBindings.add(jaxbBinding);
+ }
+
+ public void setHandlerConfig(Element handlerConfig){
+ this.handlerConfig = handlerConfig;
+ }
+
+ public Element getHandlerConfig(){
+ return handlerConfig;
+ }
+
+ private Element handlerConfig;
+
+ private String _location;
+
+ //external jaxws:bindings elements
+ private Map<String, Document> _jaxwsBindings = new HashMap<String,
Document>();
+
+ //we need an array of jaxb:binding elements, they are children of jaxws:bindings
+ //and could come from an external customization file or wsdl.
+ private Set<InputSource> _jaxbBindings = new HashSet<InputSource>();
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/WSDLModelInfo.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/parser/ClassModelParser.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/parser/ClassModelParser.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/parser/ClassModelParser.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,56 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.config.parser;
+
+
+import java.io.File;
+import java.util.List;
+import java.util.Properties;
+
+import org.jboss.com.sun.tools.ws.processor.config.ClassModelInfo;
+import org.jboss.com.sun.tools.ws.processor.config.Configuration;
+import org.jboss.com.sun.tools.ws.processor.util.ProcessorEnvironment;
+
+
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class ClassModelParser extends InputParser {
+
+ public ClassModelParser(ProcessorEnvironment env, Properties options) {
+ super(env, options);
+ }
+
+ public Configuration parse(List<String> inputClasses) {
+ return parse(new File(inputClasses.get(0)));
+ }
+
+ public Configuration parse(File file) {
+ Configuration config = new Configuration(getEnv());
+
+ config.setModelInfo(new ClassModelInfo(file.getName()));
+ return config;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/parser/ClassModelParser.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/parser/CustomizationParser.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/parser/CustomizationParser.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/parser/CustomizationParser.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,142 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.config.parser;
+
+import java.net.URL;
+import java.util.*;
+
+import org.jboss.com.sun.tools.ws.processor.ProcessorOptions;
+import org.jboss.com.sun.tools.ws.processor.config.Configuration;
+import org.jboss.com.sun.tools.ws.processor.config.WSDLModelInfo;
+import org.jboss.com.sun.tools.ws.processor.util.ProcessorEnvironment;
+import org.jboss.com.sun.tools.ws.wsdl.document.jaxws.JAXWSBindingsConstants;
+import org.jboss.com.sun.xml.ws.streaming.XMLStreamReaderFactory;
+import org.jboss.com.sun.xml.ws.streaming.XMLStreamReaderUtil;
+import org.jboss.com.sun.xml.ws.util.JAXWSUtils;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+import org.xml.sax.EntityResolver;
+
+
+import javax.xml.stream.XMLStreamReader;
+
+/**
+ * @author Vivek Pandey
+ *
+ */
+public class CustomizationParser extends InputParser {
+
+ /**
+ * @param entityResolver
+ * @param env
+ * @param options
+ */
+ public CustomizationParser(EntityResolver entityResolver, ProcessorEnvironment env,
Properties options) {
+ super(env, options);
+ this.entityResolver = entityResolver;
+ }
+
+
+ /* (non-Javadoc)
+ * @see
org.jboss.com.sun.xml.ws.processor.config.parser.InputParser#parse(java.io.File[],
java.lang.String)
+ */
+ protected Configuration parse(List<String> inputFiles) throws Exception{
+ //File wsdlFile = inputFiles[0];
+ Configuration configuration = new Configuration(getEnv());
+ wsdlModelInfo = new WSDLModelInfo();
+ wsdlModelInfo.setLocation(inputFiles.get(0));
+ if(_options.get(ProcessorOptions.WSDL_LOCATION) == null)
+ _options.setProperty(ProcessorOptions.WSDL_LOCATION, inputFiles.get(0));
+
+ //modelInfoParser =
(JAXWSBindingInfoParser)getModelInfoParsers().get(JAXWSBindingsConstants.JAXWS_BINDINGS);
+ modelInfoParser = new JAXWSBindingInfoParser(getEnv());
+
+ //get the jaxws bindingd file and add it to the modelInfo
+ Set<String> bindingFiles =
(Set<String>)_options.get(ProcessorOptions.BINDING_FILES);
+ for(String bindingFile : bindingFiles){
+ addBinding(bindingFile);
+ }
+
+
+ for(InputSource jaxwsBinding : jaxwsBindings){
+ Document doc = modelInfoParser.parse(jaxwsBinding);
+ if(doc != null){
+ wsdlModelInfo.putJAXWSBindings(jaxwsBinding.getSystemId(), doc);
+ }
+ }
+
+ //copy jaxb binding sources in modelInfo
+ for(InputSource jaxbBinding : jaxbBindings){
+ wsdlModelInfo.addJAXBBIndings(jaxbBinding);
+ }
+
+ addHandlerChainInfo();
+ configuration.setModelInfo(wsdlModelInfo);
+ return configuration;
+ }
+
+ private void addBinding(String bindingLocation) throws Exception{
+ JAXWSUtils.checkAbsoluteness(bindingLocation);
+ InputSource is = null;
+ if(entityResolver != null){
+ is = entityResolver.resolveEntity(null, bindingLocation);
+ }
+ if(is == null)
+ is = new InputSource(bindingLocation);
+
+ XMLStreamReader reader =
+ XMLStreamReaderFactory.createFreshXMLStreamReader(is, true);
+ XMLStreamReaderUtil.nextElementContent(reader);
+ if(reader.getName().equals(JAXWSBindingsConstants.JAXWS_BINDINGS)){
+ jaxwsBindings.add(is);
+ }else if(reader.getName().equals(JAXWSBindingsConstants.JAXB_BINDINGS)){
+ jaxbBindings.add(is);
+ }else{
+ warn("configuration.notBindingFile");
+ }
+ reader.close();
+ }
+
+ private void addHandlerChainInfo() throws Exception{
+ //setup handler chain info
+ for(Map.Entry<String, Document>
entry:wsdlModelInfo.getJAXWSBindings().entrySet()){
+ Element e = entry.getValue().getDocumentElement();
+ NodeList nl = e.getElementsByTagNameNS(
+ "http://java.sun.com/xml/ns/javaee",
"handler-chains");
+ if(nl.getLength()== 0)
+ continue;
+ //take the first one, anyway its 1 handler-config per customization
+ Element hc = (Element)nl.item(0);
+ wsdlModelInfo.setHandlerConfig(hc);
+ return;
+ }
+ }
+
+ private WSDLModelInfo wsdlModelInfo;
+ private JAXWSBindingInfoParser modelInfoParser;
+ private Set<InputSource> jaxwsBindings = new HashSet<InputSource>();
+ private Set<InputSource> jaxbBindings = new HashSet<InputSource>();
+ private EntityResolver entityResolver;
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/parser/CustomizationParser.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/parser/InputParser.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/parser/InputParser.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/parser/InputParser.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,119 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.config.parser;
+
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.processor.config.Configuration;
+import org.jboss.com.sun.tools.ws.processor.util.ProcessorEnvironment;
+import org.jboss.com.sun.xml.ws.util.localization.LocalizableMessageFactory;
+import org.xml.sax.InputSource;
+
+
+/**
+ * @author Vivek Pandey
+ *
+ *
+ */
+public abstract class InputParser{
+ protected LocalizableMessageFactory _messageFactory =
+ new LocalizableMessageFactory(
+ "org.jboss.com.sun.tools.ws.resources.configuration");
+
+ public InputParser(ProcessorEnvironment env, Properties options) {
+ this._env = env;
+ this._options = options;
+ _modelInfoParsers = new HashMap<QName, Object>();
+
+// /*
+// * Load modelinfo parsers from the plugins which want to extend
+// * this functionality
+// */
+// Iterator i = ToolPluginFactory.getInstance().getExtensions(
+// ToolPluginConstants.WSCOMPILE_PLUGIN,
+// ToolPluginConstants.WSCOMPILE_MODEL_INFO_EXT_POINT);
+// while(i != null && i.hasNext()) {
+// ModelInfoPlugin plugin = (ModelInfoPlugin)i.next();
+// _modelInfoParsers.put(plugin.getModelInfoName(),
+// plugin.createModelInfoParser(env));
+// }
+ }
+
+ protected Configuration parse(InputStream is) throws Exception{
+ //TODO: Not implemented exception
+ return null;
+ }
+
+ protected Configuration parse(InputSource is) throws Exception{
+ //TODO: Not implemented exception
+ return null;
+ }
+
+ protected Configuration parse(List<String> inputSources) throws Exception{
+ //TODO: Not implemented exception
+ return null;
+ }
+
+ /**
+ * @return Returns the _env.
+ */
+ public ProcessorEnvironment getEnv(){
+ return _env;
+ }
+
+ /**
+ * @param env The ProcessorEnvironment to set.
+ */
+ public void setEnv(ProcessorEnvironment env){
+ this._env = env;
+ }
+
+ protected void warn(String key) {
+ _env.warn(_messageFactory.getMessage(key));
+ }
+
+ protected void warn(String key, String arg) {
+ _env.warn(_messageFactory.getMessage(key, arg));
+ }
+
+ protected void warn(String key, Object[] args) {
+ _env.warn(_messageFactory.getMessage(key, args));
+ }
+
+ protected void info(String key) {
+ _env.info(_messageFactory.getMessage(key));
+ }
+
+ protected void info(String key, String arg) {
+ _env.info(_messageFactory.getMessage(key, arg));
+ }
+
+ protected ProcessorEnvironment _env;
+ protected Properties _options;
+ protected Map<QName, Object> _modelInfoParsers;
+}
\ No newline at end of file
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/parser/InputParser.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/parser/JAXWSBindingInfoParser.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/parser/JAXWSBindingInfoParser.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/parser/JAXWSBindingInfoParser.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,97 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.config.parser;
+
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.FactoryConfigurationError;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.jboss.com.sun.tools.ws.processor.util.ProcessorEnvironment;
+import org.jboss.com.sun.tools.ws.util.xml.NullEntityResolver;
+import org.jboss.com.sun.tools.ws.wsdl.framework.ParseException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+
+/**
+ * @author Vivek Pandey
+ *
+ * External jaxws:bindings parser
+ */
+public class JAXWSBindingInfoParser {
+
+ private ProcessorEnvironment env;
+
+ /**
+ * @param env
+ */
+ public JAXWSBindingInfoParser(ProcessorEnvironment env) {
+ this.env = env;
+ }
+
+ public Document parse(InputSource source) {
+ try {
+ DocumentBuilderFactory builderFactory =
DocumentBuilderFactory.newInstance();
+ builderFactory.setNamespaceAware(true);
+ builderFactory.setValidating(false);
+ DocumentBuilder builder = builderFactory.newDocumentBuilder();
+ builder.setErrorHandler(new ErrorHandler() {
+ public void error(SAXParseException e)
+ throws SAXParseException {
+ throw e;
+ }
+
+ public void fatalError(SAXParseException e)
+ throws SAXParseException {
+ throw e;
+ }
+
+ public void warning(SAXParseException err)
+ throws SAXParseException {
+ // do nothing
+ }
+ });
+
+ builder.setEntityResolver(new NullEntityResolver());
+ return builder.parse(source);
+ } catch (ParserConfigurationException e) {
+ throw new ParseException("parsing.parserConfigException",e);
+ } catch (FactoryConfigurationError e) {
+ throw new ParseException("parsing.factoryConfigException",e);
+ }catch(SAXException e){
+ throw new ParseException("parsing.saxException",e);
+ }catch(IOException e){
+ throw new ParseException("parsing.saxException",e);
+ }
+ }
+
+ public final Set<Element> outerBindings = new HashSet<Element>();
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/parser/JAXWSBindingInfoParser.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/parser/ParserUtil.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/parser/ParserUtil.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/parser/ParserUtil.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,48 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.config.parser;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+
+import org.jboss.com.sun.tools.ws.processor.config.ConfigurationException;
+import org.jboss.com.sun.xml.ws.streaming.Attributes;
+import org.jboss.com.sun.xml.ws.streaming.XMLReader;
+import org.jboss.com.sun.xml.ws.util.xml.XmlUtil;
+
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class ParserUtil {
+ public static void failWithFullName(String key, String file, XMLReader reader) {
+ throw new ConfigurationException(key, new Object[] { file, Integer.toString(
+ reader.getLineNumber()), reader.getName().toString() });
+ }
+
+ public static void failWithFullName(String key, String file, XMLStreamReader reader)
{
+ throw new ConfigurationException(key, new Object[] { file, Integer.toString(
+ reader.getLocation().getLineNumber()), reader.getName().toString() });
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/parser/ParserUtil.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/parser/Reader.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/parser/Reader.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/parser/Reader.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,107 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.config.parser;
+
+
+import java.net.URL;
+import java.util.List;
+import java.util.Properties;
+
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.jboss.com.sun.tools.ws.processor.config.Configuration;
+import org.jboss.com.sun.tools.ws.processor.util.ProcessorEnvironment;
+import org.jboss.com.sun.tools.ws.wsdl.document.WSDLConstants;
+import org.jboss.com.sun.xml.ws.streaming.XMLStreamReaderFactory;
+import org.jboss.com.sun.xml.ws.streaming.XMLStreamReaderUtil;
+import org.jboss.com.sun.xml.ws.util.JAXWSUtils;
+import org.xml.sax.EntityResolver;
+
+/**
+ * @author Vivek Pandey
+ *
+ * Main entry point from CompileTool
+ */
+public class Reader {
+
+ /**
+ *
+ */
+ public Reader(ProcessorEnvironment env, Properties options) {
+ this._env = env;
+ this._options = options;
+ }
+
+ public Configuration parse(EntityResolver entityResolver, List<String>
inputSources)
+ throws Exception {
+ //reset the input type flags before parsing
+ isClassFile = false;
+
+ InputParser parser = null;
+ //now its just the first file. do we expect more than one input files?
+ validateInput(inputSources.get(0));
+
+ if(isClassFile){
+ parser = new ClassModelParser(_env, _options);
+ } else {
+ parser = new CustomizationParser(entityResolver, _env, _options);
+ }
+ return parser.parse(inputSources);
+ }
+
+ protected void validateInput(String file) throws Exception{
+ if(isClass(file)){
+ isClassFile = true;
+ return;
+ }
+
+// JAXWSUtils.checkAbsoluteness(file);
+// URL url = new URL(file);
+//
+// XMLStreamReader reader =
+// XMLStreamReaderFactory.createXMLStreamReader(url.openStream(), true);
+//
+// XMLStreamReaderUtil.nextElementContent(reader);
+// if(!reader.getName().equals(WSDLConstants.QNAME_DEFINITIONS)){
+// //we are here, means invalid element
+// ParserUtil.failWithFullName("configuration.invalidElement", file,
reader);
+// }
+ }
+
+ public boolean isClass(String className) {
+ try {
+ _env.getClassLoader().loadClass(className);
+ } catch (ClassNotFoundException e) {
+ return false;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return true;
+ }
+
+ private boolean isClassFile;
+
+ protected ProcessorEnvironment _env;
+
+ protected Properties _options;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/config/parser/Reader.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/CustomExceptionGenerator.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/CustomExceptionGenerator.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/CustomExceptionGenerator.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,164 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.generator;
+
+import com.sun.codemodel.*;
+
+import javax.xml.ws.WebFault;
+
+import org.jboss.com.sun.tools.ws.processor.config.Configuration;
+import org.jboss.com.sun.tools.ws.processor.model.Fault;
+import org.jboss.com.sun.tools.ws.processor.model.Model;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPVersion;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class CustomExceptionGenerator extends GeneratorBase {
+ private Map<String, JClass> faults = new HashMap<String, JClass>();
+
+ public CustomExceptionGenerator() {
+ }
+
+ public GeneratorBase getGenerator(
+ Model model,
+ Configuration config,
+ Properties properties) {
+ return new CustomExceptionGenerator(model, config, properties);
+ }
+
+ public GeneratorBase getGenerator(
+ Model model,
+ Configuration config,
+ Properties properties,
+ SOAPVersion ver) {
+ return new CustomExceptionGenerator(model, config, properties);
+ }
+
+ protected CustomExceptionGenerator(
+ Model model,
+ Configuration config,
+ Properties properties) {
+ super(model, config, properties);
+ }
+
+ protected void preVisitModel(Model model) throws Exception {
+ }
+
+ protected void postVisitModel(Model model) throws Exception {
+ faults = null;
+ }
+
+ protected void preVisitFault(Fault fault) throws Exception {
+ if (isRegistered(fault))
+ return;
+ registerFault(fault);
+ }
+
+ private boolean isRegistered(Fault fault) {
+ if(faults.keySet().contains(fault.getJavaException().getName())){
+ fault.setExceptionClass(faults.get(fault.getJavaException().getName()));
+ return true;
+ }
+ return false;
+ }
+
+ private void registerFault(Fault fault) {
+ try {
+ write(fault);
+ faults.put(fault.getJavaException().getName(), fault.getExceptionClass());
+ } catch (Exception e) {
+ throw new GeneratorException("generator.nestedGeneratorError",e);
+ }
+ }
+
+ private void write(Fault fault) throws Exception{
+ String className = env.getNames().customExceptionClassName(fault);
+
+ JDefinedClass cls = cm._class(className, ClassType.CLASS);
+ JDocComment comment = cls.javadoc();
+ if(fault.getJavaDoc() != null){
+ comment.add(fault.getJavaDoc());
+ comment.add("\n\n");
+ }
+
+ for (String doc : getJAXWSClassComment()) {
+ comment.add(doc);
+ }
+
+ cls._extends(java.lang.Exception.class);
+
+ //@WebFault
+ JAnnotationUse faultAnn = cls.annotate(WebFault.class);
+ faultAnn.param("name", fault.getBlock().getName().getLocalPart());
+ faultAnn.param("targetNamespace",
fault.getBlock().getName().getNamespaceURI());
+
+ JType faultBean = fault.getBlock().getType().getJavaType().getType().getType();
+
+ //faultInfo filed
+ JFieldVar fi = cls.field(JMod.PRIVATE, faultBean, "faultInfo");
+
+ //add jaxb annotations
+ fault.getBlock().getType().getJavaType().getType().annotate(fi);
+
+ fi.javadoc().add("Java type that goes as soapenv:Fault detail
element.");
+ JFieldRef fr = JExpr.ref(JExpr._this(), fi);
+
+ //Constructor
+ JMethod constrc1 = cls.constructor(JMod.PUBLIC);
+ JVar var1 = constrc1.param(String.class, "message");
+ JVar var2 = constrc1.param(faultBean, "faultInfo");
+ constrc1.javadoc().addParam(var1);
+ constrc1.javadoc().addParam(var2);
+ JBlock cb1 = constrc1.body();
+ cb1.invoke("super").arg(var1);
+
+ cb1.assign(fr, var2);
+
+ //constructor with Throwable
+ JMethod constrc2 = cls.constructor(JMod.PUBLIC);
+ var1 = constrc2.param(String.class, "message");
+ var2 = constrc2.param(faultBean, "faultInfo");
+ JVar var3 = constrc2.param(Throwable.class, "cause");
+ constrc2.javadoc().addParam(var1);
+ constrc2.javadoc().addParam(var2);
+ constrc2.javadoc().addParam(var3);
+ JBlock cb2 = constrc2.body();
+ cb2.invoke("super").arg(var1).arg(var3);
+ cb2.assign(fr, var2);
+
+
+ //getFaultInfo() method
+ JMethod fim = cls.method(JMod.PUBLIC, faultBean, "getFaultInfo");
+ fim.javadoc().addReturn().add("returns fault bean:
"+faultBean.fullName());
+ JBlock fib = fim.body();
+ fib._return(fi);
+ fault.setExceptionClass(cls);
+
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/CustomExceptionGenerator.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/GeneratorBase.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/GeneratorBase.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/GeneratorBase.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,641 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.generator;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.FileOutputStream;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+
+import com.sun.codemodel.*;
+
+import org.jboss.com.sun.tools.ws.ToolVersion;
+import org.jboss.com.sun.tools.ws.processor.ProcessorAction;
+import org.jboss.com.sun.tools.ws.processor.ProcessorOptions;
+import org.jboss.com.sun.tools.ws.processor.config.Configuration;
+import org.jboss.com.sun.tools.ws.processor.config.WSDLModelInfo;
+import org.jboss.com.sun.tools.ws.processor.model.AbstractType;
+import org.jboss.com.sun.tools.ws.processor.model.Block;
+import org.jboss.com.sun.tools.ws.processor.model.Fault;
+import org.jboss.com.sun.tools.ws.processor.model.Model;
+import org.jboss.com.sun.tools.ws.processor.model.ModelVisitor;
+import org.jboss.com.sun.tools.ws.processor.model.Operation;
+import org.jboss.com.sun.tools.ws.processor.model.Parameter;
+import org.jboss.com.sun.tools.ws.processor.model.Port;
+import org.jboss.com.sun.tools.ws.processor.model.Request;
+import org.jboss.com.sun.tools.ws.processor.model.Response;
+import org.jboss.com.sun.tools.ws.processor.model.Service;
+import org.jboss.com.sun.tools.ws.processor.model.jaxb.JAXBType;
+import org.jboss.com.sun.tools.ws.processor.model.jaxb.JAXBTypeVisitor;
+import org.jboss.com.sun.tools.ws.processor.model.jaxb.RpcLitStructure;
+import org.jboss.com.sun.tools.ws.processor.util.DirectoryUtil;
+import org.jboss.com.sun.tools.ws.processor.util.GeneratedFileInfo;
+import org.jboss.com.sun.tools.ws.processor.util.IndentingWriter;
+import org.jboss.com.sun.tools.ws.processor.util.ProcessorEnvironment;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPVersion;
+import org.jboss.com.sun.xml.ws.util.localization.Localizable;
+import org.jboss.com.sun.xml.ws.util.localization.LocalizableMessageFactory;
+import org.jboss.com.sun.xml.ws.util.xml.XmlUtil;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+import javax.jws.HandlerChain;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.dom.DOMSource;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public abstract class GeneratorBase
+ implements
+ GeneratorConstants,
+ ProcessorAction,
+ ModelVisitor,
+ JAXBTypeVisitor {
+ protected File sourceDir;
+ protected File destDir;
+ protected File nonclassDestDir;
+ protected ProcessorEnvironment env;
+ protected Model model;
+ protected Service service;
+ protected SOAPVersion curSOAPVersion;
+ protected String targetVersion;
+ protected boolean donotOverride;
+ protected String servicePackage;
+ protected JCodeModel cm;
+ protected boolean printStackTrace;
+ protected String wsdlLocation;
+
+ private LocalizableMessageFactory messageFactory;
+
+ public GeneratorBase() {
+ sourceDir = null;
+ destDir = null;
+ nonclassDestDir = null;
+ env = null;
+ model = null;
+ }
+
+ public void perform(
+ Model model,
+ Configuration config,
+ Properties properties) {
+ GeneratorBase generator = getGenerator(model, config, properties);
+
+ generator.doGeneration();
+ }
+
+ public abstract GeneratorBase getGenerator(
+ Model model,
+ Configuration config,
+ Properties properties);
+ public abstract GeneratorBase getGenerator(
+ Model model,
+ Configuration config,
+ Properties properties,
+ SOAPVersion ver);
+
+ protected GeneratorBase(
+ Model model,
+ Configuration config,
+ Properties properties) {
+
+ this.model = model;
+
+ if(model.getJAXBModel().getS2JJAXBModel() != null)
+ cm = model.getJAXBModel().getS2JJAXBModel().generateCode(null, new
JAXBTypeGenerator.JAXBErrorListener());
+ else
+ cm = new JCodeModel();
+
+ this.env = (ProcessorEnvironment) config.getEnvironment();
+ String key = ProcessorOptions.DESTINATION_DIRECTORY_PROPERTY;
+ String dirPath = properties.getProperty(key);
+ this.destDir = new File(dirPath);
+ key = ProcessorOptions.SOURCE_DIRECTORY_PROPERTY;
+ String sourcePath = properties.getProperty(key);
+ this.sourceDir = new File(sourcePath);
+ key = ProcessorOptions.NONCLASS_DESTINATION_DIRECTORY_PROPERTY;
+ String nonclassDestPath = properties.getProperty(key);
+ this.nonclassDestDir = new File(nonclassDestPath);
+ if (nonclassDestDir == null)
+ nonclassDestDir = destDir;
+ messageFactory =
+ new
LocalizableMessageFactory("org.jboss.com.sun.tools.ws.resources.generator");
+ this.targetVersion =
+ properties.getProperty(ProcessorOptions.JAXWS_SOURCE_VERSION);
+ key = ProcessorOptions.DONOT_OVERWRITE_CLASSES;
+ this.donotOverride =
+ Boolean.valueOf(properties.getProperty(key)).booleanValue();
+ this.printStackTrace =
Boolean.valueOf(properties.getProperty(ProcessorOptions.PRINT_STACK_TRACE_PROPERTY));
+ this.wsdlLocation = properties.getProperty(ProcessorOptions.WSDL_LOCATION);
+ }
+
+ protected void doGeneration() {
+ try {
+ model.accept(this);
+ } catch (Exception e) {
+ if (env.verbose())
+ e.printStackTrace();
+ throw new GeneratorException("generator.nestedGeneratorError",e);
+ }
+ }
+
+ public void visit(Model model) throws Exception {
+ preVisitModel(model);
+ visitModel(model);
+ postVisitModel(model);
+ }
+
+ protected void preVisitModel(Model model) throws Exception {
+ }
+
+ protected void visitModel(Model model) throws Exception {
+ env.getNames().resetPrefixFactory();
+ for (Service service : model.getServices()) {
+ service.accept(this);
+ }
+ }
+
+ protected void postVisitModel(Model model) throws Exception {
+ }
+
+ public void visit(Service service) throws Exception {
+ preVisitService(service);
+ visitService(service);
+ postVisitService(service);
+ }
+
+ protected void preVisitService(Service service) throws Exception {
+ servicePackage = Names.getPackageName(service);
+ }
+
+ protected void visitService(Service service) throws Exception {
+ this.service = service;
+// Iterator ports = service.getPorts();
+ for (Port port : service.getPorts()) {
+ port.accept(this);
+ }
+ this.service = null;
+ }
+
+ protected void postVisitService(Service service) throws Exception {
+ Iterator extraTypes = model.getExtraTypes();
+ while (extraTypes.hasNext()) {
+ AbstractType type = (AbstractType) extraTypes.next();
+ }
+ servicePackage = null;
+ }
+
+ public void visit(Port port) throws Exception {
+ preVisitPort(port);
+ visitPort(port);
+ postVisitPort(port);
+ }
+
+ protected void preVisitPort(Port port) throws Exception {
+ curSOAPVersion = port.getSOAPVersion();
+ }
+
+ protected void visitPort(Port port) throws Exception {
+ for (Operation operation : port.getOperations()) {
+ operation.accept(this);
+ }
+ }
+
+ protected void postVisitPort(Port port) throws Exception {
+ curSOAPVersion = null;
+ }
+
+ public void visit(Operation operation) throws Exception {
+ preVisitOperation(operation);
+ visitOperation(operation);
+ postVisitOperation(operation);
+ }
+
+ protected void preVisitOperation(Operation operation) throws Exception {
+ }
+
+ protected void visitOperation(Operation operation) throws Exception {
+ operation.getRequest().accept(this);
+ if (operation.getResponse() != null)
+ operation.getResponse().accept(this);
+ Iterator faults = operation.getFaultsSet().iterator();
+ if (faults != null) {
+ Fault fault;
+ while (faults.hasNext()) {
+ fault = (Fault) faults.next();
+ fault.accept(this);
+ }
+ }
+ }
+
+ protected void postVisitOperation(Operation operation) throws Exception {
+ }
+
+ public void visit(Parameter param) throws Exception {
+ preVisitParameter(param);
+ visitParameter(param);
+ postVisitParameter(param);
+ }
+
+ protected void preVisitParameter(Parameter param) throws Exception {
+ }
+
+ protected void visitParameter(Parameter param) throws Exception {
+ }
+
+ protected void postVisitParameter(Parameter param) throws Exception {
+ }
+
+ public void visit(Block block) throws Exception {
+ preVisitBlock(block);
+ visitBlock(block);
+ postVisitBlock(block);
+ }
+
+ protected void preVisitBlock(Block block) throws Exception {
+ }
+
+ protected void visitBlock(Block block) throws Exception {
+ }
+
+ protected void postVisitBlock(Block block) throws Exception {
+ }
+
+ public void visit(Response response) throws Exception {
+ preVisitResponse(response);
+ visitResponse(response);
+ postVisitResponse(response);
+ }
+
+ protected void preVisitResponse(Response response) throws Exception {
+ }
+
+ protected void visitResponse(Response response) throws Exception {
+ Iterator iter = response.getParameters();
+ AbstractType type;
+ Block block;
+ while (iter.hasNext()) {
+ ((Parameter) iter.next()).accept(this);
+ }
+ iter = response.getBodyBlocks();
+ while (iter.hasNext()) {
+ block = (Block) iter.next();
+ type = block.getType();
+ if(type instanceof JAXBType)
+ ((JAXBType) type).accept(this);
+ else if(type instanceof RpcLitStructure)
+ ((RpcLitStructure) type).accept(this);
+
+ responseBodyBlock(block);
+ }
+ iter = response.getHeaderBlocks();
+ while (iter.hasNext()) {
+ block = (Block) iter.next();
+ type = block.getType();
+ if(type instanceof JAXBType)
+ ((JAXBType) type).accept(this);
+ responseHeaderBlock(block);
+ }
+
+ //attachment
+ iter = response.getAttachmentBlocks();
+ while (iter.hasNext()) {
+ block = (Block) iter.next();
+ type = block.getType();
+ if(type instanceof JAXBType)
+ ((JAXBType) type).accept(this);
+ responseAttachmentBlock(block);
+ }
+
+ }
+
+ protected void responseBodyBlock(Block block) throws Exception {
+ }
+
+ protected void responseHeaderBlock(Block block) throws Exception {
+ }
+
+ protected void responseAttachmentBlock(Block block) throws Exception {
+ }
+
+ protected void postVisitResponse(Response response) throws Exception {
+ }
+
+ public void visit(Request request) throws Exception {
+ preVisitRequest(request);
+ visitRequest(request);
+ postVisitRequest(request);
+ }
+
+ protected void preVisitRequest(Request request) throws Exception {
+ }
+
+ protected void visitRequest(Request request) throws Exception {
+ Iterator iter = request.getParameters();
+ AbstractType type;
+ Block block;
+ while (iter.hasNext()) {
+ ((Parameter) iter.next()).accept(this);
+ }
+ iter = request.getBodyBlocks();
+ while (iter.hasNext()) {
+ block = (Block) iter.next();
+ type = block.getType();
+ if(type instanceof JAXBType)
+ ((JAXBType) type).accept(this);
+ else if(type instanceof RpcLitStructure)
+ ((RpcLitStructure) type).accept(this);
+ requestBodyBlock(block);
+ }
+ iter = request.getHeaderBlocks();
+ while (iter.hasNext()) {
+ block = (Block) iter.next();
+ type = block.getType();
+ if(type instanceof JAXBType)
+ ((JAXBType) type).accept(this);
+ requestHeaderBlock(block);
+ }
+ }
+
+ protected void requestBodyBlock(Block block) throws Exception {
+ }
+
+ protected void requestHeaderBlock(Block block) throws Exception {
+ }
+
+ protected void postVisitRequest(Request request) throws Exception {
+ }
+
+ public void visit(Fault fault) throws Exception {
+ preVisitFault(fault);
+ visitFault(fault);
+ postVisitFault(fault);
+ }
+
+ protected void preVisitFault(Fault fault) throws Exception {
+ }
+
+ protected void visitFault(Fault fault) throws Exception {
+ }
+
+ protected void postVisitFault(Fault fault) throws Exception {
+ }
+
+ protected void writeWarning(IndentingWriter p) throws IOException {
+ writeWarning(p, targetVersion);
+ }
+
+ public List<String> getJAXWSClassComment(){
+ return getJAXWSClassComment(targetVersion);
+ }
+
+ public static List<String> getJAXWSClassComment(String targetVersion) {
+ List<String> comments = new ArrayList<String>();
+
+ comments.add("JBossWS Generated Source\n");
+ comments.add("\n");
+ comments.add("Generation Date: " + new Date() + "\n");
+ comments.add("\n");
+ comments.add("This generated source code represents a derivative work of the
input to\n");
+ comments.add("the generator that produced it. Consult the input for the
copyright and\n");
+ comments.add("terms of use that apply to this source code.\n");
+ comments.add("\n");
+ comments.add("JAX-WS Version: " + targetVersion);
+ return comments;
+ }
+
+ public static void writeWarning(IndentingWriter p,
+ String targetVersion) throws IOException {
+ /*
+ * Write boiler plate comment.
+ */
+ p.pln("/*");
+ p.pln(" * JBossWS WS-Tools Generated Source");
+ p.pln(" *");
+ p.pln(" * Generation Date: " + new Date());
+ p.pln(" *");
+ p.pln(" * This generated source code represents a derivative work of the input
to");
+ p.pln(" * the generator that produced it. Consult the input for the copyright
and");
+ p.pln(" * terms of use that apply to this source code.");
+ p.pln(" *");
+ p.pln(" * JAX-WS Version: " + targetVersion);
+ p.pln(" */");
+ p.pln();
+ }
+
+ public void writePackage(IndentingWriter p, String classNameStr)
+ throws IOException {
+
+ writePackage(p, classNameStr, targetVersion);
+ }
+
+ public static void writePackage(
+ IndentingWriter p,
+ String classNameStr,
+ String sourceVersion)
+ throws IOException {
+
+ writeWarning(p, sourceVersion);
+ writePackageOnly(p, classNameStr);
+ }
+
+ public static void writePackageOnly(IndentingWriter p, String classNameStr)
+ throws IOException {
+ int idx = classNameStr.lastIndexOf(".");
+ if (idx > 0) {
+ p.pln("package " + classNameStr.substring(0, idx) +
";");
+ p.pln();
+ }
+ }
+
+
+ protected JDefinedClass getClass(String className, ClassType type) {
+ JDefinedClass cls = null;
+ try {
+ cls = cm._class(className, type);
+ } catch (JClassAlreadyExistsException e){
+ cls = cm._getClass(className);
+ }
+ return cls;
+ }
+
+ protected void log(String msg) {
+ if (env.verbose()) {
+ System.out.println(
+ "["
+ + Names.stripQualifier(this.getClass().getName())
+ + ": "
+ + msg
+ + "]");
+ }
+ }
+
+ protected void warn(String key) {
+ env.warn(messageFactory.getMessage(key));
+ }
+
+ protected void warn(String key, String arg) {
+ env.warn(messageFactory.getMessage(key, arg));
+ }
+
+ protected void warn(String key, Object[] args) {
+ env.warn(messageFactory.getMessage(key, args));
+ }
+
+ protected void info(String key) {
+ env.info(messageFactory.getMessage(key));
+ }
+
+ protected void info(String key, String arg) {
+ env.info(messageFactory.getMessage(key, arg));
+ }
+
+ protected static void fail(String key) {
+ throw new GeneratorException(key);
+ }
+
+ protected static void fail(String key, String arg) {
+ throw new GeneratorException(key, arg);
+ }
+
+ protected static void fail(String key, String arg1, String arg2) {
+ throw new GeneratorException(key, new Object[] { arg1, arg2 });
+ }
+
+ protected static void fail(Localizable arg) {
+ throw new GeneratorException("generator.nestedGeneratorError", arg);
+ }
+
+ protected static void fail(Throwable arg) {
+ throw new GeneratorException(
+ "generator.nestedGeneratorError",
+ arg);
+ }
+
+ /* (non-Javadoc)
+ * @see
org.jboss.com.sun.xml.ws.processor.model.jaxb.JAXBTypeVisitor#visit(org.jboss.com.sun.xml.ws.processor.model.jaxb.JAXBType)
+ */
+ public void visit(JAXBType type) throws Exception {
+ preVisitJAXBType(type);
+ visitJAXBType(type);
+ postVisitJAXBType(type);
+
+ }
+
+ /**
+ * @param type
+ */
+ protected void postVisitJAXBType(JAXBType type) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * @param type
+ */
+ protected void visitJAXBType(JAXBType type) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * @param type
+ */
+ protected void preVisitJAXBType(JAXBType type) {
+ // TODO Auto-generated method stub
+
+ }
+
+
+ /* (non-Javadoc)
+ * @see
org.jboss.com.sun.xml.ws.processor.model.jaxb.JAXBTypeVisitor#visit(org.jboss.com.sun.xml.ws.processor.model.jaxb.RpcLitStructure)
+ */
+ public void visit(RpcLitStructure type) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ protected void writeHandlerConfig(String className, JDefinedClass cls, WSDLModelInfo
wsdlModelInfo) {
+ Element e = wsdlModelInfo.getHandlerConfig();
+ if(e == null)
+ return;
+ JAnnotationUse handlerChainAnn = cls.annotate(cm.ref(HandlerChain.class));
+ //String fullName =
env.getNames().customJavaTypeClassName(port.getJavaInterface());
+ NodeList nl = e.getElementsByTagNameNS(
+ "http://java.sun.com/xml/ns/javaee", "handler-chain");
+ if(nl.getLength() > 0){
+ Element hn = (Element)nl.item(0);
+ String fName = getHandlerConfigFileName(className);
+ handlerChainAnn.param("file", fName);
+ generateHandlerChainFile(e, className);
+ }
+ }
+
+ private String getHandlerConfigFileName(String fullName){
+ String name = Names.stripQualifier(fullName);
+ return name+"_handler.xml";
+ }
+
+ private void generateHandlerChainFile(Element hChains, String name) {
+ String hcName = getHandlerConfigFileName(name);
+
+ File packageDir = DirectoryUtil.getOutputDirectoryFor(name, destDir, env);
+ File hcFile = new File(packageDir, hcName);
+
+ /* adding the file name and its type */
+ GeneratedFileInfo fi = new GeneratedFileInfo();
+ fi.setFile(hcFile);
+ fi.setType("HandlerConfig");
+ env.addGeneratedFile(fi);
+
+ try {
+ IndentingWriter p =
+ new IndentingWriter(
+ new OutputStreamWriter(new FileOutputStream(hcFile)));
+ Transformer it = XmlUtil.newTransformer();
+
+ it.setOutputProperty(OutputKeys.METHOD, "xml");
+ it.setOutputProperty(OutputKeys.INDENT, "yes");
+ it.setOutputProperty(
+ "{http://xml.apache.org/xslt}indent-amount",
+ "2");
+ it.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
+ it.transform( new DOMSource(hChains), new StreamResult(p) );
+ p.close();
+ } catch (Exception e) {
+ throw new GeneratorException(
+ "generator.nestedGeneratorError",
+ e);
+ }
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/GeneratorBase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/GeneratorConstants.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/GeneratorConstants.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/GeneratorConstants.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,83 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.generator;
+
+import org.jboss.com.sun.tools.ws.processor.modeler.ModelerConstants;
+
+/**
+ * @author WS Development Team
+ */
+public interface GeneratorConstants extends ModelerConstants {
+
+ /*
+ * Constants used in the generators
+ */
+ public static final String FILE_TYPE_WSDL = "Wsdl";
+ public static final String FILE_TYPE_REMOTE_INTERFACE = "RemoteInterface";
+ public static final String FILE_TYPE_SERVICE = "Service";
+ public static final String FILE_TYPE_HANDLER_CONFIG = "HandlerConfig";
+ public static final String FILE_TYPE_SERVICE_IMPL = "ServiceImpl";
+ public static final String FILE_TYPE_EXCEPTION = "Exception";
+ public static final String FILE_TYPE_WRAPPER_BEAN = "WrapperBean";
+ public static final String FILE_TYPE_EXCEPTION_BEAN = "ExceptionBean";
+ /*
+ * Identifiers potentially useful for all Generators
+ */
+
+ public static final String ID_DELEGATE_BASE =
"org.jboss.com.sun.xml.ws.soap.internal.DelegateBase";
+
+
+ public static final char DOTC = '.';
+ public static final String SIG_INNERCLASS = "$";
+
+ public static final String UNDERSCORE = "_";
+ public static final String STUB_SUFFIX = "_Stub";
+
+ public static final String CLIENT_DELEGATE_SUFFIX = "_Delegate";
+ public static final String CLIENT_CONTACTINFOLIST_SUFFIX =
"_ContactInfoList";
+
+ public static final String CLIENT_ENCODER_DECODER_SUFFIX = "_CED";
+ public static final String SERVER_ENCODER_DECODER_SUFFIX = "_SED";
+ public static final String TIE_SUFFIX = "_Tie";
+
+ public static final String PEPT_TIE_SUFFIX = "_PTie";
+ public static final String EPTFF_SUFFIX = "_EPTFF";
+ public static final String JAVA_SRC_SUFFIX = ".java";
+ public static final String IMPL_SUFFIX = "_Impl";
+ public static final String ARRAY = "Array";
+ public static final String MEMBER_PREFIX = "my";
+
+ public static final String OPCODE_SUFFIX = "_OPCODE";
+ public static final String QNAME_SUFFIX = "_QNAME";
+ public static final String TYPE_QNAME_SUFFIX = "_TYPE" + QNAME_SUFFIX;
+
+ public static final String GET = "get";
+ public static final String IS = "is";
+ public static final String SET = "set";
+ public static final String RESPONSE = "Response";
+ public static final String NS_PREFIX = "ns";
+ public static final String SERVICE_SUFFIX = "_Service";
+ public static final String JAVA_PACKAGE_PREFIX = "java.";
+ public static final String JAVAX_PACKAGE_PREFIX = "javax.";
+ public static final String FAULT_CLASS_MEMBER_NAME = "faultInfo";
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/GeneratorConstants.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/GeneratorException.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/GeneratorException.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/GeneratorException.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,46 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.generator;
+
+import org.jboss.com.sun.tools.ws.processor.ProcessorException;
+import org.jboss.com.sun.xml.ws.util.localization.Localizable;
+
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class GeneratorException extends ProcessorException {
+
+ public GeneratorException(String key, Object... args) {
+ super(key, args);
+ }
+
+ public GeneratorException(Throwable throwable) {
+ super(throwable);
+ }
+
+ public String getResourceBundleName() {
+ return "org.jboss.com.sun.tools.ws.resources.generator";
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/GeneratorException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/GeneratorUtil.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/GeneratorUtil.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/GeneratorUtil.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,181 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.generator;
+
+import java.io.IOException;
+import java.util.Comparator;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.processor.model.Block;
+import org.jboss.com.sun.tools.ws.processor.model.Fault;
+import org.jboss.com.sun.tools.ws.processor.model.Operation;
+import org.jboss.com.sun.tools.ws.processor.model.java.JavaStructureType;
+import org.jboss.com.sun.tools.ws.processor.util.IndentingWriter;
+import org.jboss.com.sun.tools.ws.processor.util.ProcessorEnvironment;
+
+
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class GeneratorUtil implements GeneratorConstants {
+
+ public static void writeNewQName(IndentingWriter p, QName name)
+ throws IOException {
+ p.p(
+ "new QName(\""
+ + name.getNamespaceURI()
+ + "\", \""
+ + name.getLocalPart()
+ + "\")");
+ }
+
+
+ public static void writeBlockQNameDeclaration(
+ IndentingWriter p,
+ Operation operation,
+ Block block,
+ Names names)
+ throws IOException {
+ String qname = names.getBlockQNameName(operation, block);
+ p.p("private static final QName ");
+ p.p(qname + " = ");
+ writeNewQName(p, block.getName());
+ p.pln(";");
+ }
+
+ public static void writeQNameDeclaration(
+ IndentingWriter p,
+ QName name,
+ Names names)
+ throws IOException {
+ String qname = names.getQNameName(name);
+ p.p("private static final QName ");
+ p.p(qname + " = ");
+ writeNewQName(p, name);
+ p.pln(";");
+ }
+
+ public static void writeQNameTypeDeclaration(
+ IndentingWriter p,
+ QName name,
+ Names names)
+ throws IOException {
+ String qname = names.getTypeQName(name);
+ p.p("private static final QName ");
+ p.p(qname + " = ");
+ writeNewQName(p, name);
+ p.pln(";");
+ }
+
+ public static boolean classExists(
+ ProcessorEnvironment env,
+ String className) {
+ try {
+ // Takes care of inner classes.
+ getLoadableClassName(className, env.getClassLoader());
+ return true;
+ } catch(ClassNotFoundException ce) {
+ }
+ return false;
+ }
+
+ public static String getLoadableClassName(
+ String className,
+ ClassLoader classLoader)
+ throws ClassNotFoundException {
+
+ try {
+ Class.forName(className, true, classLoader);
+ } catch (ClassNotFoundException e) {
+ int idx = className.lastIndexOf(DOTC);
+ if (idx > -1) {
+ String tmp = className.substring(0, idx) + SIG_INNERCLASS;
+ tmp += className.substring(idx + 1);
+ return getLoadableClassName(tmp, classLoader);
+ }
+ throw e;
+ }
+ return className;
+ }
+
+ public static class FaultComparator implements Comparator {
+ private boolean sortName = false;
+ public FaultComparator() {
+ }
+ public FaultComparator(boolean sortName) {
+ this.sortName = sortName;
+ }
+
+ public int compare(Object o1, Object o2) {
+ if (sortName) {
+ QName name1 = ((Fault) o1).getBlock().getName();
+ QName name2 = ((Fault) o2).getBlock().getName();
+ // Faults that are processed by name first, then type
+ if (!name1.equals(name2)) {
+ return name1.toString().compareTo(name2.toString());
+ }
+ }
+ JavaStructureType type1 = ((Fault) o1).getJavaException();
+ JavaStructureType type2 = ((Fault) o2).getJavaException();
+ int result = sort(type1, type2);
+ return result;
+ }
+
+ protected int sort(JavaStructureType type1, JavaStructureType type2) {
+ if (type1.getName().equals(type2.getName())) {
+ return 0;
+ }
+ JavaStructureType superType;
+ superType = type1.getSuperclass();
+ while (superType != null) {
+ if (superType.equals(type2)) {
+ return -1;
+ }
+ superType = superType.getSuperclass();
+ }
+ superType = type2.getSuperclass();
+ while (superType != null) {
+ if (superType.equals(type1)) {
+ return 1;
+ }
+ superType = superType.getSuperclass();
+ }
+ if (type1.getSubclasses() == null && type2.getSubclasses() != null)
+ return -1;
+ if (type1.getSubclasses() != null && type2.getSubclasses() == null)
+ return 1;
+ if (type1.getSuperclass() != null
+ && type2.getSuperclass() == null) {
+ return 1;
+ }
+ if (type1.getSuperclass() == null
+ && type2.getSuperclass() != null) {
+ return -1;
+ }
+ return type1.getName().compareTo(type2.getName());
+ }
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/GeneratorUtil.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/JAXBTypeGenerator.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/JAXBTypeGenerator.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/JAXBTypeGenerator.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,171 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.generator;
+
+import java.util.Properties;
+
+import org.jboss.com.sun.tools.ws.processor.ProcessorOptions;
+import org.jboss.com.sun.tools.ws.processor.config.Configuration;
+import org.jboss.com.sun.tools.ws.processor.model.Model;
+import org.jboss.com.sun.tools.ws.processor.model.jaxb.JAXBType;
+import org.jboss.com.sun.tools.ws.processor.model.jaxb.RpcLitStructure;
+import org.jboss.com.sun.tools.ws.processor.modeler.wsdl.ConsoleErrorReporter;
+import org.jboss.com.sun.tools.ws.wscompile.WSCodeWriter;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPVersion;
+import org.xml.sax.SAXParseException;
+
+import com.sun.codemodel.CodeWriter;
+import com.sun.codemodel.JCodeModel;
+import com.sun.codemodel.writer.ProgressCodeWriter;
+//import com.sun.tools.xjc.addon.Augmenter;
+import com.sun.tools.xjc.api.ErrorListener;
+import com.sun.tools.xjc.api.JAXBModel;
+import com.sun.tools.xjc.api.S2JJAXBModel;
+
+/**
+ * @author Vivek Pandey
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class JAXBTypeGenerator extends GeneratorBase {
+
+ /**
+ * @author Vivek Pandey
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and
Comments
+ */
+ public static class JAXBErrorListener implements ErrorListener {
+
+ /**
+ *
+ */
+ public JAXBErrorListener() {
+ super();
+ }
+
+ /* (non-Javadoc)
+ * @see org.xml.sax.ErrorHandler#error(org.xml.sax.SAXParseException)
+ */
+ public void error(SAXParseException arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.xml.sax.ErrorHandler#fatalError(org.xml.sax.SAXParseException)
+ */
+ public void fatalError(SAXParseException arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.xml.sax.ErrorHandler#warning(org.xml.sax.SAXParseException)
+ */
+ public void warning(SAXParseException arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see com.sun.tools.xjc.api.ErrorListener#info(org.xml.sax.SAXParseException)
+ */
+ public void info(SAXParseException arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+ }
+ /**
+ *
+ */
+ public JAXBTypeGenerator() {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+ /**
+ * @param model
+ * @param config
+ * @param properties
+ */
+ public JAXBTypeGenerator(Model model, Configuration config,
+ Properties properties) {
+ super(model, config, properties);
+ }
+ /* (non-Javadoc)
+ * @see GeneratorBase#getGenerator(org.jboss.com.sun.xml.ws.processor.model.Model,
org.jboss.com.sun.xml.ws.processor.config.Configuration, java.util.Properties)
+ */
+ public GeneratorBase getGenerator(Model model, Configuration config,
+ Properties properties) {
+ return new JAXBTypeGenerator(model, config, properties);
+ }
+ /* (non-Javadoc)
+ * @see cGeneratorBase#getGenerator(org.jboss.com.sun.xml.ws.processor.model.Model,
org.jboss.com.sun.xml.ws.processor.config.Configuration, java.util.Properties,
org.jboss.com.sun.xml.ws.soap.SOAPVersion)
+ */
+ public GeneratorBase getGenerator(Model model, Configuration config,
+ Properties properties, SOAPVersion ver) {
+ return new JAXBTypeGenerator(model, config, properties);
+ }
+
+ /* (non-Javadoc)
+ * @see JAXBTypeVisitor#visit(JAXBType)
+ */
+ public void visit(JAXBType type) throws Exception {
+ //this is a raw type, probably from rpclit
+ if(type.getJaxbModel() == null)
+ return;
+ S2JJAXBModel model = type.getJaxbModel().getS2JJAXBModel();
+ if (model != null)
+ generateJAXBClasses(model);
+ }
+
+
+ /* (non-Javadoc)
+ * @see
JAXBTypeVisitor#visit(org.jboss.com.sun.xml.ws.processor.model.jaxb.RpcLitStructure)
+ */
+ public void visit(RpcLitStructure type) throws Exception {
+ S2JJAXBModel model = type.getJaxbModel().getS2JJAXBModel();
+ generateJAXBClasses(model);
+ }
+
+ private static boolean doneGeneration = true;
+ private void generateJAXBClasses(S2JJAXBModel model) throws Exception{
+ if(doneGeneration)
+ return;
+ JCodeModel cm = null;
+
+ // get the list of jaxb source files
+ CodeWriter cw = new WSCodeWriter(sourceDir,env);
+
+ if(env.verbose())
+ cw = new ProgressCodeWriter(cw, System.out); // TODO this should not be
System.out, should be
+ // something from
ProcessorEnvironment
+ //TODO:set package level javadoc in JPackage
+ cm = model.generateCode(null, new ConsoleErrorReporter(env, printStackTrace));
+ cm.build(cw);
+ doneGeneration = true;
+ }
+
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/JAXBTypeGenerator.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/Names.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/Names.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/Names.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,423 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.generator;
+
+import com.sun.xml.bind.api.JAXBRIContext;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.processor.model.*;
+import org.jboss.com.sun.tools.ws.processor.model.java.JavaInterface;
+import org.jboss.com.sun.tools.ws.processor.model.java.JavaStructureMember;
+import org.jboss.com.sun.tools.ws.processor.model.jaxb.JAXBProperty;
+import org.jboss.com.sun.tools.ws.processor.util.DirectoryUtil;
+import org.jboss.com.sun.tools.ws.processor.util.ProcessorEnvironment;
+import org.jboss.com.sun.tools.ws.util.ClassNameInfo;
+import org.jboss.com.sun.xml.ws.streaming.PrefixFactory;
+import org.jboss.com.sun.xml.ws.streaming.PrefixFactoryImpl;
+import org.jboss.com.sun.xml.ws.util.StringUtils;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Names provides utility methods used by other wscompile classes
+ * for dealing with identifiers.
+ *
+ * @author WS Development Team
+ */
+public class Names implements GeneratorConstants{
+
+ public Names() {
+ }
+
+ public String stubFor(Port port, String infix) {
+ String result =
+ (String) port.getProperty(ModelProperties.PROPERTY_STUB_CLASS_NAME);
+ if (result == null) {
+ result =
+ makeDerivedClassName(
+ port.getJavaInterface(),
+ STUB_SUFFIX,
+ infix);
+ }
+ return result;
+ }
+
+ public String tieFor(Port port, String infix) {
+ String result =
+ (String) port.getProperty(ModelProperties.PROPERTY_TIE_CLASS_NAME);
+ if (result == null) {
+ result =
+ makeDerivedClassName(
+ port.getJavaInterface(),
+ TIE_SUFFIX,
+ infix);
+ }
+ return result;
+ }
+
+ public String makeDerivedClassName(
+ JavaInterface javaInterface,
+ String suffix,
+ String infix) {
+
+ String name =
+ ClassNameInfo.replaceInnerClassSym(javaInterface.getRealName());
+ return name + (infix == null ? "" : UNDERSCORE + infix) + suffix;
+ }
+
+ public static String getPortName(Port port) {
+ String javaPortName =
+ (String) port.getProperty(ModelProperties.PROPERTY_JAVA_PORT_NAME);
+ if (javaPortName != null) {
+ return javaPortName;
+ } else {
+ QName portName =
+ (QName) port.getProperty(
+ ModelProperties.PROPERTY_WSDL_PORT_NAME);
+ if (portName != null) {
+ return portName.getLocalPart();
+ } else {
+ String name = stripQualifier(port.getJavaInterface().getName());
+ return ClassNameInfo.replaceInnerClassSym(name);
+ }
+ }
+ }
+
+ public static String stripQualifier(Class classObj) {
+ String name = classObj.getName();
+ return stripQualifier(name);
+ }
+
+ public static String stripQualifier(String name) {
+ return ClassNameInfo.getName(name);
+ }
+
+ public static String getPackageName(String className) {
+ String packageName = ClassNameInfo.getQualifier(className);
+ return packageName != null ? packageName : "";
+ }
+
+ public static String getUnqualifiedClassName(String className) {
+ return ClassNameInfo.getName(className).replace('$', '.');
+ }
+
+ /**
+ * Return the File object that should be used as the source file
+ * for the given Java class, using the supplied destination
+ * directory for the top of the package hierarchy.
+ */
+ public File sourceFileForClass(
+ String className,
+ String outputClassName,
+ File destDir,
+ ProcessorEnvironment env)
+ throws GeneratorException {
+ File packageDir =
+ DirectoryUtil.getOutputDirectoryFor(className, destDir, env);
+ String outputName = stripQualifier(outputClassName);
+
+ String outputFileName = outputName + JAVA_SRC_SUFFIX;
+ return new File(packageDir, outputFileName);
+ }
+
+ public static String getPackageName(Service service) {
+ String portPackage =
+ getPackageName(service.getJavaInterface().getName());
+ return portPackage;
+ }
+
+ public String customJavaTypeClassName(JavaInterface intf) {
+ String intName = intf.getName();
+ return intName;
+ }
+
+ public String customExceptionClassName(Fault fault) {
+ String typeName = fault.getJavaException().getName();
+ return typeName;
+ }
+
+ public String getExceptionClassMemberName(){
+ return FAULT_CLASS_MEMBER_NAME;
+ }
+
+ public String getQNameName(QName name) {
+ String qname =
+ getPrefix(name) + UNDERSCORE + name.getLocalPart() + QNAME_SUFFIX;
+ return validInternalJavaIdentifier(qname);
+ }
+
+ public String getBlockQNameName(Operation operation, Block block) {
+ QName blockName = block.getName();
+ String qname = getPrefix(blockName);
+ if (operation != null)
+ qname += UNDERSCORE + operation.getUniqueName();
+ qname += UNDERSCORE + blockName.getLocalPart() + QNAME_SUFFIX;
+ return validInternalJavaIdentifier(qname);
+ }
+
+ public String getTypeQName(QName name) {
+ String qname =
+ getPrefix(name)
+ + UNDERSCORE
+ + name.getLocalPart()
+ + TYPE_QNAME_SUFFIX;
+ return validInternalJavaIdentifier(qname);
+ }
+
+ /* (non-Javadoc)
+ * @see Names#validJavaClassName(String)
+ */
+ public String validJavaClassName(String name) {
+ return JAXBRIContext.mangleNameToClassName(name);
+ }
+
+ /* (non-Javadoc)
+ * @see Names#validJavaMemberName(String)
+ */
+ public String validJavaMemberName(String name) {
+ return JAXBRIContext.mangleNameToVariableName(name);
+ }
+
+ public String validInternalJavaIdentifier(String name) {
+ // return a valid java identifier without dropping characters (i.e. do not apply
+ // the mapping of XML names to Java identifiers in the spec); it's only
meant
+ // to be used to generate internal identifiers (e.g. variable names in generated
code)
+
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < name.length(); ++i) {
+ char ch = name.charAt(i);
+ if (i == 0) {
+ if (Character.isJavaIdentifierStart(ch)) {
+ sb.append(ch);
+ } else {
+ sb.append("_$");
+ sb.append(Integer.toHexString((int) ch));
+ sb.append("$");
+ }
+ } else {
+ if (Character.isJavaIdentifierPart(ch)) {
+ sb.append(ch);
+ } else {
+ sb.append("$");
+ sb.append(Integer.toHexString((int) ch));
+ sb.append("$");
+ }
+ }
+ }
+
+ String id = sb.toString();
+
+ String tmp = (String) reservedWords.get(id);
+ if (tmp != null)
+ id = tmp;
+ return id;
+ }
+
+ public String validExternalJavaIdentifier(String name) {
+ return validInternalJavaIdentifier(name).replace('$', '_');
+ }
+
+ public String validJavaName(String name) {
+ name = wordBreakString(name);
+ name = removeWhiteSpace(name);
+
+ String tmp = (String) reservedWords.get(name);
+ if (tmp != null)
+ name = tmp;
+ return name;
+ }
+
+ public boolean isJavaReservedWord(String name) {
+ return reservedWords.get(name) != null;
+ }
+
+ /* here we check on wether return values datatype is
+ boolean. If its boolean, instead of a get method
+ its set a is<MethodName> to comply with JavaBeans
+ Pattern spec */
+ public String getJavaMemberReadMethod(JavaStructureMember member) {
+ String return_value = null;
+ if ((member.getType().getRealName()) == "boolean") {
+ return_value = IS + StringUtils.capitalize(member.getName());
+ } else {
+ return_value = GET + StringUtils.capitalize(member.getName());
+ }
+ return (return_value);
+ }
+
+ public String getJavaMemberWriteMethod(JavaStructureMember member) {
+ return SET + StringUtils.capitalize(member.getName());
+ }
+
+ public static String getResponseName(String messageName) {
+ return messageName + RESPONSE;
+ }
+
+
+ public String getJavaReadMethod(JAXBProperty prop){
+ if(prop.getType().getName().equals("boolean"))
+ return IS + StringUtils.capitalize(prop.getName());
+ return getJavaReadMethod(prop.getName());
+ }
+
+ public String getJavaWriteMethod(JAXBProperty prop){
+ return getJavaWriteMethod(prop.getName());
+ }
+
+ public String getJavaReadMethod(String prop){
+ return GET + StringUtils.capitalize(prop);
+ }
+
+ public String getJavaWriteMethod(String prop){
+ return SET + StringUtils.capitalize(prop);
+ }
+
+ public String removeWhiteSpace(String str) {
+ String tmp = removeCharacter(' ', str);
+ return tmp;
+ }
+
+ public String wordBreakString(String str) {
+ StringBuffer buf = new StringBuffer(str);
+ char ch;
+ for (int i = 0; i < buf.length(); i++) {
+ ch = buf.charAt(i);
+ if (Character.isDigit(ch)) {
+ if (i + 1 < buf.length()
+ && !Character.isDigit(buf.charAt(i + 1))) {
+ buf.insert(1 + i++, ' ');
+ }
+ } else if (Character.isSpaceChar(ch) || ch == '_') {
+ continue;
+ } else if (!Character.isJavaIdentifierPart(ch)) {
+ buf.setCharAt(i, ' ');
+ } else if (!Character.isLetter(ch)) {
+ buf.setCharAt(i, ' ');
+ }
+ }
+ return buf.toString();
+ }
+
+ public String removeCharacter(int ch, String str) {
+ String tmp;
+ int idx = str.indexOf(ch);
+ while (idx >= 0) {
+ str =
+ str.substring(0, idx)
+ + StringUtils.capitalize(str.substring(idx + 1).trim());
+ idx = str.indexOf(' ');
+ }
+
+ return str;
+ }
+
+ public String getPrefix(QName name) {
+ return getPrefix(name.getNamespaceURI());
+ }
+
+ public String getPrefix(String uri) {
+ return prefixFactory.getPrefix(uri);
+ }
+
+ public void resetPrefixFactory() {
+ prefixFactory = new PrefixFactoryImpl(NS_PREFIX);
+ }
+
+ public void setSerializerNameInfix(String serNameInfix) {
+ if (serNameInfix != null && serNameInfix.length() > 0)
+ serializerNameInfix = UNDERSCORE + serNameInfix;
+ }
+
+ public String getSerializerNameInfix() {
+ // Fix for bug 4811625 and 4778136, undoing what setter does (remove beginning
underscore)
+ String str = serializerNameInfix;
+ if ((serializerNameInfix != null)
+ && (serializerNameInfix.charAt(0) == '_'))
+ str = serializerNameInfix.substring(1);
+ return str;
+ }
+
+ protected String serializerNameInfix = null;
+ protected PrefixFactory prefixFactory = new PrefixFactoryImpl(NS_PREFIX);
+ protected static Map reservedWords;
+
+ static {
+ reservedWords = new HashMap();
+ reservedWords.put("abstract", "_abstract");
+ reservedWords.put("assert", "_assert");
+ reservedWords.put("boolean", "_boolean");
+ reservedWords.put("break", "_break");
+ reservedWords.put("byte", "_byte");
+ reservedWords.put("case", "_case");
+ reservedWords.put("catch", "_catch");
+ reservedWords.put("char", "_char");
+ reservedWords.put("class", "_class");
+ reservedWords.put("const", "_const");
+ reservedWords.put("continue", "_continue");
+ reservedWords.put("default", "_default");
+ reservedWords.put("do", "_do");
+ reservedWords.put("double", "_double");
+ reservedWords.put("else", "_else");
+ reservedWords.put("extends", "_extends");
+ reservedWords.put("false", "_false");
+ reservedWords.put("final", "_final");
+ reservedWords.put("finally", "_finally");
+ reservedWords.put("float", "_float");
+ reservedWords.put("for", "_for");
+ reservedWords.put("goto", "_goto");
+ reservedWords.put("if", "_if");
+ reservedWords.put("implements", "_implements");
+ reservedWords.put("import", "_import");
+ reservedWords.put("instanceof", "_instanceof");
+ reservedWords.put("int", "_int");
+ reservedWords.put("interface", "_interface");
+ reservedWords.put("long", "_long");
+ reservedWords.put("native", "_native");
+ reservedWords.put("new", "_new");
+ reservedWords.put("null", "_null");
+ reservedWords.put("package", "_package");
+ reservedWords.put("private", "_private");
+ reservedWords.put("protected", "_protected");
+ reservedWords.put("public", "_public");
+ reservedWords.put("return", "_return");
+ reservedWords.put("short", "_short");
+ reservedWords.put("static", "_static");
+ reservedWords.put("strictfp", "_strictfp");
+ reservedWords.put("super", "_super");
+ reservedWords.put("switch", "_switch");
+ reservedWords.put("synchronized", "_synchronized");
+ reservedWords.put("this", "_this");
+ reservedWords.put("throw", "_throw");
+ reservedWords.put("throws", "_throws");
+ reservedWords.put("transient", "_transient");
+ reservedWords.put("true", "_true");
+ reservedWords.put("try", "_try");
+ reservedWords.put("void", "_void");
+ reservedWords.put("volatile", "_volatile");
+ reservedWords.put("while", "_while");
+ reservedWords.put("enum", "_enum");
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/Names.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/SeiGenerator.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/SeiGenerator.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/SeiGenerator.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,475 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.generator;
+
+import com.sun.codemodel.*;
+import com.sun.codemodel.writer.ProgressCodeWriter;
+import com.sun.tools.xjc.api.TypeAndAnnotation;
+
+import org.jboss.com.sun.tools.ws.processor.ProcessorAction;
+import org.jboss.com.sun.tools.ws.processor.config.Configuration;
+import org.jboss.com.sun.tools.ws.processor.config.WSDLModelInfo;
+import org.jboss.com.sun.tools.ws.processor.model.*;
+import org.jboss.com.sun.tools.ws.processor.model.java.JavaInterface;
+import org.jboss.com.sun.tools.ws.processor.model.java.JavaMethod;
+import org.jboss.com.sun.tools.ws.processor.model.java.JavaParameter;
+import org.jboss.com.sun.tools.ws.processor.model.jaxb.JAXBType;
+import org.jboss.com.sun.tools.ws.processor.model.jaxb.JAXBTypeAndAnnotation;
+import org.jboss.com.sun.tools.ws.processor.util.DirectoryUtil;
+import org.jboss.com.sun.tools.ws.processor.util.GeneratedFileInfo;
+import org.jboss.com.sun.tools.ws.processor.util.IndentingWriter;
+import org.jboss.com.sun.tools.ws.wscompile.WSCodeWriter;
+import org.jboss.com.sun.tools.ws.wsdl.document.PortType;
+import org.jboss.com.sun.tools.ws.wsdl.document.soap.SOAPStyle;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPVersion;
+import org.jboss.com.sun.xml.ws.util.xml.XmlUtil;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+import javax.jws.HandlerChain;
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.ws.Holder;
+import javax.xml.namespace.QName;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.util.List;
+import java.util.Properties;
+import java.util.Iterator;
+
+public class SeiGenerator extends GeneratorBase implements ProcessorAction {
+ private WSDLModelInfo wsdlModelInfo;
+ private String serviceNS;
+
+ public SeiGenerator() {
+ }
+
+ protected void doGeneration() {
+ try {
+ model.accept(this);
+ } catch (Exception e) {
+ if (env.verbose())
+ e.printStackTrace();
+ throw new GeneratorException(
+ "generator.nestedGeneratorError",
+ e);
+ }
+ }
+
+ public GeneratorBase getGenerator(Model model, Configuration config, Properties
properties) {
+ return new SeiGenerator(model, config, properties);
+ }
+
+ public SeiGenerator(Model model, Configuration config, Properties properties) {
+ super(model, config, properties);
+ this.model = model;
+ this.wsdlModelInfo = (WSDLModelInfo)config.getModelInfo();
+ }
+
+ public GeneratorBase getGenerator(Model model, Configuration config, Properties
properties, SOAPVersion ver) {
+ return new SeiGenerator(model, config, properties);
+ }
+
+
+ private void write(Service service, Port port) throws Exception{
+ JavaInterface intf = port.getJavaInterface();
+ String className = env.getNames().customJavaTypeClassName(intf);
+
+ if (donotOverride && GeneratorUtil.classExists(env, className)) {
+ log("Class " + className + " exists. Not overriding.");
+ return;
+ }
+
+
+ JDefinedClass cls = getClass(className, ClassType.INTERFACE);
+ if (cls == null)
+ return;
+
+ // If the class has methods it has already been defined
+ // so skip it.
+ if (!cls.methods().isEmpty())
+ return;
+
+ //write class comment - JAXWS warning
+ JDocComment comment = cls.javadoc();
+
+ String ptDoc = intf.getJavaDoc();
+ if(ptDoc != null){
+ comment.add(ptDoc);
+ comment.add("\n\n");
+ }
+
+ for(String doc:getJAXWSClassComment()){
+ comment.add(doc);
+ }
+
+
+ //@WebService
+ JAnnotationUse webServiceAnn = cls.annotate(cm.ref(WebService.class));
+ writeWebServiceAnnotation(service, port, webServiceAnn);
+
+ //@HandlerChain
+
writeHandlerConfig(env.getNames().customJavaTypeClassName(port.getJavaInterface()), cls,
wsdlModelInfo);
+
+ //@SOAPBinding
+ writeSOAPBinding(port, cls);
+
+ for (Operation operation: port.getOperations()) {
+ JavaMethod method = operation.getJavaMethod();
+
+ //@WebMethod
+ JMethod m = null;
+ JDocComment methodDoc = null;
+ String methodJavaDoc = operation.getJavaDoc();
+ if(method.getReturnType().getName().equals("void")){
+ m = cls.method(JMod.PUBLIC, void.class, method.getName());
+ methodDoc = m.javadoc();
+ }else {
+ JAXBTypeAndAnnotation retType = method.getReturnType().getType();
+ m = cls.method(JMod.PUBLIC, retType.getType(), method.getName());
+ retType.annotate(m);
+ methodDoc = m.javadoc();
+ JCommentPart ret = methodDoc.addReturn();
+ ret.add("returns "+retType.getName());
+ }
+ if(methodJavaDoc != null)
+ methodDoc.add(methodJavaDoc);
+
+ writeWebMethod(operation, m);
+ JClass holder = cm.ref(Holder.class);
+ for (JavaParameter parameter: method.getParametersList()) {
+ JVar var = null;
+ JAXBTypeAndAnnotation paramType = parameter.getType().getType();
+ if (parameter.isHolder()) {
+ var = m.param(holder.narrow(paramType.getType().boxify()),
parameter.getName());
+ }else{
+ var = m.param(paramType.getType(), parameter.getName());
+ }
+
+ //annotate parameter with JAXB annotations
+ paramType.annotate(var);
+ methodDoc.addParam(var);
+ JAnnotationUse paramAnn = var.annotate(cm.ref(WebParam.class));
+ writeWebParam(operation, parameter, paramAnn);
+ }
+ for(Fault fault:operation.getFaultsSet()){
+ m._throws(fault.getExceptionClass());
+ methodDoc.addThrows(fault.getExceptionClass());
+ }
+ }
+ CodeWriter cw = new WSCodeWriter(sourceDir,env);
+
+ if(env.verbose())
+ cw = new ProgressCodeWriter(cw, System.out);
+ cm.build(cw);
+ }
+
+ private void writeWebMethod(Operation operation, JMethod m) {
+ Response response = operation.getResponse();
+ JAnnotationUse webMethodAnn = m.annotate(cm.ref(WebMethod.class));;
+ String operationName = (operation instanceof AsyncOperation)?
+
((AsyncOperation)operation).getNormalOperation().getName().getLocalPart():
+ operation.getName().getLocalPart();
+
+ if(!m.name().equals(operationName)){
+ webMethodAnn.param("operationName", operationName);
+ }
+
+ if (operation.getSOAPAction() != null &&
operation.getSOAPAction().length() > 0){
+ webMethodAnn.param("action", operation.getSOAPAction());
+ }
+
+ if (operation.getResponse() == null){
+ m.annotate(javax.jws.Oneway.class);
+ }else if
(!operation.getJavaMethod().getReturnType().getName().equals("void") &&
+ operation.getResponse().getParametersList().size() > 0){
+ Block block = null;
+ String resultName = null;
+ String nsURI = null;
+ if (operation.getResponse().getBodyBlocks().hasNext()) {
+ block = operation.getResponse().getBodyBlocks().next();
+ resultName = block.getName().getLocalPart();
+ if(isDocStyle || block.getLocation() == Block.HEADER){
+ nsURI = block.getName().getNamespaceURI();
+ }
+ }
+
+ for (Parameter parameter : operation.getResponse().getParametersList()) {
+ if (parameter.getParameterIndex() == -1) {
+ if(operation.isWrapped()||!isDocStyle){
+ if(parameter.getBlock().getLocation() == Block.HEADER){
+ resultName = parameter.getBlock().getName().getLocalPart();
+ }else{
+ resultName = parameter.getName();
+ }
+ if (isDocStyle || (parameter.getBlock().getLocation() ==
Block.HEADER)) {
+ nsURI = parameter.getType().getName().getNamespaceURI();
+ }
+ }else if(isDocStyle){
+ JAXBType t = (JAXBType)parameter.getType();
+ resultName = t.getName().getLocalPart();
+ nsURI = t.getName().getNamespaceURI();
+ }
+ if(!(operation instanceof AsyncOperation)){
+ JAnnotationUse wr = null;
+
+ if(!resultName.equals("return")){
+ if(wr == null)
+ wr = m.annotate(javax.jws.WebResult.class);
+ wr.param("name", resultName);
+ }
+ //if (operation.getStyle().equals(SOAPStyle.DOCUMENT) &&
!(nsURI.equals(serviceNS))) {
+ if((nsURI != null) && (!nsURI.equals(serviceNS) ||
(isDocStyle && operation.isWrapped()))){
+ if(wr == null)
+ wr = m.annotate(javax.jws.WebResult.class);
+ wr.param("targetNamespace", nsURI);
+ }
+ //doclit wrapped could have additional headers
+ if(!(isDocStyle && operation.isWrapped()) ||
+ (parameter.getBlock().getLocation() == Block.HEADER)){
+ if(wr == null)
+ wr = m.annotate(javax.jws.WebResult.class);
+ wr.param("partName", parameter.getName());
+ }
+ if(parameter.getBlock().getLocation() == Block.HEADER){
+ if(wr == null)
+ wr = m.annotate(javax.jws.WebResult.class);
+ wr.param("header",true);
+ }
+ }
+ }
+
+ }
+ }
+
+ //DOC/BARE
+ if (!sameParamStyle) {
+ if(!operation.isWrapped()) {
+ JAnnotationUse sb = m.annotate(SOAPBinding.class);
+ sb.param("parameterStyle", SOAPBinding.ParameterStyle.BARE);
+ }
+ }
+
+ if (operation.isWrapped() &&
operation.getStyle().equals(SOAPStyle.DOCUMENT)) {
+ Block reqBlock = operation.getRequest().getBodyBlocks().next();
+ JAnnotationUse reqW = m.annotate(javax.xml.ws.RequestWrapper.class);
+ reqW.param("localName", reqBlock.getName().getLocalPart());
+ reqW.param("targetNamespace",
reqBlock.getName().getNamespaceURI());
+ reqW.param("className",
reqBlock.getType().getJavaType().getName());
+
+ if (response != null) {
+ JAnnotationUse resW = m.annotate(javax.xml.ws.ResponseWrapper.class);
+ Block resBlock = response.getBodyBlocks().next();
+ resW.param("localName", resBlock.getName().getLocalPart());
+ resW.param("targetNamespace",
resBlock.getName().getNamespaceURI());
+ resW.param("className",
resBlock.getType().getJavaType().getName());
+ }
+ }
+ }
+
+ //TODO: JAXB should expose the annotations so that it can be added to JAnnotationUse
+ protected void writeJAXBTypeAnnotations(JAnnotationUse annUse, Parameter param)
throws IOException{
+ List<String> annotations = param.getAnnotations();
+ if(annotations == null)
+ return;
+
+ for(String annotation:param.getAnnotations()){
+ //p.pln(annotation);
+ //annUse.
+ }
+ }
+
+ private boolean isMessageParam(Parameter param, Message message) {
+ Block block = param.getBlock();
+
+ return (message.getBodyBlockCount() > 0 &&
block.equals(message.getBodyBlocks().next())) ||
+ (message.getHeaderBlockCount() > 0 &&
+ block.equals(message.getHeaderBlocks().next()));
+ }
+
+ private boolean isHeaderParam(Parameter param, Message message) {
+ if (message.getHeaderBlockCount() == 0)
+ return false;
+
+ for (Block headerBlock : message.getHeaderBlocksMap().values())
+ if (param.getBlock().equals(headerBlock))
+ return true;
+
+ return false;
+ }
+
+ private boolean isAttachmentParam(Parameter param, Message message){
+ if (message.getAttachmentBlockCount() == 0)
+ return false;
+
+ for (Block attBlock : message.getAttachmentBlocksMap().values())
+ if (param.getBlock().equals(attBlock))
+ return true;
+
+ return false;
+ }
+
+ private boolean isUnboundParam(Parameter param, Message message){
+ if (message.getUnboundBlocksCount() == 0)
+ return false;
+
+ for (Block unboundBlock : message.getUnboundBlocksMap().values())
+ if (param.getBlock().equals(unboundBlock))
+ return true;
+
+ return false;
+ }
+
+ private void writeWebParam(Operation operation, JavaParameter javaParameter,
JAnnotationUse paramAnno) {
+ Parameter param = javaParameter.getParameter();
+ Request req = operation.getRequest();
+ Response res = operation.getResponse();
+
+ boolean header = isHeaderParam(param, req) ||
+ (res != null ? isHeaderParam(param, res) : false);
+
+ String name;
+ boolean isWrapped = operation.isWrapped();
+
+ if((param.getBlock().getLocation() == Block.HEADER) || (isDocStyle &&
!isWrapped))
+ name = param.getBlock().getName().getLocalPart();
+ else
+ name = param.getName();
+
+ paramAnno.param("name", name);
+
+ String ns= null;
+
+ if (isDocStyle) {
+ ns = param.getBlock().getName().getNamespaceURI(); // its bare nsuri
+ if(isWrapped){
+ ns = ((JAXBType)param.getType()).getName().getNamespaceURI();
+ }
+ }else if(!isDocStyle && header){
+ ns = param.getBlock().getName().getNamespaceURI();
+ }
+
+ if((ns != null) && (!ns.equals(serviceNS) || (isDocStyle &&
isWrapped)))
+ paramAnno.param("targetNamespace", ns);
+
+ if (header) {
+ paramAnno.param("header", true);
+ }
+
+ if (param.isINOUT()){
+ paramAnno.param("mode", javax.jws.WebParam.Mode.INOUT);
+ }else if ((res != null) && (isMessageParam(param, res) ||
isHeaderParam(param, res) || isAttachmentParam(param, res) ||
+ isUnboundParam(param,res))){
+ paramAnno.param("mode", javax.jws.WebParam.Mode.OUT);
+ }
+
+ //doclit wrapped could have additional headers
+ if(!(isDocStyle && isWrapped) || header)
+ paramAnno.param("partName",
javaParameter.getParameter().getName());
+ }
+
+ boolean isDocStyle = true;
+ boolean sameParamStyle = true;
+ private void writeSOAPBinding(Port port, JDefinedClass cls) {
+ JAnnotationUse soapBindingAnn = null;
+ isDocStyle = port.getStyle() != null ? port.getStyle().equals(SOAPStyle.DOCUMENT)
: true;
+ if(!isDocStyle){
+ if(soapBindingAnn == null)
+ soapBindingAnn = cls.annotate(SOAPBinding.class);
+ soapBindingAnn.param("style", SOAPBinding.Style.RPC);
+ port.setWrapped(true);
+ }
+ if(isDocStyle){
+ boolean first = true;
+ boolean isWrapper = true;
+ for(Operation operation:port.getOperations()){
+ if(first){
+ isWrapper = operation.isWrapped();
+ first = false;
+ continue;
+ }
+ sameParamStyle = (isWrapper == operation.isWrapped());
+ if(!sameParamStyle)
+ break;
+ }
+ if(sameParamStyle)
+ port.setWrapped(isWrapper);
+ }
+ if(sameParamStyle && !port.isWrapped()){
+ if(soapBindingAnn == null)
+ soapBindingAnn = cls.annotate(SOAPBinding.class);
+ soapBindingAnn.param("parameterStyle",
SOAPBinding.ParameterStyle.BARE);
+ }
+ }
+
+ private void writeWebServiceAnnotation(Service service, Port port, JAnnotationUse
wsa) {
+ QName name = (QName)
port.getProperty(ModelProperties.PROPERTY_WSDL_PORT_TYPE_NAME);
+ wsa.param("name", name.getLocalPart());
+ wsa.param("targetNamespace", name.getNamespaceURI());
+ }
+
+
+
+
+ public void visit(Model model) throws Exception {
+ for(Service s:model.getServices()){
+ s.accept(this);
+ }
+ }
+
+ public void visit(Service service) throws Exception {
+ String jd = model.getJavaDoc();
+ if(jd != null){
+ JPackage pkg = cm._package(wsdlModelInfo.getJavaPackageName());
+ pkg.javadoc().add(jd);
+ }
+
+ for(Port p:service.getPorts()){
+ visitPort(service, p);
+ }
+ }
+
+ private void visitPort(Service service, Port port) {
+ if (port.isProvider()) {
+ return; // Not generating for Provider based endpoint
+ }
+
+
+ try {
+ write(service, port);
+ } catch (Exception e) {
+ throw new GeneratorException(
+ "generator.nestedGeneratorError",
+ e);
+ }
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/SeiGenerator.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/ServiceGenerator.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/ServiceGenerator.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/ServiceGenerator.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,216 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.generator;
+
+import com.sun.codemodel.*;
+import com.sun.codemodel.writer.ProgressCodeWriter;
+import java.util.Properties;
+
+import com.sun.tools.xjc.api.XJC;
+import com.sun.xml.bind.api.JAXBRIContext;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.net.MalformedURLException;
+import javax.xml.ws.WebEndpoint;
+import javax.xml.ws.WebServiceClient;
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.processor.ProcessorAction;
+import org.jboss.com.sun.tools.ws.processor.config.Configuration;
+import org.jboss.com.sun.tools.ws.processor.config.WSDLModelInfo;
+import org.jboss.com.sun.tools.ws.processor.model.Model;
+import org.jboss.com.sun.tools.ws.processor.model.Port;
+import org.jboss.com.sun.tools.ws.processor.model.Service;
+import org.jboss.com.sun.tools.ws.processor.model.java.JavaInterface;
+import org.jboss.com.sun.tools.ws.wscompile.WSCodeWriter;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPVersion;
+import org.jboss.com.sun.xml.ws.util.JAXWSUtils;
+import org.jboss.com.sun.xml.ws.util.StringUtils;
+
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class ServiceGenerator extends GeneratorBase implements ProcessorAction {
+ private String serviceNS;
+ private WSDLModelInfo wsdlModelInfo;
+
+ public ServiceGenerator() {
+ super();
+ }
+
+ private ServiceGenerator(
+ Model model,
+ Configuration config,
+ Properties properties) {
+ super(model, config, properties);
+ this.wsdlModelInfo = (WSDLModelInfo)config.getModelInfo();
+ }
+
+ public GeneratorBase getGenerator(
+ Model model,
+ Configuration config,
+ Properties properties) {
+ return new ServiceGenerator(model, config, properties);
+ }
+
+ public GeneratorBase getGenerator(
+ Model model,
+ Configuration config,
+ Properties properties,
+ SOAPVersion ver) {
+ return new ServiceGenerator(model, config, properties);
+ }
+
+ /**
+ * Generates an expression that evaluates to "new QName(...)"
+ */
+ private JInvocation createQName(QName name) {
+ return
JExpr._new(cm.ref(QName.class)).arg(name.getNamespaceURI()).arg(name.getLocalPart());
+ }
+
+ private JInvocation createURL(URL url) {
+ return JExpr._new(cm.ref(URL.class)).arg(url.toExternalForm());
+ }
+
+ protected void visitService(Service service) {
+ try {
+ JavaInterface intf = (JavaInterface) service.getJavaInterface();
+ String className = env.getNames().customJavaTypeClassName(intf);
+ if (donotOverride && GeneratorUtil.classExists(env, className)) {
+ log("Class " + className + " exists. Not
overriding.");
+ return;
+ }
+
+ JDefinedClass cls = getClass(className, ClassType.CLASS);
+
+ cls._extends(javax.xml.ws.Service.class);
+ String serviceFieldName =
JAXBRIContext.mangleNameToClassName(service.getName().getLocalPart()).toUpperCase();
+ String wsdlLocationName = serviceFieldName+"_WSDL_LOCATION";
+ JFieldVar urlField = cls.field(JMod.PRIVATE|JMod.STATIC|JMod.FINAL,
URL.class, wsdlLocationName);
+ JClass qNameCls = cm.ref(QName.class);
+ JInvocation inv;
+ inv = JExpr._new(qNameCls);
+ inv.arg("namespace");
+ inv.arg("localpart");
+
+
+ JBlock staticBlock = cls.init();
+ URL url = new
URL(JAXWSUtils.absolutize(JAXWSUtils.getFileOrURLName(wsdlLocation)));
+ JVar urlVar = staticBlock.decl(cm.ref(URL.class),"url",
JExpr._null());
+ JTryBlock tryBlock = staticBlock._try();
+ tryBlock.body().assign(urlVar, createURL(url));
+ JCatchBlock catchBlock =
tryBlock._catch(cm.ref(MalformedURLException.class));
+ catchBlock.param("e");
+ catchBlock.body().directStatement("e.printStackTrace();");
+ staticBlock.assign(urlField, urlVar);
+
+ //write class comment - JAXWS warning
+ JDocComment comment = cls.javadoc();
+
+ if(service.getJavaDoc() != null){
+ comment.add(service.getJavaDoc());
+ comment.add("\n\n");
+ }
+
+ for (String doc : getJAXWSClassComment()) {
+ comment.add(doc);
+ }
+
+ JMethod constructor = cls.constructor(JMod.PUBLIC);
+ constructor.param(URL.class, "wsdlLocation");
+ constructor.param(QName.class, "serviceName");
+ constructor.body().directStatement("super(wsdlLocation,
serviceName);");
+
+ constructor = cls.constructor(JMod.PUBLIC);
+
constructor.body().directStatement("super("+wsdlLocationName+", new
QName(\""+service.getName().getNamespaceURI()+"\",
\""+service.getName().getLocalPart()+"\"));");
+
+ //@WebService
+ JAnnotationUse webServiceClientAnn =
cls.annotate(cm.ref(WebServiceClient.class));
+ writeWebServiceClientAnnotation(service, webServiceClientAnn);
+
+ //@HandlerChain
+
writeHandlerConfig(env.getNames().customJavaTypeClassName(service.getJavaInterface()),
cls, wsdlModelInfo);
+
+ for (Port port: service.getPorts()) {
+ if (port.isProvider()) {
+ continue; // No getXYZPort() for porvider based endpoint
+ }
+ //@WebEndpoint
+ JMethod m = null;
+ JDocComment methodDoc = null;
+ JType retType = getClass(port.getJavaInterface().getName(),
ClassType.INTERFACE);
+ m = cls.method(JMod.PUBLIC, retType, port.getPortGetter());
+ methodDoc = m.javadoc();
+ if(port.getJavaDoc() != null)
+ methodDoc.add(port.getJavaDoc());
+ JCommentPart ret = methodDoc.addReturn();
+ ret.add("returns "+retType.name());
+ JBlock body = m.body();
+ StringBuffer statement = new StringBuffer("return (");
+ statement.append(retType.name());
+ statement.append(")super.getPort(new
QName(\""+port.getName().getNamespaceURI()+"\", \""+
port.getName().getLocalPart()+"\"), ");
+ statement.append(retType.name());
+ statement.append(".class);");
+ body.directStatement(statement.toString());
+ writeWebEndpoint(port, m);
+ }
+ CodeWriter cw = new WSCodeWriter(sourceDir,env);
+
+ if(env.verbose())
+ cw = new ProgressCodeWriter(cw, System.out);
+ cm.build(cw);
+
+ } catch (IOException e) {
+ throw new GeneratorException(
+ "generator.nestedGeneratorError",
+ e);
+ }
+ }
+
+ protected JDefinedClass getClass(String className, ClassType type) {
+ JDefinedClass cls = null;
+ try {
+ cls = cm._class(className, type);
+ } catch (JClassAlreadyExistsException e){
+ cls = cm._getClass(className);
+ }
+ return cls;
+ }
+
+ private void writeWebServiceClientAnnotation(Service service, JAnnotationUse wsa) {
+ String serviceName = service.getName().getLocalPart();
+ serviceNS = service.getName().getNamespaceURI();
+ wsa.param("name", serviceName);
+ wsa.param("targetNamespace", serviceNS);
+ wsa.param("wsdlLocation", wsdlLocation);
+ }
+
+ private void writeWebEndpoint(Port port, JMethod m) {
+ JAnnotationUse webEndpointAnn = m.annotate(cm.ref(WebEndpoint.class));
+ webEndpointAnn.param("name", port.getName().getLocalPart());
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/ServiceGenerator.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/SimpleToBoxedUtil.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/SimpleToBoxedUtil.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/SimpleToBoxedUtil.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,110 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.generator;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public final class SimpleToBoxedUtil {
+
+ public static String getBoxedExpressionOfType(String s, String c) {
+ if (isPrimitive(c)) {
+ StringBuffer sb = new StringBuffer();
+ sb.append("new ");
+ sb.append(getBoxedClassName(c));
+ sb.append('(');
+ sb.append(s);
+ sb.append(')');
+ return sb.toString();
+ } else
+ return s;
+ }
+
+ public static String getUnboxedExpressionOfType(String s, String c) {
+ if (isPrimitive(c)) {
+ StringBuffer sb = new StringBuffer();
+ sb.append('(');
+ sb.append(s);
+ sb.append(").");
+ sb.append(c);
+ sb.append("Value()");
+ return sb.toString();
+ } else
+ return s;
+ }
+
+ public static String convertExpressionFromTypeToType(
+ String s,
+ String from,
+ String to)
+ throws Exception {
+ if (from.equals(to))
+ return s;
+ else {
+ if (!isPrimitive(to) && isPrimitive(from))
+ return getBoxedExpressionOfType(s, from);
+ else if (isPrimitive(to) && isPrimitive(from))
+ return getUnboxedExpressionOfType(s, to);
+ else
+ return s;
+ }
+ }
+
+ public static String getBoxedClassName(String className) {
+ if (isPrimitive(className)) {
+ StringBuffer sb = new StringBuffer();
+ sb.append("java.lang.");
+ if (className.equals(int.class.getName()))
+ sb.append("Integer");
+ else if (className.equals(char.class.getName()))
+ sb.append("Character");
+ else {
+ sb.append(Character.toUpperCase(className.charAt(0)));
+ sb.append(className.substring(1));
+ }
+ return sb.toString();
+ } else
+ return className;
+ }
+
+ public static boolean isPrimitive(String className) {
+ return primitiveSet.contains(className);
+ }
+
+ static Set primitiveSet = null;
+
+ static {
+ primitiveSet = new HashSet();
+ primitiveSet.add("boolean");
+ primitiveSet.add("byte");
+ primitiveSet.add("double");
+ primitiveSet.add("float");
+ primitiveSet.add("int");
+ primitiveSet.add("long");
+ primitiveSet.add("short");
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/generator/SimpleToBoxedUtil.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/AbstractType.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/AbstractType.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/AbstractType.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,144 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.model;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.processor.model.java.JavaType;
+import org.jboss.com.sun.xml.ws.util.NullIterator;
+
+
+/**
+ *
+ * @author WS Development Team
+ */
+public abstract class AbstractType {
+
+ protected AbstractType() {}
+
+ protected AbstractType(QName name) {
+ this(name, null, null);
+ }
+
+ protected AbstractType(QName name, String version) {
+ this(name, null, version);
+ }
+
+ protected AbstractType(QName name, JavaType javaType) {
+ this(name, javaType, null);
+ }
+
+ protected AbstractType(QName name, JavaType javaType, String version) {
+ this.name = name;
+ this.javaType = javaType;
+ this.version = version;
+ }
+
+ public QName getName() {
+ return name;
+ }
+
+ public void setName(QName name) {
+ this.name = name;
+ }
+
+ public JavaType getJavaType() {
+ return javaType;
+ }
+
+ public void setJavaType(JavaType javaType) {
+ this.javaType = javaType;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public boolean isNillable() {
+ return false;
+ }
+
+ public boolean isSOAPType() {
+ return false;
+ }
+
+ public boolean isLiteralType() {
+ return false;
+ }
+
+ public Object getProperty(String key) {
+ if (properties == null) {
+ return null;
+ }
+ return properties.get(key);
+ }
+
+ public void setProperty(String key, Object value) {
+ if (value == null) {
+ removeProperty(key);
+ return;
+ }
+
+ if (properties == null) {
+ properties = new HashMap();
+ }
+ properties.put(key, value);
+ }
+
+ public void removeProperty(String key) {
+ if (properties != null) {
+ properties.remove(key);
+ }
+ }
+
+ public Iterator getProperties() {
+ if (properties == null) {
+ return NullIterator.getInstance();
+ } else {
+ return properties.keySet().iterator();
+ }
+ }
+
+ /* serialization */
+ public Map getPropertiesMap() {
+ return properties;
+ }
+
+ /* serialization */
+ public void setPropertiesMap(Map m) {
+ properties = m;
+ }
+
+ private QName name;
+ private JavaType javaType;
+ private String version = null;
+ private Map properties;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/AbstractType.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/AsyncOperation.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/AsyncOperation.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/AsyncOperation.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,130 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.model;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.processor.model.java.JavaSimpleType;
+import org.jboss.com.sun.tools.ws.processor.model.java.JavaType;
+import org.jboss.com.sun.tools.ws.processor.model.jaxb.JAXBType;
+import org.jboss.com.sun.tools.ws.processor.model.jaxb.JAXBTypeAndAnnotation;
+
+import com.sun.codemodel.JClass;
+import com.sun.codemodel.JCodeModel;
+
+
+/**
+ * @author Vivek Pandey
+ *
+ *
+ */
+public class AsyncOperation extends Operation {
+
+ /**
+ *
+ */
+ public AsyncOperation() {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param operation
+ */
+ public AsyncOperation(Operation operation) {
+ super(operation);
+ this.operation = operation;
+ }
+
+ /**
+ * @param name
+ */
+ public AsyncOperation(QName name) {
+ super(name);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @return Returns the async.
+ */
+ public boolean isAsync() {
+ return _async;
+ }
+
+ public void setAsyncType(AsyncOperationType type) {
+ this._asyncOpType = type;
+ _async = true;
+ }
+
+ public AsyncOperationType getAsyncType(){
+ return _asyncOpType;
+ }
+
+ public void setResponseBean(AbstractType type){
+ _responseBean = type;
+ }
+
+ public AbstractType getResponseBeanType(){
+ return _responseBean;
+ }
+
+ public JavaType getResponseBeanJavaType(){
+ JCodeModel cm = _responseBean.getJavaType().getType().getType().owner();
+ if(_asyncOpType.equals(AsyncOperationType.CALLBACK)){
+ JClass future =
cm.ref(java.util.concurrent.Future.class).narrow(cm.ref(Object.class).wildcard());
+ return new JavaSimpleType(new JAXBTypeAndAnnotation(future));
+ }else if(_asyncOpType.equals(AsyncOperationType.POLLING)){
+ JClass polling =
cm.ref(javax.xml.ws.Response.class).narrow(_responseBean.getJavaType().getType().getType().boxify());
+ return new JavaSimpleType(new JAXBTypeAndAnnotation(polling));
+ }
+ return null;
+ }
+
+ public JavaType getCallBackType(){
+ if(_asyncOpType.equals(AsyncOperationType.CALLBACK)){
+ JCodeModel cm = _responseBean.getJavaType().getType().getType().owner();
+ JClass cb =
cm.ref(javax.xml.ws.AsyncHandler.class).narrow(_responseBean.getJavaType().getType().getType().boxify());
+ return new JavaSimpleType(new JAXBTypeAndAnnotation(cb));
+
+ }
+ return null;
+ }
+
+ public Operation getNormalOperation(){
+ return operation;
+ }
+
+ public void setNormalOperation(Operation operation){
+ this.operation = operation;
+ }
+
+ @Override public String getJavaMethodName() {
+ return super.getJavaMethodName() + "Async";
+ }
+
+ //Normal operation
+ private Operation operation;
+ private boolean _async;
+ private AsyncOperationType _asyncOpType;
+ private AbstractType _responseBean;
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/AsyncOperation.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/AsyncOperationType.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/AsyncOperationType.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/AsyncOperationType.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,39 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.model;
+
+
+
+/**
+ * @author Vivek Pandey
+ *
+ * Async Operation type
+ */
+public final class AsyncOperationType {
+
+ public static final AsyncOperationType POLLING = new AsyncOperationType();
+ public static final AsyncOperationType CALLBACK = new AsyncOperationType();
+
+ private AsyncOperationType() {
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/AsyncOperationType.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Block.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Block.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Block.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,88 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.model;
+
+import javax.xml.namespace.QName;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class Block extends ModelObject {
+
+ public static final int UNBOUND = 0;
+ public static final int BODY = 1;
+ public static final int HEADER = 2;
+ public static final int ATTACHMENT = 3;
+
+ public Block() {}
+
+ public Block(QName name) {
+ this.name = name;
+ }
+
+ public Block(QName name, AbstractType type) {
+ this.name = name;
+ this.type = type;
+ }
+
+ public QName getName() {
+ return name;
+ }
+
+ public void setName(QName n) {
+ name = n;
+ }
+
+ public AbstractType getType() {
+ return type;
+ }
+
+ public void setType(AbstractType type) {
+ this.type = type;
+ }
+
+ public int getLocation() {
+ return location;
+ }
+
+ public void setLocation(int i) {
+ location = i;
+ }
+
+ public void accept(ModelVisitor visitor) throws Exception {
+ visitor.visit(this);
+ }
+
+ private QName name;
+ private AbstractType type;
+ private int location;
+
+ /**
+ * @return true if the block is unbound
+ */
+ public boolean isUnbound() {
+ if(location == UNBOUND)
+ return true;
+ return false;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Block.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/ExtendedModelVisitor.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/ExtendedModelVisitor.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/ExtendedModelVisitor.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,134 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.model;
+
+import java.util.Iterator;
+
+/**
+ *
+ * A model visitor incorporating all the logic required to walk through the model.
+ *
+ * @author WS Development Team
+ */
+public class ExtendedModelVisitor {
+
+ public ExtendedModelVisitor() {}
+
+ public void visit(Model model) throws Exception {
+ preVisit(model);
+ for (Service service : model.getServices()) {
+ preVisit(service);
+ for (Port port : service.getPorts()) {
+ preVisit(port);
+ if (shouldVisit(port)) {
+ for (Operation operation : port.getOperations()) {
+ preVisit(operation);
+ Request request = operation.getRequest();
+ if (request != null) {
+ preVisit(request);
+ for (Iterator iter4 = request.getHeaderBlocks();
+ iter4.hasNext();) {
+
+ Block block = (Block) iter4.next();
+ visitHeaderBlock(block);
+ }
+ for (Iterator iter4 = request.getBodyBlocks();
+ iter4.hasNext();) {
+
+ Block block = (Block) iter4.next();
+ visitBodyBlock(block);
+ }
+ for (Iterator iter4 = request.getParameters();
+ iter4.hasNext();) {
+
+ Parameter parameter = (Parameter) iter4.next();
+ visit(parameter);
+ }
+ postVisit(request);
+ }
+
+ Response response = operation.getResponse();
+ if (response != null) {
+ preVisit(response);
+ for (Iterator iter4 = response.getHeaderBlocks();
+ iter4.hasNext();) {
+
+ Block block = (Block) iter4.next();
+ visitHeaderBlock(block);
+ }
+ for (Iterator iter4 = response.getBodyBlocks();
+ iter4.hasNext();) {
+
+ Block block = (Block) iter4.next();
+ visitBodyBlock(block);
+ }
+ for (Iterator iter4 = response.getParameters();
+ iter4.hasNext();) {
+
+ Parameter parameter = (Parameter) iter4.next();
+ visit(parameter);
+ }
+ postVisit(response);
+ }
+
+ for (Iterator iter4 = operation.getFaults();
+ iter4.hasNext();) {
+
+ Fault fault = (Fault) iter4.next();
+ preVisit(fault);
+ visitFaultBlock(fault.getBlock());
+ postVisit(fault);
+ }
+ postVisit(operation);
+ }
+ }
+ postVisit(port);
+ }
+ postVisit(service);
+ }
+ postVisit(model);
+ }
+
+ protected boolean shouldVisit(Port port) {
+ return true;
+ }
+
+ // these methods are intended for subclasses
+ protected void preVisit(Model model) throws Exception {}
+ protected void postVisit(Model model) throws Exception {}
+ protected void preVisit(Service service) throws Exception {}
+ protected void postVisit(Service service) throws Exception {}
+ protected void preVisit(Port port) throws Exception {}
+ protected void postVisit(Port port) throws Exception {}
+ protected void preVisit(Operation operation) throws Exception {}
+ protected void postVisit(Operation operation) throws Exception {}
+ protected void preVisit(Request request) throws Exception {}
+ protected void postVisit(Request request) throws Exception {}
+ protected void preVisit(Response response) throws Exception {}
+ protected void postVisit(Response response) throws Exception {}
+ protected void preVisit(Fault fault) throws Exception {}
+ protected void postVisit(Fault fault) throws Exception {}
+ protected void visitBodyBlock(Block block) throws Exception {}
+ protected void visitHeaderBlock(Block block) throws Exception {}
+ protected void visitFaultBlock(Block block) throws Exception {}
+ protected void visit(Parameter parameter) throws Exception {}
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/ExtendedModelVisitor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Fault.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Fault.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Fault.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,188 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.model;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.TreeSet;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.processor.generator.GeneratorUtil;
+import org.jboss.com.sun.tools.ws.processor.model.java.JavaException;
+
+import com.sun.codemodel.JClass;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class Fault extends ModelObject {
+
+ public Fault() {}
+
+ public Fault(String name) {
+ this.name = name;
+ parentFault = null;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String s) {
+ name = s;
+ }
+
+ public Block getBlock() {
+ return block;
+ }
+
+ public void setBlock(Block b) {
+ block = b;
+ }
+
+ public JavaException getJavaException() {
+ return javaException;
+ }
+
+ public void setJavaException(JavaException e) {
+ javaException = e;
+ }
+
+ public void accept(ModelVisitor visitor) throws Exception {
+ visitor.visit(this);
+ }
+
+ public Fault getParentFault() {
+ return parentFault;
+ }
+
+ public void setParentFault(Fault parentFault) {
+ if (this.parentFault != null &&
+ parentFault != null &&
+ !this.parentFault.equals(parentFault)) {
+
+ throw new ModelException("model.parent.fault.already.set",
+ new Object[] {
+ getName(),
+ this.parentFault.getName(),
+ parentFault.getName()
+ });
+ }
+ this.parentFault = parentFault;
+ }
+
+ public void addSubfault(Fault fault) {
+ subfaults.add(fault);
+ fault.setParentFault(this);
+ }
+
+ public Iterator getSubfaults() {
+ if (subfaults.size() == 0) {
+ return null;
+ }
+ return subfaults.iterator();
+ }
+
+ public Iterator getSortedSubfaults() {
+ Set sortedFaults = new TreeSet(new GeneratorUtil.FaultComparator());
+ sortedFaults.addAll(subfaults);
+ return sortedFaults.iterator();
+ }
+
+ /* serialization */
+ public Set getSubfaultsSet() {
+ return subfaults;
+ }
+
+ /* serialization */
+ public void setSubfaultsSet(Set s) {
+ subfaults = s;
+ }
+
+ public Iterator getAllFaults() {
+ Set allFaults = getAllFaultsSet();
+ if (allFaults.size() == 0) {
+ return null;
+ }
+ return allFaults.iterator();
+ }
+
+ public Set getAllFaultsSet() {
+ Set transSet = new HashSet();
+ Iterator iter = subfaults.iterator();
+ while (iter.hasNext()) {
+ transSet.addAll(((Fault)iter.next()).getAllFaultsSet());
+ }
+ transSet.addAll(subfaults);
+ return transSet;
+ }
+
+ public QName getElementName() {
+ return elementName;
+ }
+
+ public void setElementName(QName elementName) {
+ this.elementName = elementName;
+ }
+
+ public String getJavaMemberName() {
+ return javaMemberName;
+ }
+
+ public void setJavaMemberName(String javaMemberName) {
+ this.javaMemberName = javaMemberName;
+ }
+
+ /**
+ * @return Returns the wsdlFault.
+ */
+ public boolean isWsdlException() {
+ return wsdlException;
+ }
+ /**
+ * @param wsdlFault The wsdlFault to set.
+ */
+ public void setWsdlException(boolean wsdlFault) {
+ this.wsdlException = wsdlFault;
+ }
+
+ public void setExceptionClass(JClass ex){
+ exceptionClass = ex;
+ }
+
+ public JClass getExceptionClass(){
+ return exceptionClass;
+ }
+
+ private boolean wsdlException = true;
+ private String name;
+ private Block block;
+ private JavaException javaException;
+ private Fault parentFault;
+ private Set subfaults = new HashSet();
+ private QName elementName = null;
+ private String javaMemberName = null;
+ private JClass exceptionClass;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Fault.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/HeaderFault.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/HeaderFault.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/HeaderFault.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,53 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.model;
+
+import javax.xml.namespace.QName;
+
+public class HeaderFault extends Fault {
+
+ public HeaderFault() {}
+
+ public HeaderFault(String name) {
+ super(name);
+ }
+
+ public QName getMessage() {
+ return _message;
+ }
+
+ public void setMessage(QName message) {
+ _message = message;
+ }
+
+ public String getPart() {
+ return _part;
+ }
+
+ public void setPart(String part) {
+ _part = part;
+ }
+
+ private QName _message;
+ private String _part;
+}
+
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/HeaderFault.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Message.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Message.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Message.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,225 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.model;
+
+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 javax.xml.namespace.QName;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public abstract class Message extends ModelObject {
+
+ public void addBodyBlock(Block b) {
+ if (_bodyBlocks.containsKey(b.getName())) {
+ throw new ModelException("model.uniqueness");
+ }
+ _bodyBlocks.put(b.getName(), b);
+ b.setLocation(Block.BODY);
+ }
+
+ public Iterator<Block> getBodyBlocks() {
+ return _bodyBlocks.values().iterator();
+ }
+
+ public int getBodyBlockCount() {
+ return _bodyBlocks.size();
+ }
+
+ /* serialization */
+ public Map<QName, Block> getBodyBlocksMap() {
+ return _bodyBlocks;
+ }
+
+ /* serialization */
+ public void setBodyBlocksMap(Map<QName, Block> m) {
+ _bodyBlocks = m;
+ }
+
+ public boolean isBodyEmpty() {
+ return getBodyBlocks().hasNext();
+ }
+
+ public boolean isBodyEncoded() {
+ boolean isEncoded = false;
+ for (Iterator iter = getBodyBlocks(); iter.hasNext();) {
+ Block bodyBlock = (Block) iter.next();
+ if (bodyBlock.getType().isSOAPType()) {
+ isEncoded = true;
+ }
+ }
+ return isEncoded;
+ }
+
+ public void addHeaderBlock(Block b) {
+ if (_headerBlocks.containsKey(b.getName())) {
+ throw new ModelException("model.uniqueness");
+ }
+ _headerBlocks.put(b.getName(), b);
+ b.setLocation(Block.HEADER);
+ }
+
+ public Iterator<Block> getHeaderBlocks() {
+ return _headerBlocks.values().iterator();
+ }
+
+ public Collection<Block> getHeaderBlockCollection() {
+ return _headerBlocks.values();
+ }
+
+ public int getHeaderBlockCount() {
+ return _headerBlocks.size();
+ }
+
+ /* serialization */
+ public Map<QName, Block> getHeaderBlocksMap() {
+ return _headerBlocks;
+ }
+
+ /* serialization */
+ public void setHeaderBlocksMap(Map<QName, Block> m) {
+ _headerBlocks = m;
+ }
+
+ /** attachment block */
+ public void addAttachmentBlock(Block b) {
+ if (_attachmentBlocks.containsKey(b.getName())) {
+ throw new ModelException("model.uniqueness");
+ }
+ _attachmentBlocks.put(b.getName(), b);
+ b.setLocation(Block.ATTACHMENT);
+ }
+
+ public void addUnboundBlock(Block b) {
+ if (_unboundBlocks.containsKey(b.getName())) {
+ return;
+ }
+ _unboundBlocks.put(b.getName(), b);
+ b.setLocation(Block.UNBOUND);
+ }
+
+ public Iterator<Block> getUnboundBlocks() {
+ return _unboundBlocks.values().iterator();
+ }
+
+ /* serialization */
+ public Map<QName, Block> getUnboundBlocksMap() {
+ return _unboundBlocks;
+ }
+
+ public int getUnboundBlocksCount() {
+ return _unboundBlocks.size();
+ }
+
+ /* serialization */
+ public void setUnboundBlocksMap(Map<QName, Block> m) {
+ _unboundBlocks = m;
+ }
+
+
+ public Iterator<Block> getAttachmentBlocks() {
+ return _attachmentBlocks.values().iterator();
+ }
+
+ public int getAttachmentBlockCount () {
+ return _attachmentBlocks.size();
+ }
+
+ /* serialization */
+ public Map<QName, Block> getAttachmentBlocksMap() {
+ return _attachmentBlocks;
+ }
+
+ /* serialization */
+ public void setAttachmentBlocksMap(Map<QName, Block> m) {
+ _attachmentBlocks = m;
+ }
+
+ public void addParameter(Parameter p) {
+ if (_parametersByName.containsKey(p.getName())) {
+ throw new ModelException("model.uniqueness");
+ }
+ _parameters.add(p);
+ _parametersByName.put(p.getName(), p);
+ }
+
+ public Parameter getParameterByName(String name) {
+ if (_parametersByName.size() != _parameters.size()) {
+ initializeParametersByName();
+ }
+ return (Parameter) _parametersByName.get(name);
+ }
+
+ public Iterator<Parameter> getParameters() {
+ return _parameters.iterator();
+ }
+
+ /* serialization */
+ public List<Parameter> getParametersList() {
+ return _parameters;
+ }
+
+ /* serialization */
+ public void setParametersList(List<Parameter> l) {
+ _parameters = l;
+ }
+
+ private void initializeParametersByName() {
+ _parametersByName = new HashMap();
+ if (_parameters != null) {
+ for (Iterator iter = _parameters.iterator(); iter.hasNext();) {
+ Parameter param = (Parameter) iter.next();
+ if (param.getName() != null &&
+ _parametersByName.containsKey(param.getName())) {
+
+ throw new ModelException("model.uniqueness");
+ }
+ _parametersByName.put(param.getName(), param);
+ }
+ }
+ }
+
+ public Set<Block> getAllBlocks(){
+ Set<Block> blocks = new HashSet<Block>();
+ blocks.addAll(_bodyBlocks.values());
+ blocks.addAll(_headerBlocks.values());
+ blocks.addAll(_attachmentBlocks.values());
+ return blocks;
+ }
+
+ private Map<QName, Block> _attachmentBlocks = new HashMap<QName,
Block>();
+ private Map<QName, Block> _bodyBlocks = new HashMap<QName, Block>();
+ private Map<QName, Block> _headerBlocks = new HashMap<QName, Block>();
+ private Map<QName, Block> _unboundBlocks = new HashMap<QName, Block>();
+ private List<Parameter> _parameters = new ArrayList<Parameter>();
+ private Map<String, Parameter> _parametersByName = new HashMap<String,
Parameter>();
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Message.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Model.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Model.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Model.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,187 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.model;
+
+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;
+import java.util.EnumSet;
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.processor.ProcessorActionVersion;
+import org.jboss.com.sun.tools.ws.processor.model.jaxb.JAXBModel;
+
+
+/**
+ * The model is used to represent the entire Web Service. The JAX-WS ProcessorActions
can process
+ * this Model to generate Java artifacts such as the service interface.
+ *
+ * @author WS Development Team
+ */
+public class Model extends ModelObject {
+
+ public Model() {
+ }
+
+ public Model(QName name) {
+ this.name = name;
+ }
+
+ public QName getName() {
+ return name;
+ }
+
+ public void setName(QName n) {
+ name = n;
+ }
+
+ public String getTargetNamespaceURI() {
+ return targetNamespace;
+ }
+
+ public void setTargetNamespaceURI(String s) {
+ targetNamespace = s;
+ }
+
+ public void addService(Service service) {
+ if (servicesByName.containsKey(service.getName())) {
+ throw new ModelException("model.uniqueness");
+ }
+ services.add(service);
+ servicesByName.put(service.getName(), service);
+ }
+
+ public Service getServiceByName(QName name) {
+ if (servicesByName.size() != services.size()) {
+ initializeServicesByName();
+ }
+ return (Service)servicesByName.get(name);
+ }
+
+ /* serialization */
+ public List<Service> getServices() {
+ return services;
+ }
+
+ /* serialization */
+ public void setServices(List<Service> l) {
+ services = l;
+ }
+
+ private void initializeServicesByName() {
+ servicesByName = new HashMap();
+ if (services != null) {
+ for (Service service : services) {
+ if (service.getName() != null &&
+ servicesByName.containsKey(service.getName())) {
+
+ throw new ModelException("model.uniqueness");
+ }
+ servicesByName.put(service.getName(), service);
+ }
+ }
+ }
+
+ public void addExtraType(AbstractType type) {
+ extraTypes.add(type);
+ }
+
+ public Iterator getExtraTypes() {
+ return extraTypes.iterator();
+ }
+
+ /* serialization */
+ public Set<AbstractType> getExtraTypesSet() {
+ return extraTypes;
+ }
+
+ /* serialization */
+ public void setExtraTypesSet(Set<AbstractType> s) {
+ extraTypes = s;
+ }
+
+
+ public void accept(ModelVisitor visitor) throws Exception {
+ visitor.visit(this);
+ }
+
+ /**
+ * @return the source version
+ */
+ public String getSource() {
+ return source;
+ }
+
+ /**
+ * @param string
+ */
+ public void setSource(String string) {
+ source = string;
+ }
+
+ public ProcessorActionVersion getProcessorActionVersion(){
+ return processorActionVersion;
+ }
+
+ public void setProcessorActionVersion(ProcessorActionVersion version){
+ this.processorActionVersion = version;
+ }
+
+ public void setProcessorActionVersion(String version){
+ for(ProcessorActionVersion paVersion :
EnumSet.allOf(ProcessorActionVersion.class)){
+ switch(paVersion){
+ case PRE_20:
+ if(version.equals(ProcessorActionVersion.PRE_20.toString()))
+ processorActionVersion = ProcessorActionVersion.PRE_20;
+ break;
+ case VERSION_20:
+ if(version.equals(ProcessorActionVersion.VERSION_20.toString()))
+ processorActionVersion = ProcessorActionVersion.VERSION_20;
+ break;
+ default:
+ throw new
ModelException("model.invalid.processorActionVersion", new Object[]{version});
+ }
+ }
+ }
+
+ public void setJAXBModel(JAXBModel jaxBModel) {
+ this.jaxBModel = jaxBModel;
+ }
+
+ public JAXBModel getJAXBModel() {
+ return jaxBModel;
+ }
+
+ private QName name;
+ private String targetNamespace;
+ private List<Service> services = new ArrayList<Service>();
+ private Map<QName, Service> servicesByName = new HashMap<QName,
Service>();
+ private Set<AbstractType> extraTypes = new HashSet<AbstractType>();
+ private String source;
+ private JAXBModel jaxBModel = null;
+ private ProcessorActionVersion processorActionVersion =
ProcessorActionVersion.VERSION_20;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Model.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/ModelException.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/ModelException.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/ModelException.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,54 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.model;
+
+import org.jboss.com.sun.tools.ws.processor.ProcessorException;
+import org.jboss.com.sun.xml.ws.util.localization.Localizable;
+
+
+/**
+ * ModelException represents an exception that occurred while
+ * visiting service model.
+ *
+ * @see ProcessorException
+ *
+ * @author WS Development Team
+ */
+public class ModelException extends ProcessorException {
+
+ public ModelException(String key, Object... args) {
+ super(key, args);
+ }
+
+ public ModelException(Throwable throwable) {
+ super(throwable);
+ }
+
+ public ModelException(Localizable arg) {
+ super("model.nestedModelError", arg);
+ }
+
+ public String getResourceBundleName() {
+ return "org.jboss.com.sun.tools.ws.resources.model";
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/ModelException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/ModelObject.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/ModelObject.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/ModelObject.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,93 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.model;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.jboss.com.sun.xml.ws.util.NullIterator;
+
+
+/**
+ *
+ * @author WS Development Team
+ */
+public abstract class ModelObject {
+
+ public abstract void accept(ModelVisitor visitor) throws Exception;
+
+ public Object getProperty(String key) {
+ if (_properties == null) {
+ return null;
+ }
+ return _properties.get(key);
+ }
+
+ public void setProperty(String key, Object value) {
+ if (value == null) {
+ removeProperty(key);
+ return;
+ }
+
+ if (_properties == null) {
+ _properties = new HashMap();
+ }
+ _properties.put(key, value);
+ }
+
+ public void removeProperty(String key) {
+ if (_properties != null) {
+ _properties.remove(key);
+ }
+ }
+
+ public Iterator getProperties() {
+ if (_properties == null) {
+ return NullIterator.getInstance();
+ } else {
+ return _properties.keySet().iterator();
+ }
+ }
+
+ /* serialization */
+ public Map getPropertiesMap() {
+ return _properties;
+ }
+
+ /* serialization */
+ public void setPropertiesMap(Map m) {
+ _properties = m;
+ }
+
+ public String getJavaDoc() {
+ return javaDoc;
+ }
+
+ public void setJavaDoc(String javaDoc) {
+ this.javaDoc = javaDoc;
+ }
+
+ private String javaDoc;
+ private Map _properties;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/ModelObject.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/ModelProperties.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/ModelProperties.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/ModelProperties.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,73 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.model;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public interface ModelProperties {
+
+ //to set WSDL_MODELER_NAME from inside WSDLModeler
+ public static final String WSDL_MODELER_NAME =
+ "org.jboss.com.sun.xml.ws.processor.modeler.wsdl.WSDLModeler";
+ public static final String PROPERTY_PARAM_MESSAGE_PART_NAME =
+ "org.jboss.com.sun.xml.ws.processor.model.ParamMessagePartName";
+ public static final String PROPERTY_ANONYMOUS_TYPE_NAME =
+ "org.jboss.com.sun.xml.ws.processor.model.AnonymousTypeName";
+ public static final String PROPERTY_ANONYMOUS_ARRAY_TYPE_NAME =
+ "org.jboss.com.sun.xml.ws.processor.model.AnonymousArrayTypeName";
+ public static final String PROPERTY_ANONYMOUS_ARRAY_JAVA_TYPE =
+ "org.jboss.com.sun.xml.ws.processor.model.AnonymousArrayJavaType";
+
+ public static final String PROPERTY_PTIE_CLASS_NAME =
+ "org.jboss.com.sun.xml.ws.processor.model.PtieClassName";
+ public static final String PROPERTY_EPTFF_CLASS_NAME =
+ "org.jboss.com.sun.xml.ws.processor.model.EPTFFClassName";
+ public static final String PROPERTY_SED_CLASS_NAME =
+ "org.jboss.com.sun.xml.ws.processor.model.SEDClassName";
+ public static final String PROPERTY_WSDL_PORT_NAME =
+ "org.jboss.com.sun.xml.ws.processor.model.WSDLPortName";
+ public static final String PROPERTY_WSDL_PORT_TYPE_NAME =
+ "org.jboss.com.sun.xml.ws.processor.model.WSDLPortTypeName";
+ public static final String PROPERTY_WSDL_BINDING_NAME =
+ "org.jboss.com.sun.xml.ws.processor.model.WSDLBindingName";
+ public static final String PROPERTY_WSDL_MESSAGE_NAME =
+ "org.jboss.com.sun.xml.ws.processor.model.WSDLMessageName";
+ public static final String PROPERTY_MODELER_NAME =
+ "org.jboss.com.sun.xml.ws.processor.model.ModelerName";
+ public static final String PROPERTY_STUB_CLASS_NAME =
+ "org.jboss.com.sun.xml.ws.processor.model.StubClassName";
+ public static final String PROPERTY_STUB_OLD_CLASS_NAME =
+ "org.jboss.com.sun.xml.ws.processor.model.StubOldClassName";
+ public static final String PROPERTY_DELEGATE_CLASS_NAME =
+ "org.jboss.com.sun.xml.ws.processor.model.DelegateClassName";
+ public static final String PROPERTY_CLIENT_ENCODER_DECODER_CLASS_NAME =
+ "org.jboss.com.sun.xml.ws.processor.model.ClientEncoderClassName";
+ public static final String PROPERTY_CLIENT_CONTACTINFOLIST_CLASS_NAME =
+
"org.jboss.com.sun.xml.ws.processor.model.ClientContactInfoListClassName";
+ public static final String PROPERTY_TIE_CLASS_NAME =
+ "org.jboss.com.sun.xml.ws.processor.model.TieClassName";
+ public static final String PROPERTY_JAVA_PORT_NAME =
+ "org.jboss.com.sun.xml.ws.processor.model.JavaPortName";
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/ModelProperties.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/ModelVisitor.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/ModelVisitor.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/ModelVisitor.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,39 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.model;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public interface ModelVisitor {
+ public void visit(Model model) throws Exception;
+ public void visit(Service service) throws Exception;
+ public void visit(Port port) throws Exception;
+ public void visit(Operation operation) throws Exception;
+ public void visit(Request request) throws Exception;
+ public void visit(Response response) throws Exception;
+ public void visit(Fault fault) throws Exception;
+ public void visit(Block block) throws Exception;
+ public void visit(Parameter parameter) throws Exception;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/ModelVisitor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Operation.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Operation.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Operation.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,241 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.model;
+
+import com.sun.xml.bind.api.JAXBRIContext;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.processor.model.java.JavaMethod;
+import org.jboss.com.sun.tools.ws.wsdl.document.soap.SOAPStyle;
+import org.jboss.com.sun.tools.ws.wsdl.document.soap.SOAPUse;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class Operation extends ModelObject {
+
+ public Operation() {}
+
+ public Operation(Operation operation){
+ this(operation._name);
+ this._style = operation._style;
+ this._use = operation._use;
+ this.customizedName = operation.customizedName;
+ }
+ public Operation(QName name) {
+ _name = name;
+ _uniqueName = name.getLocalPart();
+ _faultNames = new HashSet<String>();
+ _faults = new HashSet<Fault>();
+ }
+
+ public QName getName() {
+ return _name;
+ }
+
+ public void setName(QName n) {
+ _name = n;
+ }
+
+ public String getUniqueName() {
+ return _uniqueName;
+ }
+
+ public void setUniqueName(String s) {
+ _uniqueName = s;
+ }
+
+ public Request getRequest() {
+ return _request;
+ }
+
+ public void setRequest(Request r) {
+ _request = r;
+ }
+
+ public Response getResponse() {
+ return _response;
+ }
+
+ public void setResponse(Response r) {
+ _response = r;
+ }
+
+ public boolean isOverloaded() {
+ return !_name.getLocalPart().equals(_uniqueName);
+ }
+
+ public void addFault(Fault f) {
+ if (_faultNames.contains(f.getName())) {
+ throw new ModelException("model.uniqueness");
+ }
+ _faultNames.add(f.getName());
+ _faults.add(f);
+ }
+
+ public Iterator<Fault> getFaults() {
+ return _faults.iterator();
+ }
+
+ public Set<Fault> getFaultsSet() {
+ return _faults;
+ }
+
+ /* serialization */
+ public void setFaultsSet(Set<Fault> s) {
+ _faults = s;
+ initializeFaultNames();
+ }
+
+ private void initializeFaultNames() {
+ _faultNames = new HashSet<String>();
+ if (_faults != null) {
+ for (Iterator iter = _faults.iterator(); iter.hasNext();) {
+ Fault f = (Fault) iter.next();
+ if (f.getName() != null && _faultNames.contains(f.getName())) {
+ throw new ModelException("model.uniqueness");
+ }
+ _faultNames.add(f.getName());
+ }
+ }
+ }
+
+ public Iterator<Fault> getAllFaults() {
+ Set<Fault> allFaults = getAllFaultsSet();
+ return allFaults.iterator();
+ }
+
+ public Set<Fault> getAllFaultsSet() {
+ Set transSet = new HashSet();
+ transSet.addAll(_faults);
+ Iterator iter = _faults.iterator();
+ Fault fault;
+ Set tmpSet;
+ while (iter.hasNext()) {
+ tmpSet = ((Fault)iter.next()).getAllFaultsSet();
+ transSet.addAll(tmpSet);
+ }
+ return transSet;
+ }
+
+ public int getFaultCount() {
+ return _faults.size();
+ }
+
+ public Set<Block> getAllFaultBlocks(){
+ Set<Block> blocks = new HashSet<Block>();
+ Iterator faults = _faults.iterator();
+ while(faults.hasNext()){
+ Fault f = (Fault)faults.next();
+ blocks.add(f.getBlock());
+ }
+ return blocks;
+ }
+
+ public JavaMethod getJavaMethod() {
+ return _javaMethod;
+ }
+
+ public void setJavaMethod(JavaMethod i) {
+ _javaMethod = i;
+ }
+
+ public String getSOAPAction() {
+ return _soapAction;
+ }
+
+ public void setSOAPAction(String s) {
+ _soapAction = s;
+ }
+
+ public SOAPStyle getStyle() {
+ return _style;
+ }
+
+ public void setStyle(SOAPStyle s) {
+ _style = s;
+ }
+
+ public SOAPUse getUse() {
+ return _use;
+ }
+
+ public void setUse(SOAPUse u) {
+ _use = u;
+ }
+
+ public boolean isWrapped() {
+ return _isWrapped;
+ }
+
+ public void setWrapped(boolean isWrapped) {
+ _isWrapped = isWrapped;
+ }
+
+
+ public void accept(ModelVisitor visitor) throws Exception {
+ visitor.visit(this);
+ }
+
+ public void setCustomizedName(String name){
+ this.customizedName = name;
+ }
+
+ public String getCustomizedName(){
+ return customizedName;
+ }
+
+ public String getJavaMethodName(){
+ //if JavaMethod is created return the name
+ if(_javaMethod != null){
+ return _javaMethod.getName();
+ }
+
+ //return the customized operation name if any without mangling
+ if(customizedName != null){
+ return customizedName;
+ }
+
+ return JAXBRIContext.mangleNameToVariableName(_name.getLocalPart());
+ }
+
+ private String customizedName;
+ private boolean _isWrapped = true;
+ private QName _name;
+ private String _uniqueName;
+ private Request _request;
+ private Response _response;
+ private JavaMethod _javaMethod;
+ private String _soapAction;
+ private SOAPStyle _style = SOAPStyle.DOCUMENT;
+ private SOAPUse _use = SOAPUse.LITERAL;
+ private Set<String> _faultNames;
+ private Set<Fault> _faults;
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Operation.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Parameter.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Parameter.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Parameter.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,176 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.com.sun.tools.ws.processor.model.java.JavaParameter;
+import org.jboss.com.sun.xml.ws.model.Mode;
+
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class Parameter extends ModelObject {
+
+ public Parameter() {}
+
+ public Parameter(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String s) {
+ name = s;
+ }
+
+ public JavaParameter getJavaParameter() {
+ return javaParameter;
+ }
+
+ public void setJavaParameter(JavaParameter p) {
+ javaParameter = p;
+ }
+
+ public AbstractType getType() {
+ return type;
+ }
+
+ public void setType(AbstractType t) {
+ type = t;
+ }
+
+ public String getTypeName() {
+ return typeName;
+ }
+
+ public void setTypeName(String t) {
+ typeName = t;
+ }
+
+ public Block getBlock() {
+ return block;
+ }
+
+ public void setBlock(Block d) {
+ block = d;
+ }
+
+ public Parameter getLinkedParameter() {
+ return link;
+ }
+
+ public void setLinkedParameter(Parameter p) {
+ link = p;
+ }
+
+ public boolean isEmbedded() {
+ return embedded;
+ }
+
+ public void setEmbedded(boolean b) {
+ embedded = b;
+ }
+
+ public void accept(ModelVisitor visitor) throws Exception {
+ visitor.visit(this);
+ }
+
+ private String name;
+ private JavaParameter javaParameter;
+ private AbstractType type;
+ private Block block;
+ private Parameter link;
+ private boolean embedded;
+ private String typeName;
+ private String customName;
+ private Mode mode;
+
+ public int getParameterIndex() {
+ return parameterOrderPosition;
+ }
+
+ public void setParameterIndex(int parameterOrderPosition) {
+ this.parameterOrderPosition = parameterOrderPosition;
+ }
+
+ public boolean isReturn(){
+ return (parameterOrderPosition == -1);
+ }
+
+ // 0 is the first parameter, -1 is the return type
+ private int parameterOrderPosition;
+ /**
+ * @return Returns the customName.
+ */
+ public String getCustomName() {
+ return customName;
+ }
+ /**
+ * @param customName The customName to set.
+ */
+ public void setCustomName(String customName) {
+ this.customName = customName;
+ }
+
+ private List<String> annotations = new ArrayList<String>();
+
+ /**
+ * @return Returns the annotations.
+ */
+ public List<String> getAnnotations() {
+ return annotations;
+ }
+
+
+ /**
+ * @param annotations The annotations to set.
+ */
+ public void setAnnotations(List<String> annotations) {
+ this.annotations = annotations;
+ }
+
+ public void setMode(Mode mode){
+ this.mode = mode;
+ }
+
+ public boolean isIN(){
+ return (mode == Mode.IN);
+ }
+
+ public boolean isOUT(){
+ return (mode == Mode.OUT);
+ }
+
+ public boolean isINOUT(){
+ return (mode == Mode.INOUT);
+ }
+
+
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Parameter.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Port.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Port.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Port.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,208 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.model;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.processor.config.HandlerChainInfo;
+import org.jboss.com.sun.tools.ws.processor.model.java.JavaInterface;
+import org.jboss.com.sun.tools.ws.wsdl.document.soap.SOAPStyle;
+import org.jboss.com.sun.tools.ws.wsdl.document.soap.SOAPUse;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPVersion;
+
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class Port extends ModelObject {
+
+ public Port() {}
+
+ public Port(QName name) {
+ _name = name;
+ }
+
+ public QName getName() {
+ return _name;
+ }
+
+ public void setName(QName n) {
+ _name = n;
+ }
+
+ public void addOperation(Operation operation) {
+ _operations.add(operation);
+ operationsByName.put(operation.getUniqueName(), operation);
+ }
+
+ public Operation getOperationByUniqueName(String name) {
+ if (operationsByName.size() != _operations.size()) {
+ initializeOperationsByName();
+ }
+ return (Operation)operationsByName.get(name);
+ }
+
+ private void initializeOperationsByName() {
+ operationsByName = new HashMap();
+ if (_operations != null) {
+ for (Operation operation : _operations) {
+ if (operation.getUniqueName() != null &&
+ operationsByName.containsKey(operation.getUniqueName())) {
+
+ throw new ModelException("model.uniqueness");
+ }
+ operationsByName.put(operation.getUniqueName(), operation);
+ }
+ }
+ }
+
+ /* serialization */
+ public List<Operation> getOperations() {
+ return _operations;
+ }
+
+ /* serialization */
+ public void setOperations(List<Operation> l) {
+ _operations = l;
+ }
+
+ public JavaInterface getJavaInterface() {
+ return _javaInterface;
+ }
+
+ public void setJavaInterface(JavaInterface i) {
+ _javaInterface = i;
+ }
+
+ public String getAddress() {
+ return _address;
+ }
+
+ public void setAddress(String s) {
+ _address = s;
+ }
+
+ public HandlerChainInfo getClientHandlerChainInfo() {
+ if (_clientHandlerChainInfo == null) {
+ _clientHandlerChainInfo = new HandlerChainInfo();
+ }
+ return _clientHandlerChainInfo;
+ }
+
+ public void setClientHandlerChainInfo(HandlerChainInfo i) {
+ _clientHandlerChainInfo = i;
+ }
+
+ public HandlerChainInfo getServerHandlerChainInfo() {
+ if (_serverHandlerChainInfo == null) {
+ _serverHandlerChainInfo = new HandlerChainInfo();
+ }
+ return _serverHandlerChainInfo;
+ }
+
+ public void setServerHandlerChainInfo(HandlerChainInfo i) {
+ _serverHandlerChainInfo = i;
+ }
+
+ public SOAPVersion getSOAPVersion() {
+ return _soapVersion;
+ }
+
+ public void setSOAPVersion(SOAPVersion soapVersion) {
+ _soapVersion = soapVersion;
+ }
+
+ public String getServiceImplName() {
+ return _serviceImplName;
+ }
+
+ public void setServiceImplName(String name) {
+ _serviceImplName = name;
+ }
+
+ public void accept(ModelVisitor visitor) throws Exception {
+ visitor.visit(this);
+ }
+
+ public boolean isProvider() {
+ JavaInterface intf = getJavaInterface();
+ if (intf != null) {
+ String sei = intf.getName();
+ if (sei.equals(javax.xml.ws.Provider.class.getName())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * XYZ_Service.getABC() method name
+ * @return Returns the portGetterName.
+ */
+ public String getPortGetter() {
+ return portGetter;
+ }
+
+ /**
+ * @param portGetterName The portGetterName to set.
+ */
+ public void setPortGetter(String portGetterName) {
+ this.portGetter = portGetterName;
+ }
+
+ public SOAPStyle getStyle() {
+ return _style;
+ }
+
+ public void setStyle(SOAPStyle s) {
+ _style = s;
+ }
+
+ public boolean isWrapped() {
+ return _isWrapped;
+ }
+
+ public void setWrapped(boolean isWrapped) {
+ _isWrapped = isWrapped;
+ }
+
+ private SOAPStyle _style = null;
+ private boolean _isWrapped = true;
+
+ private String portGetter;
+ private QName _name;
+ private List<Operation> _operations = new ArrayList();
+ private JavaInterface _javaInterface;
+ private String _address;
+ private String _serviceImplName;
+ private Map operationsByName = new HashMap();
+ private HandlerChainInfo _clientHandlerChainInfo;
+ private HandlerChainInfo _serverHandlerChainInfo;
+ private SOAPVersion _soapVersion = SOAPVersion.SOAP_11;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Port.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Request.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Request.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Request.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,36 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.model;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class Request extends Message {
+
+ public Request() {}
+
+ public void accept(ModelVisitor visitor) throws Exception {
+ visitor.visit(this);
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Request.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Response.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Response.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Response.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,66 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.model;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class Response extends Message {
+
+ public Response() {}
+
+ public void addFaultBlock(Block b) {
+ if (_faultBlocks.containsKey(b.getName())) {
+ throw new ModelException("model.uniqueness");
+ }
+ _faultBlocks.put(b.getName(), b);
+ }
+
+ public Iterator getFaultBlocks() {
+ return _faultBlocks.values().iterator();
+ }
+
+ public int getFaultBlockCount () {
+ return _faultBlocks.size();
+ }
+
+ /* serialization */
+ public Map getFaultBlocksMap() {
+ return _faultBlocks;
+ }
+
+ public void setFaultBlocksMap(Map m) {
+ _faultBlocks = m;
+ }
+
+ public void accept(ModelVisitor visitor) throws Exception {
+ visitor.visit(this);
+ }
+
+ private Map _faultBlocks = new HashMap();
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Response.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Service.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Service.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Service.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,119 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.model;
+
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.processor.model.java.JavaInterface;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class Service extends ModelObject {
+
+ public Service() {}
+
+ public Service(QName name, JavaInterface javaInterface) {
+ this.name = name;
+ this.javaInterface = javaInterface;
+ }
+
+ public QName getName() {
+ return name;
+ }
+
+ public void setName(QName n) {
+ name = n;
+ }
+
+ public void addPort(Port port) {
+ if (portsByName.containsKey(port.getName())) {
+ throw new ModelException("model.uniqueness");
+ }
+ ports.add(port);
+ portsByName.put(port.getName(), port);
+ }
+
+
+ public Port getPortByName(QName n) {
+ if (portsByName.size() != ports.size()) {
+ initializePortsByName();
+ }
+ return (Port) portsByName.get(n);
+ }
+
+ /* serialization */
+ public List<Port> getPorts() {
+ return ports;
+ }
+
+ /* serialization */
+ public void setPorts(List<Port> m) {
+ ports = m;
+// initializePortsByName();
+ }
+
+ private void initializePortsByName() {
+ portsByName = new HashMap();
+ if (ports != null) {
+ for (Iterator iter = ports.iterator(); iter.hasNext();) {
+ Port port = (Port) iter.next();
+ if (port.getName() != null &&
+ portsByName.containsKey(port.getName())) {
+
+ throw new ModelException("model.uniqueness");
+ }
+ portsByName.put(port.getName(), port);
+ }
+ }
+ }
+
+ public JavaInterface getJavaIntf() {
+ return getJavaInterface();
+ }
+
+ public JavaInterface getJavaInterface() {
+ return javaInterface;
+ }
+
+ public void setJavaInterface(JavaInterface i) {
+ javaInterface = i;
+ }
+
+ public void accept(ModelVisitor visitor) throws Exception {
+ visitor.visit(this);
+ }
+
+ private QName name;
+ private List<Port> ports = new ArrayList();
+ private Map<QName, Port> portsByName = new HashMap<QName, Port>();
+ private JavaInterface javaInterface;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/Service.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/exporter/ExternalObject.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/exporter/ExternalObject.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/exporter/ExternalObject.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,44 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.model.exporter;
+
+import org.xml.sax.ContentHandler;
+
+/**
+ * "Opaque" object in the object graph that knows how
+ * to persist itself to XML.
+ *
+ * TODO: ExternalObjectReader
+ *
+ */
+public interface ExternalObject {
+ /**
+ * Type name of this object. This will be used
+ * when loading the object back from XML.
+ */
+ String getType();
+
+ /**
+ * Saves the object into XML.
+ */
+ void saveTo(ContentHandler receiver);
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/exporter/ExternalObject.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaArrayType.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaArrayType.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaArrayType.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,74 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.model.java;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class JavaArrayType extends JavaType {
+
+ public JavaArrayType() {
+ }
+
+ public JavaArrayType(String name) {
+ super(name, true, "null");
+ }
+
+ public JavaArrayType(String name, String elementName,
+ JavaType elementType) {
+
+ super(name, true, "null");
+ this.elementName = elementName;
+ this.elementType = elementType;
+ }
+
+ public String getElementName() {
+ return elementName;
+ }
+
+ public void setElementName(String name) {
+ elementName = name;
+ }
+
+ public JavaType getElementType() {
+ return elementType;
+ }
+
+ public void setElementType(JavaType type) {
+ elementType = type;
+ }
+
+ // bug fix:4904604
+ public String getSOAPArrayHolderName() {
+ return soapArrayHolderName;
+ }
+
+ public void setSOAPArrayHolderName(String holderName) {
+ this.soapArrayHolderName = holderName;
+ }
+
+ private String elementName;
+ private JavaType elementType;
+ private String soapArrayHolderName;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaArrayType.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaException.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaException.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaException.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,36 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.model.java;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class JavaException extends JavaStructureType {
+
+ public JavaException() {}
+
+ public JavaException(String name, boolean present, Object owner) {
+ super(name, present, owner);
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaInterface.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaInterface.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaInterface.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,165 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.model.java;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.jboss.com.sun.tools.ws.processor.model.ModelException;
+import org.jboss.com.sun.tools.ws.util.ClassNameInfo;
+
+
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class JavaInterface {
+
+ public JavaInterface() {}
+
+ public JavaInterface(String name) {
+ this(name, null);
+ }
+
+ public JavaInterface(String name, String impl) {
+ this.realName = name;
+ this.name = name.replace('$', '.');
+ this.impl = impl;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getFormalName() {
+ return name;
+ }
+
+ public void setFormalName(String s) {
+ name = s;
+ }
+
+ public String getRealName() {
+ return realName;
+ }
+
+ public void setRealName(String s) {
+ realName = s;
+ }
+
+ public String getImpl() {
+ return impl;
+ }
+
+ public void setImpl(String s) {
+ impl = s;
+ }
+
+ public Iterator getMethods() {
+ return methods.iterator();
+ }
+
+ public boolean hasMethod(JavaMethod method) {
+ for (int i=0; i<methods.size();i++) {
+ if (method.equals(((JavaMethod)methods.get(i)))) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public void addMethod(JavaMethod method) {
+
+ if (hasMethod(method)) {
+ throw new ModelException("model.uniqueness");
+ }
+ methods.add(method);
+ }
+
+ /* serialization */
+ public List getMethodsList() {
+ return methods;
+ }
+
+ /* serialization */
+ public void setMethodsList(List l) {
+ methods = l;
+ }
+
+ public boolean hasInterface(String interfaceName) {
+ for (int i=0; i<interfaces.size();i++) {
+ if (interfaceName.equals((String)interfaces.get(i))) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public void addInterface(String interfaceName) {
+
+ // verify that an exception with this name does not already exist
+ if (hasInterface(interfaceName)) {
+ return;
+ }
+ interfaces.add(interfaceName);
+ }
+
+ public Iterator getInterfaces() {
+ return interfaces.iterator();
+ }
+
+ /* serialization */
+ public List getInterfacesList() {
+ return interfaces;
+ }
+
+ /* serialization */
+ public void setInterfacesList(List l) {
+ interfaces = l;
+ }
+
+ public String getSimpleName() {
+ return ClassNameInfo.getName(name);
+ }
+
+ /* NOTE - all these fields (except "interfaces") were final, but had to
+ * remove this modifier to enable serialization
+ */
+ private String javadoc;
+
+ public String getJavaDoc() {
+ return javadoc;
+ }
+
+ public void setJavaDoc(String javadoc) {
+ this.javadoc = javadoc;
+ }
+
+ private String name;
+ private String realName;
+ private String impl;
+ private List methods = new ArrayList();
+ private List interfaces = new ArrayList();
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaInterface.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaMethod.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaMethod.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaMethod.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,167 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.model.java;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.jboss.com.sun.tools.ws.processor.model.ModelException;
+
+import com.sun.codemodel.JClass;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class JavaMethod {
+
+ public JavaMethod() {}
+
+ public JavaMethod(String name) {
+ this.name = name;
+ this.returnType = null;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public JavaType getReturnType() {
+ return returnType;
+ }
+
+ public void setReturnType(JavaType returnType) {
+ this.returnType = returnType;
+ }
+
+ public boolean hasParameter(String paramName) {
+ for (int i=0; i<parameters.size();i++) {
+ if (paramName.equals(
+ ((JavaParameter)parameters.get(i)).getName())) {
+
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public void addParameter(JavaParameter param) {
+ // verify that this member does not already exist
+ if (hasParameter(param.getName())) {
+ throw new ModelException("model.uniqueness");
+ }
+ parameters.add(param);
+ }
+
+ public JavaParameter getParameter(String paramName){
+ for (int i=0; i<parameters.size();i++) {
+ JavaParameter jParam = parameters.get(i);
+ if (paramName.equals(jParam.getParameter().getName())) {
+ return jParam;
+ }
+ }
+ return null;
+ }
+
+ public Iterator<JavaParameter> getParameters() {
+ return parameters.iterator();
+ }
+
+ public int getParameterCount() {
+ return parameters.size();
+ }
+
+ /* serialization */
+ public List<JavaParameter> getParametersList() {
+ return parameters;
+ }
+
+ /* serialization */
+ public void setParametersList(List<JavaParameter> l) {
+ parameters = l;
+ }
+
+ public boolean hasException(String exception) {
+ return exceptions.contains(exception);
+ }
+
+ public void addException(String exception) {
+
+ // verify that this exception does not already exist
+ if (hasException(exception)) {
+ throw new ModelException("model.uniqueness");
+ }
+ exceptions.add(exception);
+ }
+
+ public Iterator getExceptions() {
+ return exceptions.iterator();
+ }
+
+ /* serialization */
+ public List getExceptionsList() {
+ return exceptions;
+ }
+
+ /* serialization */
+ public void setExceptionsList(List l) {
+ exceptions = l;
+ }
+
+ public String getDeclaringClass() {
+ return declaringClass;
+ }
+ public void setDeclaringClass(String declaringClass) {
+ this.declaringClass = declaringClass;
+ }
+
+ // TODO fix model importer/exporter to handle this
+ public boolean getThrowsRemoteException() {
+ return throwsRemoteException;
+ }
+ public void setThrowsRemoteException(boolean throwsRemoteException) {
+ this.throwsRemoteException = throwsRemoteException;
+ }
+
+ public void addExceptionClass(JClass ex){
+ exceptionClasses.add(ex);
+ }
+
+ public List<JClass> getExceptionClasses(){
+ return exceptionClasses;
+ }
+
+ private String name;
+ private List<JavaParameter> parameters = new ArrayList<JavaParameter>();
+ private List<String> exceptions = new ArrayList<String>();
+ private List<JClass> exceptionClasses = new ArrayList<JClass>();
+
+ private JavaType returnType;
+ private String declaringClass;
+ private boolean throwsRemoteException = true;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaMethod.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaParameter.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaParameter.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaParameter.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,93 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.model.java;
+
+import org.jboss.com.sun.tools.ws.processor.model.Parameter;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class JavaParameter {
+
+ public JavaParameter() {}
+
+ public JavaParameter(String name, JavaType type, Parameter parameter) {
+ this(name, type, parameter, false);
+ }
+
+ public JavaParameter(String name, JavaType type, Parameter parameter,
+ boolean holder) {
+
+ this.name = name;
+ this.type = type;
+ this.parameter = parameter;
+ this.holder = holder;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String s) {
+ name = s;
+ }
+
+ public JavaType getType() {
+ return type;
+ }
+
+ public void setType(JavaType t) {
+ type = t;
+ }
+
+ public Parameter getParameter() {
+ return parameter;
+ }
+
+ public void setParameter(Parameter p) {
+ parameter = p;
+ }
+
+ public boolean isHolder() {
+ return holder;
+ }
+
+ public void setHolder(boolean b) {
+ holder = b;
+ }
+
+ public String getHolderName() {
+ return holderName;
+ }
+
+ public void setHolderName(String holderName) {
+ this.holderName = holderName;
+ }
+
+ private String name;
+ private JavaType type;
+ private Parameter parameter;
+ private boolean holder;
+ private String holderName;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaParameter.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaSimpleType.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaSimpleType.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaSimpleType.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,46 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.model.java;
+
+import org.jboss.com.sun.tools.ws.processor.model.jaxb.JAXBTypeAndAnnotation;
+
+import com.sun.codemodel.JType;
+import com.sun.tools.xjc.api.TypeAndAnnotation;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class JavaSimpleType extends JavaType {
+
+ public JavaSimpleType() {}
+
+ public JavaSimpleType(String name, String initString) {
+ super(name, true, initString);
+ }
+
+ public JavaSimpleType(JAXBTypeAndAnnotation jtype) {
+ super(jtype);
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaSimpleType.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaStructureMember.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaStructureMember.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaStructureMember.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,126 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.model.java;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class JavaStructureMember {
+
+ public JavaStructureMember() {}
+
+ public JavaStructureMember(String name, JavaType type, Object owner) {
+ this(name, type, owner, false);
+ }
+ public JavaStructureMember(String name, JavaType type,
+ Object owner, boolean isPublic) {
+
+ this.name = name;
+ this.type = type;
+ this.owner = owner;
+ this.isPublic = isPublic;
+ constructorPos = -1;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String s) {
+ name = s;
+ }
+
+ public JavaType getType() {
+ return type;
+ }
+
+ public void setType(JavaType t) {
+ type = t;
+ }
+
+ public boolean isPublic() {
+ return isPublic;
+ }
+
+ public void setPublic(boolean b) {
+ isPublic = b;
+ }
+
+ public boolean isInherited() {
+ return isInherited;
+ }
+
+ public void setInherited(boolean b) {
+ isInherited = b;
+ }
+
+ public String getReadMethod() {
+ return readMethod;
+ }
+
+ public void setReadMethod(String readMethod) {
+ this.readMethod = readMethod;
+ }
+
+ public String getWriteMethod() {
+ return writeMethod;
+ }
+
+ public void setWriteMethod(String writeMethod) {
+ this.writeMethod = writeMethod;
+ }
+
+ public String getDeclaringClass() {
+ return declaringClass;
+ }
+ public void setDeclaringClass(String declaringClass) {
+ this.declaringClass = declaringClass;
+ }
+
+ public Object getOwner() {
+ return owner;
+ }
+
+ public void setOwner(Object owner) {
+ this.owner = owner;
+ }
+
+ public int getConstructorPos() {
+ return constructorPos;
+ }
+
+ public void setConstructorPos(int idx) {
+ constructorPos = idx;
+ }
+
+ private String name;
+ private JavaType type;
+ private boolean isPublic = false;
+ private boolean isInherited = false;
+ private String readMethod;
+ private String writeMethod;
+ private String declaringClass;
+ private Object owner;
+ private int constructorPos;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaStructureMember.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaStructureType.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaStructureType.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaStructureType.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,179 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.model.java;
+
+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;
+
+import org.jboss.com.sun.tools.ws.processor.model.ModelException;
+
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class JavaStructureType extends JavaType {
+
+ public JavaStructureType() {}
+
+ public JavaStructureType(String name, boolean present, Object owner) {
+ super(name, present, "null");
+ this.owner = owner;
+ }
+
+ public void add(JavaStructureMember m) {
+ if (membersByName.containsKey(m.getName())) {
+ throw new ModelException("model.uniqueness.javastructuretype",
+ new Object[] {m.getName(), getRealName()});
+ }
+ members.add(m);
+ membersByName.put(m.getName(), m);
+ }
+
+
+ public JavaStructureMember getMemberByName(String name) {
+ if (membersByName.size() != members.size()) {
+ initializeMembersByName();
+ }
+ return membersByName.get(name);
+ }
+
+ public Iterator getMembers() {
+ return members.iterator();
+ }
+
+ public int getMembersCount() {
+ return members.size();
+ }
+
+ /* serialization */
+ public List<JavaStructureMember> getMembersList() {
+ return members;
+ }
+
+ /* serialization */
+ public void setMembersList(List<JavaStructureMember> l) {
+ members = l;
+ }
+
+ private void initializeMembersByName() {
+ membersByName = new HashMap<String, JavaStructureMember>();
+ if (members != null) {
+ for (JavaStructureMember m : members) {
+ if (m.getName() != null &&
+ membersByName.containsKey(m.getName())) {
+
+ throw new ModelException("model.uniqueness");
+ }
+ membersByName.put(m.getName(), m);
+ }
+ }
+ }
+
+ public boolean isAbstract() {
+ return isAbstract;
+ }
+
+ public void setAbstract(boolean isAbstract) {
+ this.isAbstract = isAbstract;
+ }
+
+ public JavaStructureType getSuperclass() {
+ return superclass;
+ }
+
+ public void setSuperclass(JavaStructureType superclassType) {
+ superclass = superclassType;
+ }
+
+ public void addSubclass(JavaStructureType subclassType) {
+ subclasses.add(subclassType);
+ subclassType.setSuperclass(this);
+ }
+
+ public Iterator getSubclasses() {
+ if (subclasses == null || subclasses.size() == 0) {
+ return null;
+ }
+ return subclasses.iterator();
+ }
+
+ public Set getSubclassesSet() {
+ return subclasses;
+ }
+
+ /* serialization */
+ public void setSubclassesSet(Set s) {
+ subclasses = s;
+ for (Iterator iter = s.iterator(); iter.hasNext();) {
+ ((JavaStructureType) iter.next()).setSuperclass(this);
+ }
+ }
+
+ public Iterator getAllSubclasses() {
+ Set subs = getAllSubclassesSet();
+ if (subs.size() == 0) {
+ return null;
+ }
+ return subs.iterator();
+ }
+
+ public Set getAllSubclassesSet() {
+ Set transitiveSet = new HashSet();
+ Iterator subs = subclasses.iterator();
+ while (subs.hasNext()) {
+ transitiveSet.addAll(
+ ((JavaStructureType)subs.next()).getAllSubclassesSet());
+ }
+ transitiveSet.addAll(subclasses);
+ return transitiveSet;
+ }
+
+ public Object getOwner() {
+
+ // usually a SOAPStructureType
+ return owner;
+ }
+
+ public void setOwner(Object owner) {
+
+ // usually a SOAPStructureType
+ this.owner = owner;
+ }
+
+ private List<JavaStructureMember> members = new ArrayList();
+ private Map<String, JavaStructureMember> membersByName = new HashMap();
+
+ // known subclasses of this type
+ private Set subclasses = new HashSet();
+ private JavaStructureType superclass;
+
+ // usually a SOAPStructureType
+ private Object owner;
+ private boolean isAbstract = false;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaStructureType.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaType.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaType.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaType.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,145 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.model.java;
+
+import org.jboss.com.sun.tools.ws.processor.model.jaxb.JAXBTypeAndAnnotation;
+
+import com.sun.codemodel.JType;
+import com.sun.tools.xjc.api.TypeAndAnnotation;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public abstract class JavaType {
+
+ private String name;
+ private String realName;
+ private boolean present;
+ private boolean holder;
+ private boolean holderPresent;
+ private String initString;
+ private String holderName;
+ private JAXBTypeAndAnnotation type;
+
+ public JavaType() {}
+
+ public JavaType(JAXBTypeAndAnnotation type){
+ this.type = type;
+ init(type.getName(), false, null, null);
+ }
+
+ public JavaType(String name, boolean present, String initString) {
+ init(name, present, initString, null);
+ }
+
+ public JavaType(String name, boolean present, String initString,
+ String holderName) {
+
+ init(name, present, initString, holderName);
+ }
+
+ public JAXBTypeAndAnnotation getType(){
+ return type;
+ }
+
+ private void init(String name, boolean present, String initString,
+ String holderName) {
+
+ this.realName = name;
+ this.name = name.replace('$', '.');
+ this.present = present;
+ this.initString = initString;
+ this.holderName = holderName;
+ holder = holderName != null;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void doSetName(String name) {
+
+ // renamed to avoid creating a "name" property with broken semantics
+ this.realName = name;
+ this.name = name.replace('$', '.');
+ }
+
+ public String getRealName() {
+ return realName;
+ }
+
+ /* serialization */
+ public void setRealName(String s) {
+ realName = s;
+ }
+
+ public String getFormalName() {
+ return name;
+ }
+
+ public void setFormalName(String s) {
+ name = s;
+ }
+
+ public boolean isPresent() {
+ return present;
+ }
+
+ /* serialization */
+ public void setPresent(boolean b) {
+ present = b;
+ }
+
+ public boolean isHolder() {
+ return holder;
+ }
+
+ public void setHolder(boolean holder) {
+ this.holder = holder;
+ }
+
+ public boolean isHolderPresent() {
+ return holderPresent;
+ }
+ public void setHolderPresent(boolean holderPresent) {
+ this.holderPresent = holderPresent;
+ }
+
+ public String getInitString() {
+ return initString;
+ }
+
+ /* serialization */
+ public void setInitString(String s) {
+ initString = s;
+ }
+
+ public String getHolderName() {
+ return holderName;
+ }
+
+ public void setHolderName(String holderName) {
+ this.holderName = holderName;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/java/JavaType.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/JAXBElementMember.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/JAXBElementMember.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/JAXBElementMember.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,96 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.model.jaxb;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.processor.model.java.JavaStructureMember;
+
+/**
+ * @author Kathy Walsh, Vivek Pandey
+ *
+ *
+ */
+
+public class JAXBElementMember {
+ public JAXBElementMember() {
+ }
+ public JAXBElementMember(QName name, JAXBType type) {
+ this(name, type, null);
+ }
+ public JAXBElementMember(QName name, JAXBType type,
+ JavaStructureMember javaStructureMember) {
+ _name = name;
+ _type = type;
+ _javaStructureMember = javaStructureMember;
+ }
+ public QName getName() {
+ return _name;
+ }
+ public void setName(QName n) {
+ _name = n;
+ }
+ public JAXBType getType() {
+ return _type;
+ }
+ public void setType(JAXBType t) {
+ _type = t;
+ }
+ public boolean isRepeated() {
+ return _repeated;
+ }
+ public void setRepeated(boolean b) {
+ _repeated = b;
+ }
+ public JavaStructureMember getJavaStructureMember() {
+ return _javaStructureMember;
+ }
+ public void setJavaStructureMember(JavaStructureMember javaStructureMember) {
+ _javaStructureMember = javaStructureMember;
+ }
+ public boolean isInherited() {
+ return isInherited;
+ }
+ public void setInherited(boolean b) {
+ isInherited = b;
+ }
+ public JAXBProperty getProperty() {
+ if(_prop == null && _type != null) {
+ for (JAXBProperty prop: _type.getWrapperChildren()){
+ if(prop.getElementName().equals(_name))
+ setProperty(prop);
+ }
+ }
+ return _prop;
+ }
+ public void setProperty(JAXBProperty prop) {
+ _prop = prop;
+ }
+
+ private QName _name;
+ private JAXBType _type;
+ private JavaStructureMember _javaStructureMember;
+ private boolean _repeated;
+ private boolean isInherited = false;
+ private JAXBProperty _prop;
+ private static final String JAXB_UNIQUE_PARRAM = "__jaxbUniqueParam_";
+}
\ No newline at end of file
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/JAXBElementMember.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/JAXBMapping.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/JAXBMapping.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/JAXBMapping.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,99 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.model.jaxb;
+
+import java.util.List;
+import java.util.ArrayList;
+
+import javax.xml.namespace.QName;
+
+import com.sun.tools.xjc.api.Mapping;
+import com.sun.tools.xjc.api.Property;
+import com.sun.tools.xjc.api.TypeAndAnnotation;
+import com.sun.codemodel.JType;
+
+/**
+ * @author Kohsuke Kawaguchi, Vivek Pandey
+ */
+public class JAXBMapping {
+
+ /**
+ * @see Mapping#getElement()
+ */
+ private QName elementName;
+
+ /**
+ *
+ */
+ private JAXBTypeAndAnnotation type;
+
+ /**
+ * @see Mapping#getWrapperStyleDrilldown()
+ */
+ private List<JAXBProperty> wrapperStyleDrilldown;
+
+ /**
+ * Default constructor for the persistence.
+ */
+ public JAXBMapping() {}
+
+ /**
+ * Constructor that fills in the values from the given raw model
+ */
+ JAXBMapping( com.sun.tools.xjc.api.Mapping rawModel ) {
+ elementName = rawModel.getElement();
+ TypeAndAnnotation typeAndAnno = rawModel.getType();
+ type = new JAXBTypeAndAnnotation(typeAndAnno);
+ List<? extends Property> list = rawModel.getWrapperStyleDrilldown();
+ if(list==null)
+ wrapperStyleDrilldown = null;
+ else {
+ wrapperStyleDrilldown = new ArrayList<JAXBProperty>(list.size());
+ for( Property p : list )
+ wrapperStyleDrilldown.add(new JAXBProperty(p));
+ }
+
+ }
+
+ /**
+ * @see Mapping#getElement()
+ */
+ public QName getElementName() {
+ return elementName;
+ }
+
+ public void setElementName(QName elementName) {
+ this.elementName = elementName;
+ }
+
+
+ public JAXBTypeAndAnnotation getType() {
+ return type;
+ }
+
+ /**
+ * @see Mapping#getWrapperStyleDrilldown()
+ */
+ public List<JAXBProperty> getWrapperStyleDrilldown() {
+ return wrapperStyleDrilldown;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/JAXBMapping.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/JAXBModel.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/JAXBModel.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/JAXBModel.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,143 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.model.jaxb;
+
+import com.sun.tools.xjc.api.*;
+
+import javax.xml.namespace.QName;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import com.sun.codemodel.JType;
+
+/**
+ * Root of the JAXB Model.
+ *
+ * <p>
+ * This is just a wrapper around a list of {@link JAXBMapping}s.
+ *
+ * @author Kohsuke Kawaguchi, Vivek Pandey
+ */
+public class JAXBModel {
+
+ /**
+ * All the mappings known to this model.
+ */
+ private List<JAXBMapping> mappings;
+
+ // index for faster access.
+ private final Map<QName,JAXBMapping> byQName = new
HashMap<QName,JAXBMapping>();
+ private final Map<String,JAXBMapping> byClassName = new
HashMap<String,JAXBMapping>();
+
+ private com.sun.tools.xjc.api.JAXBModel rawJAXBModel;
+
+ public com.sun.tools.xjc.api.JAXBModel getRawJAXBModel() {
+ return rawJAXBModel;
+ }
+
+ /**
+ * @return Schema to Java model
+ */
+ public S2JJAXBModel getS2JJAXBModel(){
+ if(rawJAXBModel instanceof S2JJAXBModel)
+ return (S2JJAXBModel)rawJAXBModel;
+ return null;
+ }
+
+ /**
+ * @return Java to Schema JAXBModel
+ */
+ public J2SJAXBModel getJ2SJAXBModel(){
+ if(rawJAXBModel instanceof J2SJAXBModel)
+ return (J2SJAXBModel)rawJAXBModel;
+ return null;
+ }
+
+
+ /**
+ * Default constructor for the persistence.
+ */
+ public JAXBModel() {}
+
+ /**
+ * Constructor that fills in the values from the given raw model
+ */
+ public JAXBModel( com.sun.tools.xjc.api.JAXBModel rawModel ) {
+ this.rawJAXBModel = rawModel;
+ if(rawModel instanceof S2JJAXBModel){
+ S2JJAXBModel model = (S2JJAXBModel)rawModel;
+ List<JAXBMapping> ms = new
ArrayList<JAXBMapping>(model.getMappings().size());
+ for( Mapping m : model.getMappings())
+ ms.add(new JAXBMapping(m));
+ setMappings(ms);
+ }
+ }
+
+ /**
+ */
+ public List<JAXBMapping> getMappings() {
+ return mappings;
+ }
+
+ //public void setMappings(List<JAXBMapping> mappings) {
+ public void setMappings(List<JAXBMapping> mappings) {
+ this.mappings = mappings;
+ byQName.clear();
+ byClassName.clear();
+ for( JAXBMapping m : mappings ) {
+ byQName.put(m.getElementName(),m);
+ byClassName.put(m.getType().getName(),m);
+ }
+ }
+
+ /**
+ */
+ public JAXBMapping get( QName elementName ) {
+ return byQName.get(elementName);
+ }
+
+ /**
+ */
+ public JAXBMapping get( String className ) {
+ return byClassName.get(className);
+ }
+
+
+ /**
+ *
+ * @return set of full qualified class names that jaxb will generate
+ */
+ public Set<String> getGeneratedClassNames() {
+ return generatedClassNames;
+ }
+
+ public void setGeneratedClassNames(Set<String> generatedClassNames) {
+ this.generatedClassNames = generatedClassNames;
+ }
+
+ private Set<String> generatedClassNames;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/JAXBModel.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/JAXBProperty.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/JAXBProperty.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/JAXBProperty.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,80 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.model.jaxb;
+
+import javax.xml.namespace.QName;
+
+import com.sun.tools.xjc.api.Property;
+
+import com.sun.codemodel.JType;
+/**
+ * @author Kohsuke Kawaguchi
+ */
+public class JAXBProperty {
+
+ /**
+ * @see Property#name()
+ */
+ private String name;
+
+ private JAXBTypeAndAnnotation type;
+ /**
+ * @see Property#elementName()
+ */
+ private QName elementName;
+
+ /**
+ * Default constructor for the persistence.
+ */
+ public JAXBProperty() {}
+
+ /**
+ * Constructor that fills in the values from the given raw model
+ */
+ JAXBProperty( Property prop ) {
+ this.name = prop.name();
+ this.type = new JAXBTypeAndAnnotation(prop.type());
+ this.elementName = prop.elementName();
+ }
+
+ /**
+ * @see Property#name()
+ */
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public JAXBTypeAndAnnotation getType() {
+ return type;
+ }
+
+ /**
+ * @see Property#elementName()
+ */
+ public QName getElementName() {
+ return elementName;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/JAXBProperty.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/JAXBStructuredType.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/JAXBStructuredType.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/JAXBStructuredType.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,142 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.model.jaxb;
+
+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;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.processor.model.ModelException;
+import org.jboss.com.sun.tools.ws.processor.model.java.JavaStructureType;
+
+
+/**
+ * Top-level binding between JAXB generated Java type
+ * and XML Schema element declaration.
+ *
+ * @author
+ * Kohsuke Kawaguchi (kohsuke.kawaguchi(a)sun.com)
+ */
+public class JAXBStructuredType extends JAXBType {
+
+ public JAXBStructuredType(JAXBType jaxbType){
+ super(jaxbType);
+ }
+
+ public JAXBStructuredType() {}
+
+ public JAXBStructuredType(QName name) {
+ this(name, null);
+ }
+
+ public JAXBStructuredType(QName name, JavaStructureType javaType) {
+ super(name, javaType);
+ }
+
+ public void add(JAXBElementMember m) {
+ if (_elementMembersByName.containsKey(m.getName())) {
+ throw new ModelException("model.uniqueness");
+ }
+ _elementMembers.add(m);
+ if (m.getName() != null) {
+ _elementMembersByName.put(m.getName().getLocalPart(), m);
+ }
+ }
+
+ public Iterator getElementMembers() {
+ return _elementMembers.iterator();
+ }
+
+ public int getElementMembersCount() {
+ return _elementMembers.size();
+ }
+
+ /* serialization */
+ public List getElementMembersList() {
+ return _elementMembers;
+ }
+
+ /* serialization */
+ public void setElementMembersList(List l) {
+ _elementMembers = l;
+ }
+
+ public void addSubtype(JAXBStructuredType type) {
+ if (_subtypes == null) {
+ _subtypes = new HashSet();
+ }
+ _subtypes.add(type);
+ type.setParentType(this);
+ }
+
+ public Iterator getSubtypes() {
+ if (_subtypes != null) {
+ return _subtypes.iterator();
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see JAXBType#isUnwrapped()
+ */
+ public boolean isUnwrapped() {
+ return true;
+ }
+ /* serialization */
+ public Set getSubtypesSet() {
+ return _subtypes;
+ }
+
+ /* serialization */
+ public void setSubtypesSet(Set s) {
+ _subtypes = s;
+ }
+
+ public void setParentType(JAXBStructuredType parent) {
+ if (_parentType != null &&
+ parent != null &&
+ !_parentType.equals(parent)) {
+
+ throw new ModelException("model.parent.type.already.set",
+ new Object[] { getName().toString(),
+ _parentType.getName().toString(),
+ parent.getName().toString()});
+ }
+ this._parentType = parent;
+ }
+
+ public JAXBStructuredType getParentType() {
+ return _parentType;
+ }
+
+
+ private List _elementMembers = new ArrayList();
+ private Map _elementMembersByName = new HashMap();
+ private Set _subtypes = null;
+ private JAXBStructuredType _parentType = null;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/JAXBStructuredType.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/JAXBType.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/JAXBType.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/JAXBType.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,124 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.model.jaxb;
+
+import com.sun.tools.xjc.api.TypeAndAnnotation;
+import com.sun.codemodel.JType;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.processor.model.AbstractType;
+import org.jboss.com.sun.tools.ws.processor.model.java.JavaType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Top-level binding between JAXB generated Java type
+ * and XML Schema element declaration.
+ *
+ * @author
+ * Vivek Pandey
+ */
+public class JAXBType extends AbstractType{
+ public JAXBType(JAXBType jaxbType){
+ setName(jaxbType.getName());
+ this.jaxbMapping = jaxbType.getJaxbMapping();
+ this.jaxbModel = jaxbType.getJaxbModel();
+ init();
+ }
+
+ public JAXBType(){}
+
+ public JAXBType(QName name, JavaType type){
+ super(name, type);
+ }
+
+ public JAXBType(QName name, JavaType type, JAXBMapping jaxbMapping, JAXBModel
jaxbModel){
+ super(name, type);
+ this.jaxbMapping = jaxbMapping;
+ this.jaxbModel = jaxbModel;
+ init();
+ }
+
+ public void accept(JAXBTypeVisitor visitor) throws Exception {
+ visitor.visit(this);
+ }
+
+ private void init() {
+ if (jaxbMapping != null)
+ wrapperChildren = jaxbMapping.getWrapperStyleDrilldown();
+ else
+ wrapperChildren = new ArrayList<JAXBProperty>();
+ }
+
+ public boolean isUnwrappable(){
+ return getJaxbMapping().getWrapperStyleDrilldown() != null;
+ }
+
+ public boolean hasWrapperChildren(){
+ return (getWrapperChildren().size() > 0) ? true : false;
+ }
+
+ public boolean isLiteralType() {
+ return true;
+ }
+
+ public List<JAXBProperty> getWrapperChildren(){
+ return wrapperChildren;
+ }
+
+ public void setWrapperChildren(List<JAXBProperty> children) {
+ wrapperChildren = children;
+ }
+
+ public JAXBMapping getJaxbMapping() {
+ return jaxbMapping;
+ }
+
+ public void setJaxbMapping(JAXBMapping jaxbMapping) {
+ this.jaxbMapping = jaxbMapping;
+ init();
+ }
+
+ public void setUnwrapped(boolean unwrapped) {
+ this.unwrapped = unwrapped;
+ }
+
+ public boolean isUnwrapped() {
+ return unwrapped;
+ }
+
+ private JAXBMapping jaxbMapping;
+
+ public JAXBModel getJaxbModel() {
+ return jaxbModel;
+ }
+
+ public void setJaxbModel(JAXBModel jaxbModel) {
+ this.jaxbModel = jaxbModel;
+ }
+
+ private JAXBModel jaxbModel;
+ private boolean unwrapped = false;
+ private List<JAXBProperty> wrapperChildren;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/JAXBType.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/JAXBTypeAndAnnotation.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/JAXBTypeAndAnnotation.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/JAXBTypeAndAnnotation.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,74 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.model.jaxb;
+
+import com.sun.tools.xjc.api.TypeAndAnnotation;
+import com.sun.codemodel.JType;
+import com.sun.codemodel.JAnnotatable;
+
+/**
+ * Holds JAXB JType and TypeAndAnnotation. This provides abstration over
+ * types from JAXBMapping and Property.
+ */
+public class JAXBTypeAndAnnotation {
+ TypeAndAnnotation typeAnn;
+ JType type;
+
+ public JAXBTypeAndAnnotation(TypeAndAnnotation typeAnn) {
+ this.typeAnn = typeAnn;
+ this.type = typeAnn.getTypeClass();
+ }
+
+ public JAXBTypeAndAnnotation(JType type) {
+ this.type = type;
+ }
+
+ public JAXBTypeAndAnnotation(TypeAndAnnotation typeAnn, JType type) {
+ this.typeAnn = typeAnn;
+ this.type = type;
+ }
+
+ public void annotate(JAnnotatable typeVar) {
+ if(typeAnn != null)
+ typeAnn.annotate(typeVar);
+ }
+
+ public JType getType() {
+ return type;
+ }
+
+ public String getName(){
+ return type.fullName();
+ }
+
+ public TypeAndAnnotation getTypeAnn() {
+ return typeAnn;
+ }
+
+ public void setTypeAnn(TypeAndAnnotation typeAnn) {
+ this.typeAnn = typeAnn;
+ }
+
+ public void setType(JType type) {
+ this.type = type;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/JAXBTypeAndAnnotation.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/JAXBTypeVisitor.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/JAXBTypeVisitor.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/JAXBTypeVisitor.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,33 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.model.jaxb;
+
+/**
+ * @author Vivek Pandey
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public interface JAXBTypeVisitor {
+ public void visit(JAXBType type) throws Exception;
+ public void visit(RpcLitStructure type) throws Exception;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/JAXBTypeVisitor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/RpcLitMember.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/RpcLitMember.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/RpcLitMember.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,82 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.model.jaxb;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.processor.model.AbstractType;
+
+
+/**
+ * @author Vivek Pandey
+ *
+ * Represents RpcLit member parts
+ */
+public class RpcLitMember extends AbstractType {
+
+ //wsdl:part type attribute java mapped object
+ private String javaTypeName;
+ private QName schemaTypeName;
+
+ /**
+ *
+ */
+ public RpcLitMember() {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+ public RpcLitMember(QName name, String javaTypeName){
+ setName(name);
+ this.javaTypeName = javaTypeName;
+ }
+ public RpcLitMember(QName name, String javaTypeName, QName schemaTypeName){
+ setName(name);
+ this.javaTypeName = javaTypeName;
+ this.schemaTypeName = schemaTypeName;
+ }
+
+ /**
+ * @return Returns the type.
+ */
+ public String getJavaTypeName() {
+ return javaTypeName;
+ }
+ /**
+ * @param type The type to set.
+ */
+ public void setJavaTypeName(String type) {
+ this.javaTypeName = type;
+ }
+
+ /**
+ * @return Returns the type.
+ */
+ public QName getSchemaTypeName() {
+ return schemaTypeName;
+ }
+ /**
+ * @param type The type to set.
+ */
+ public void setSchemaTypeName(QName type) {
+ this.schemaTypeName = type;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/RpcLitMember.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/RpcLitStructure.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/RpcLitStructure.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/RpcLitStructure.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,90 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.model.jaxb;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.processor.model.AbstractType;
+
+
+/**
+ * @author Vivek Pandey
+ *
+ * RPC Structure that will be used to create RpcLitPayload latter
+ */
+public class RpcLitStructure extends AbstractType {
+ private List<RpcLitMember> members;
+ private JAXBModel jaxbModel;
+
+ /**
+ *
+ */
+ public RpcLitStructure() {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+ public RpcLitStructure(QName name, JAXBModel jaxbModel){
+ setName(name);
+ this.jaxbModel = jaxbModel;
+ this.members = new ArrayList<RpcLitMember>();
+
+ }
+ public RpcLitStructure(QName name, JAXBModel jaxbModel, List<RpcLitMember>
members){
+ setName(name);
+ this.members = members;
+ }
+
+ public void accept(JAXBTypeVisitor visitor) throws Exception {
+ visitor.visit(this);
+ }
+
+ public List<RpcLitMember> getRpcLitMembers(){
+ return members;
+ }
+
+ public List<RpcLitMember> setRpcLitMembers(List<RpcLitMember> members){
+ return this.members = members;
+ }
+
+ public void addRpcLitMember(RpcLitMember member){
+ members.add(member);
+ }
+ /**
+ * @return Returns the jaxbModel.
+ */
+ public JAXBModel getJaxbModel() {
+ return jaxbModel;
+ }
+ /**
+ * @param jaxbModel The jaxbModel to set.
+ */
+ public void setJaxbModel(JAXBModel jaxbModel) {
+ this.jaxbModel = jaxbModel;
+ }
+
+ public boolean isLiteralType() {
+ return true;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/RpcLitStructure.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/Util.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/Util.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/Util.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,62 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.model.jaxb;
+
+/**
+ * @author Kohsuke Kawaguchi
+ */
+class Util {
+ /**
+ * Replaces the marcros in the first string by the actual given arguments.
+ */
+ static String replace( String macro, String... args ) {
+ int len = macro.length();
+ StringBuilder buf = new StringBuilder(len);
+ for( int i=0; i<len; i++ ) {
+ char ch = macro.charAt(i);
+ if(ch=='=' && i+2<len) {
+ char tail = macro.charAt(i+1);
+ char ch2 = macro.charAt(i+2);
+ if('0'<=ch2 && ch2<='9' &&
tail==':') {
+ buf.append(args[ch2-'0']);
+ i+=2;
+ continue;
+ }
+ }
+ buf.append(ch);
+ }
+ return buf.toString();
+ }
+
+ /**
+ * Creates a macro tempate so that it can be later used with {@link #replace(String,
String[])}.
+ */
+ static String createMacroTemplate( String s ) {
+ return s;
+ }
+
+ static final String MAGIC = "=:";
+
+ static final String MAGIC0 = MAGIC+"0";
+ static final String MAGIC1 = MAGIC+"1";
+ static final String MAGIC2 = MAGIC+"2";
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/model/jaxb/Util.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/JavaSimpleTypeCreator.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/JavaSimpleTypeCreator.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/JavaSimpleTypeCreator.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,163 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.modeler;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.com.sun.tools.ws.processor.model.java.JavaSimpleType;
+import org.jboss.com.sun.xml.ws.util.VersionUtil;
+
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class JavaSimpleTypeCreator implements ModelerConstants {
+
+ /*
+ * Mapped JavaSimpleTypes
+ */
+ public JavaSimpleType BOOLEAN_JAVATYPE;
+ public JavaSimpleType BOXED_BOOLEAN_JAVATYPE;
+ public JavaSimpleType BYTE_JAVATYPE;
+ public JavaSimpleType BYTE_ARRAY_JAVATYPE;
+ public JavaSimpleType BOXED_BYTE_JAVATYPE;
+ public JavaSimpleType BOXED_BYTE_ARRAY_JAVATYPE;
+ public JavaSimpleType DOUBLE_JAVATYPE;
+ public JavaSimpleType BOXED_DOUBLE_JAVATYPE;
+ public JavaSimpleType FLOAT_JAVATYPE;
+ public JavaSimpleType BOXED_FLOAT_JAVATYPE;
+ public JavaSimpleType INT_JAVATYPE;
+ public JavaSimpleType BOXED_INTEGER_JAVATYPE;
+ public JavaSimpleType LONG_JAVATYPE;
+ public JavaSimpleType BOXED_LONG_JAVATYPE;
+ public JavaSimpleType SHORT_JAVATYPE;
+ public JavaSimpleType BOXED_SHORT_JAVATYPE;
+ public JavaSimpleType DECIMAL_JAVATYPE;
+ public JavaSimpleType BIG_INTEGER_JAVATYPE;
+ public JavaSimpleType CALENDAR_JAVATYPE;
+ public JavaSimpleType DATE_JAVATYPE;
+ public JavaSimpleType STRING_JAVATYPE;
+ public JavaSimpleType STRING_ARRAY_JAVATYPE;
+ public JavaSimpleType QNAME_JAVATYPE;
+ public JavaSimpleType VOID_JAVATYPE;
+ public JavaSimpleType OBJECT_JAVATYPE;
+ public JavaSimpleType SOAPELEMENT_JAVATYPE;
+ public JavaSimpleType URI_JAVATYPE;
+
+ // Attachment types
+ public JavaSimpleType IMAGE_JAVATYPE;
+ public JavaSimpleType MIME_MULTIPART_JAVATYPE;
+ public JavaSimpleType SOURCE_JAVATYPE;
+ public JavaSimpleType DATA_HANDLER_JAVATYPE;
+
+ // bug fix: 4923650
+ private Map javaTypes = new HashMap();
+
+ public JavaSimpleTypeCreator() {
+ BOOLEAN_JAVATYPE = new JavaSimpleType(BOOLEAN_CLASSNAME, FALSE_STR);
+ javaTypes.put(BOOLEAN_CLASSNAME, BOOLEAN_JAVATYPE);
+ BOXED_BOOLEAN_JAVATYPE =
+ new JavaSimpleType(BOXED_BOOLEAN_CLASSNAME, NULL_STR);
+ javaTypes.put(BOXED_BOOLEAN_CLASSNAME, BOXED_BOOLEAN_JAVATYPE);
+ BYTE_JAVATYPE = new JavaSimpleType(BYTE_CLASSNAME, "(byte)"+ZERO_STR);
+ javaTypes.put(BYTE_CLASSNAME, BYTE_JAVATYPE);
+ BYTE_ARRAY_JAVATYPE =
+ new JavaSimpleType(BYTE_ARRAY_CLASSNAME, NULL_STR);
+ javaTypes.put(BYTE_ARRAY_CLASSNAME, BYTE_ARRAY_JAVATYPE);
+ BOXED_BYTE_JAVATYPE =
+ new JavaSimpleType(BOXED_BYTE_CLASSNAME, NULL_STR);
+ javaTypes.put(BOXED_BYTE_CLASSNAME, BOXED_BYTE_JAVATYPE);
+ BOXED_BYTE_ARRAY_JAVATYPE =
+ new JavaSimpleType(BOXED_BYTE_ARRAY_CLASSNAME, NULL_STR);
+ javaTypes.put(BOXED_BYTE_ARRAY_CLASSNAME, BOXED_BYTE_ARRAY_JAVATYPE);
+ DOUBLE_JAVATYPE = new JavaSimpleType(DOUBLE_CLASSNAME, ZERO_STR);
+ javaTypes.put(DOUBLE_CLASSNAME, DOUBLE_JAVATYPE);
+ BOXED_DOUBLE_JAVATYPE =
+ new JavaSimpleType(BOXED_DOUBLE_CLASSNAME, NULL_STR);
+ javaTypes.put(BOXED_DOUBLE_CLASSNAME, BOXED_DOUBLE_JAVATYPE);
+ FLOAT_JAVATYPE = new JavaSimpleType(FLOAT_CLASSNAME, ZERO_STR);
+ javaTypes.put(FLOAT_CLASSNAME, FLOAT_JAVATYPE);
+ BOXED_FLOAT_JAVATYPE =
+ new JavaSimpleType(BOXED_FLOAT_CLASSNAME, NULL_STR);
+ javaTypes.put(BOXED_FLOAT_CLASSNAME, BOXED_FLOAT_JAVATYPE);
+ INT_JAVATYPE = new JavaSimpleType(INT_CLASSNAME, ZERO_STR);
+ javaTypes.put(INT_CLASSNAME, INT_JAVATYPE);
+ BOXED_INTEGER_JAVATYPE =
+ new JavaSimpleType(BOXED_INTEGER_CLASSNAME, NULL_STR);
+ javaTypes.put(BOXED_INTEGER_CLASSNAME, BOXED_INTEGER_JAVATYPE);
+ LONG_JAVATYPE = new JavaSimpleType(LONG_CLASSNAME, ZERO_STR);
+ javaTypes.put(LONG_CLASSNAME, LONG_JAVATYPE);
+ BOXED_LONG_JAVATYPE =
+ new JavaSimpleType(BOXED_LONG_CLASSNAME, NULL_STR);
+ javaTypes.put(BOXED_LONG_CLASSNAME, BOXED_LONG_JAVATYPE);
+ SHORT_JAVATYPE =
+ new JavaSimpleType(SHORT_CLASSNAME, "(short)"+ZERO_STR);
+ javaTypes.put(SHORT_CLASSNAME, SHORT_JAVATYPE);
+ BOXED_SHORT_JAVATYPE =
+ new JavaSimpleType(BOXED_SHORT_CLASSNAME, NULL_STR);
+ javaTypes.put(BOXED_SHORT_CLASSNAME, BOXED_SHORT_JAVATYPE);
+ DECIMAL_JAVATYPE = new JavaSimpleType(BIGDECIMAL_CLASSNAME, NULL_STR);
+ javaTypes.put(BIGDECIMAL_CLASSNAME, DECIMAL_JAVATYPE);
+ BIG_INTEGER_JAVATYPE =
+ new JavaSimpleType(BIGINTEGER_CLASSNAME, NULL_STR);
+ javaTypes.put(BIGINTEGER_CLASSNAME, BIG_INTEGER_JAVATYPE);
+ CALENDAR_JAVATYPE = new JavaSimpleType(CALENDAR_CLASSNAME, NULL_STR);
+ javaTypes.put(CALENDAR_CLASSNAME, CALENDAR_JAVATYPE);
+ DATE_JAVATYPE = new JavaSimpleType(DATE_CLASSNAME, NULL_STR);
+ javaTypes.put(DATE_CLASSNAME, DATE_JAVATYPE);
+ STRING_JAVATYPE = new JavaSimpleType(STRING_CLASSNAME, NULL_STR);
+ javaTypes.put(STRING_CLASSNAME, STRING_JAVATYPE);
+ STRING_ARRAY_JAVATYPE =
+ new JavaSimpleType(STRING_ARRAY_CLASSNAME, NULL_STR);
+ javaTypes.put(STRING_ARRAY_CLASSNAME, STRING_ARRAY_JAVATYPE);
+ QNAME_JAVATYPE = new JavaSimpleType(QNAME_CLASSNAME, NULL_STR);
+ javaTypes.put(QNAME_CLASSNAME, QNAME_JAVATYPE);
+
+
+ VOID_JAVATYPE = new JavaSimpleType(VOID_CLASSNAME, null);
+ javaTypes.put(VOID_CLASSNAME, VOID_JAVATYPE);
+ OBJECT_JAVATYPE = new JavaSimpleType(OBJECT_CLASSNAME, null);
+ javaTypes.put(OBJECT_CLASSNAME, OBJECT_JAVATYPE);
+ SOAPELEMENT_JAVATYPE = new JavaSimpleType(SOAPELEMENT_CLASSNAME, null);
+ javaTypes.put(SOAPELEMENT_CLASSNAME, SOAPELEMENT_JAVATYPE);
+ URI_JAVATYPE = new JavaSimpleType(URI_CLASSNAME, null);
+ javaTypes.put(URI_CLASSNAME, URI_JAVATYPE);
+
+ // Attachment types
+ IMAGE_JAVATYPE = new JavaSimpleType(IMAGE_CLASSNAME, null);
+ javaTypes.put(IMAGE_CLASSNAME, IMAGE_JAVATYPE);
+ MIME_MULTIPART_JAVATYPE = new JavaSimpleType(MIME_MULTIPART_CLASSNAME, null);
+ javaTypes.put(MIME_MULTIPART_CLASSNAME, MIME_MULTIPART_JAVATYPE);
+ SOURCE_JAVATYPE = new JavaSimpleType(SOURCE_CLASSNAME, null);
+ javaTypes.put(SOURCE_CLASSNAME, SOURCE_JAVATYPE);
+ DATA_HANDLER_JAVATYPE = new JavaSimpleType(DATA_HANDLER_CLASSNAME, null);
+ javaTypes.put(DATA_HANDLER_CLASSNAME, DATA_HANDLER_JAVATYPE);
+ }
+
+ // bug fix: 4923650
+ public JavaSimpleType getJavaSimpleType(String classname) {
+ return (JavaSimpleType) javaTypes.get(classname);
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/JavaSimpleTypeCreator.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/Modeler.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/Modeler.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/Modeler.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,44 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+
+package org.jboss.com.sun.tools.ws.processor.modeler;
+
+import org.jboss.com.sun.tools.ws.processor.model.Model;
+
+/**
+ * A Modeler is used to create a Model of a Web Service from a particular Web
+ * Web Service description such as a WSDL
+ *
+ * @author WS Development Team
+*/
+public interface Modeler {
+ /**
+ * Returns the top model of a Web Service. May throw a
+ * ModelException if there is a problem with the model.
+ *
+ * @return Model - the root Node of the model of the Web Service
+ *
+ * @exception ModelerException
+ */
+ public Model buildModel();
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/Modeler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/ModelerConstants.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/ModelerConstants.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/ModelerConstants.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,100 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.modeler;
+
+
+/**
+ *
+ * @author WS Development Team
+ */
+public interface ModelerConstants {
+
+ public static final String BRACKETS = "[]";
+ public static final String FALSE_STR = "false";
+ public static final String ZERO_STR = "0";
+ public static final String NULL_STR = "null";
+ public static final String ARRAY_STR = "Array";
+
+ /*
+ * Java ClassNames
+ */
+ /*
+ * Java ClassNames
+ */
+ public static final String IOEXCEPTION_CLASSNAME =
"java.io.IOException";
+ public static final String BOOLEAN_CLASSNAME = "boolean";
+ public static final String BOXED_BOOLEAN_CLASSNAME =
"java.lang.Boolean";
+ public static final String BYTE_CLASSNAME = "byte";
+ public static final String BYTE_ARRAY_CLASSNAME = BYTE_CLASSNAME+BRACKETS;
+ public static final String BOXED_BYTE_CLASSNAME =
"java.lang.Byte";
+ public static final String BOXED_BYTE_ARRAY_CLASSNAME =
BOXED_BYTE_CLASSNAME+BRACKETS;
+ public static final String CLASS_CLASSNAME =
"java.lang.Class";
+ public static final String CHAR_CLASSNAME = "char";
+ public static final String BOXED_CHAR_CLASSNAME =
"java.lang.Character";
+ public static final String DOUBLE_CLASSNAME = "double";
+ public static final String BOXED_DOUBLE_CLASSNAME =
"java.lang.Double";
+ public static final String FLOAT_CLASSNAME = "float";
+ public static final String BOXED_FLOAT_CLASSNAME =
"java.lang.Float";
+ public static final String INT_CLASSNAME = "int";
+ public static final String BOXED_INTEGER_CLASSNAME =
"java.lang.Integer";
+ public static final String LONG_CLASSNAME = "long";
+ public static final String BOXED_LONG_CLASSNAME =
"java.lang.Long";
+ public static final String SHORT_CLASSNAME = "short";
+ public static final String BOXED_SHORT_CLASSNAME =
"java.lang.Short";
+ public static final String BIGDECIMAL_CLASSNAME =
"java.math.BigDecimal";
+ public static final String BIGINTEGER_CLASSNAME =
"java.math.BigInteger";
+ public static final String CALENDAR_CLASSNAME =
"java.util.Calendar";
+ public static final String DATE_CLASSNAME =
"java.util.Date";
+ public static final String STRING_CLASSNAME =
"java.lang.String";
+ public static final String STRING_ARRAY_CLASSNAME =
STRING_CLASSNAME+BRACKETS;
+ public static final String QNAME_CLASSNAME =
"javax.xml.namespace.QName";
+ public static final String VOID_CLASSNAME = "void";
+ public static final String OBJECT_CLASSNAME =
"java.lang.Object";
+ public static final String SOAPELEMENT_CLASSNAME =
"javax.xml.soap.SOAPElement";
+ public static final String IMAGE_CLASSNAME =
"java.awt.Image";
+ public static final String MIME_MULTIPART_CLASSNAME =
"javax.mail.internet.MimeMultipart";
+ public static final String SOURCE_CLASSNAME =
"javax.xml.transform.Source";
+ public static final String DATA_HANDLER_CLASSNAME =
"javax.activation.DataHandler";
+ public static final String URI_CLASSNAME =
"java.net.URI";
+// public static final String URI_CLASSNAME =
"java.lang.String";
+ // Collections
+ public static final String COLLECTION_CLASSNAME =
"java.util.Collection";
+ public static final String LIST_CLASSNAME =
"java.util.List";
+ public static final String SET_CLASSNAME =
"java.util.Set";
+ public static final String VECTOR_CLASSNAME =
"java.util.Vector";
+ public static final String STACK_CLASSNAME =
"java.util.Stack";
+ public static final String LINKED_LIST_CLASSNAME =
"java.util.LinkedList";
+ public static final String ARRAY_LIST_CLASSNAME =
"java.util.ArrayList";
+ public static final String HASH_SET_CLASSNAME =
"java.util.HashSet";
+ public static final String TREE_SET_CLASSNAME =
"java.util.TreeSet";
+
+ // Maps
+ public static final String MAP_CLASSNAME =
"java.util.Map";
+ public static final String HASH_MAP_CLASSNAME =
"java.util.HashMap";
+ public static final String TREE_MAP_CLASSNAME =
"java.util.TreeMap";
+ public static final String HASHTABLE_CLASSNAME =
"java.util.Hashtable";
+ public static final String PROPERTIES_CLASSNAME =
"java.util.Properties";
+// public static final String WEAK_HASH_MAP_CLASSNAME =
"java.util.WeakHashMap";
+ public static final String JAX_WS_MAP_ENTRY_CLASSNAME =
"org.jboss.com.sun.xml.ws.encoding.soap.JAXWSMapEntry";
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/ModelerConstants.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/ModelerException.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/ModelerException.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/ModelerException.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,55 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.modeler;
+
+import org.jboss.com.sun.tools.ws.processor.ProcessorException;
+import org.jboss.com.sun.xml.ws.util.localization.Localizable;
+
+
+/**
+ * ModelerException represents an exception that occurred while
+ * visiting service model.
+ *
+ * @see ProcessorException
+ *
+ * @author WS Development Team
+*/
+public class ModelerException extends ProcessorException {
+
+ public ModelerException(String key, Object... args) {
+ super(key, args);
+ }
+
+ public ModelerException(Throwable throwable) {
+ super(throwable);
+ }
+
+ public ModelerException(Localizable arg) {
+ super("modeler.nestedModelError", arg);
+ }
+
+ public String getResourceBundleName() {
+ return "org.jboss.com.sun.tools.ws.resources.modeler";
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/ModelerException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/ModelerUtils.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/ModelerUtils.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/ModelerUtils.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,258 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.modeler;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.processor.model.AbstractType;
+import org.jboss.com.sun.tools.ws.processor.model.Block;
+import org.jboss.com.sun.tools.ws.processor.model.ModelProperties;
+import org.jboss.com.sun.tools.ws.processor.model.Parameter;
+import org.jboss.com.sun.tools.ws.processor.model.java.JavaSimpleType;
+import org.jboss.com.sun.tools.ws.processor.model.java.JavaStructureMember;
+import org.jboss.com.sun.tools.ws.processor.model.java.JavaStructureType;
+import org.jboss.com.sun.tools.ws.processor.model.java.JavaType;
+import org.jboss.com.sun.tools.ws.processor.model.jaxb.*;
+import org.jboss.com.sun.tools.ws.util.ClassNameInfo;
+import org.jboss.com.sun.tools.ws.wsdl.document.Message;
+import org.jboss.com.sun.tools.ws.wsdl.document.MessagePart;
+
+import com.sun.tools.xjc.api.S2JJAXBModel;
+import com.sun.tools.xjc.api.TypeAndAnnotation;
+
+/**
+ * Utilities to be used by modelers such as WSDLModeler and Rmimodeler
+ *
+ * @author Vivek Pandey
+ *
+ */
+public class ModelerUtils {
+
+ /**
+ * This method should be called incase of wrapper style operations. This is
+ * equivalent to wrapper style schema component or JAXB Mapping object.
+ *
+ * @param jaxbType JAXBType from which a JAXBStructured type will be created.
+ * @return returns JAXBStructured type
+ */
+ public static JAXBStructuredType createJAXBStructureType(JAXBType jaxbType) {
+ JAXBStructuredType type = new JAXBStructuredType(jaxbType);
+ type.setName(jaxbType.getName());
+ type.setJavaType(jaxbType.getJavaType());
+ return type;
+ }
+
+ /**
+ * This method uses JAXBStructured type (wrapper style operations) and
+ * unwraps it to create list of parameters.
+ *
+ *
+ * @param jaxbType instance of JAXBType, could be JAXBStructured type.
+ * @param block The Block (body/Header/Attachment) to which the created Parameter
belong.
+ * @return list of Parameters
+ */
+ public static List<Parameter> createUnwrappedParameters(JAXBType jaxbType,
+ Block block) {
+ List<Parameter> paramList = new ArrayList<Parameter>();
+ JAXBStructuredType type = null;
+ if (!(jaxbType instanceof JAXBStructuredType))
+ type = createJAXBStructureType(jaxbType);
+ else
+ type = (JAXBStructuredType) jaxbType;
+
+ JavaStructureType jst = new JavaStructureType(jaxbType.getJavaType()
+ .getRealName(), true, type);
+ type.setJavaType(jst);
+ block.setType(type);
+ List memberList = jaxbType.getWrapperChildren();
+ Iterator props = memberList.iterator();
+ while (props.hasNext()) {
+ JAXBProperty prop = (JAXBProperty) props.next();
+ paramList.add(createUnwrappedParameter(prop, jaxbType, block, type,
+ jst));
+ }
+
+ return paramList;
+ }
+
+ /**
+ * @param prop
+ * @param jaxbType
+ * @param block
+ * @return
+ */
+ private static Parameter createUnwrappedParameter(JAXBProperty prop,
+ JAXBType jaxbType, Block block, JAXBStructuredType type,
+ JavaStructureType jst) {
+ QName elementName = prop.getElementName();
+ JavaType javaType = new JavaSimpleType(prop.getType());
+ JAXBElementMember eType = new JAXBElementMember(elementName, jaxbType);
+ JavaStructureMember jsm = new JavaStructureMember(elementName
+ .getLocalPart(), javaType, eType);
+ eType.setJavaStructureMember(jsm);
+ jst.add(jsm);
+ eType.setProperty(prop);
+ type.add(eType);
+ JAXBType t = new JAXBType(elementName, javaType, jaxbType
+ .getJaxbMapping(), jaxbType.getJaxbModel());
+ t.setUnwrapped(true);
+ Parameter parameter = createParameter(elementName.getLocalPart(), t, block);
+ parameter.setEmbedded(true);
+ return parameter;
+ }
+
+ public static List<Parameter> createRpcLitParameters(Message message, Block
block, S2JJAXBModel jaxbModel){
+ RpcLitStructure rpcStruct = (RpcLitStructure)block.getType();
+
+ List<Parameter> parameters = new ArrayList<Parameter>();
+ for(MessagePart part : message.getParts()){
+ if(!ModelerUtils.isBoundToSOAPBody(part))
+ continue;
+ QName name = part.getDescriptor();
+ TypeAndAnnotation typeAndAnn = jaxbModel.getJavaType(name);
+ if(typeAndAnn == null){
+ String msgQName =
"{"+message.getDefining().getTargetNamespaceURI()+"}"+message.getName();
+ throw new
ModelerException("wsdlmodeler.rpclit.unkownschematype", name.toString(),
+ part.getName(), msgQName);
+ }
+ String type = typeAndAnn.getTypeClass().fullName();
+ type = ClassNameInfo.getGenericClass(type);
+ RpcLitMember param = new RpcLitMember(new QName("",
part.getName()), type);
+ JavaType javaType = new JavaSimpleType(new
JAXBTypeAndAnnotation(typeAndAnn));
+ param.setJavaType(javaType);
+ rpcStruct.addRpcLitMember(param);
+ Parameter parameter = ModelerUtils.createParameter(part.getName(), param,
block);
+ parameter.setEmbedded(true);
+ parameters.add(parameter);
+ }
+ return parameters;
+ }
+
+ /**
+ * Called for non-wrapper style operations. It returns a Parameter constructed
+ * using the JAXBType and the Block.
+ *
+ * @param partName typically wsdl:part or any name to be given to the parameter
+ * @param jaxbType type of Parameter
+ * @param block Block to which the parameter belongs to
+ * @return Parameter created.
+ */
+ public static Parameter createParameter(String partName, AbstractType jaxbType,
+ Block block) {
+ Parameter parameter = new Parameter(partName);
+ parameter.setProperty(ModelProperties.PROPERTY_PARAM_MESSAGE_PART_NAME,
+ partName);
+ parameter.setEmbedded(false);
+ parameter.setType(jaxbType);
+ parameter.setTypeName(jaxbType.getJavaType().getType().getName());
+ parameter.setBlock(block);
+ return parameter;
+ }
+
+ /**
+ * Get Parameter from the list of parameters.
+ *
+ * @param paramName
+ * @param parameters
+ * @return the Parameter with name paramName from parameters
+ */
+ public static Parameter getParameter(String paramName, List<Parameter>
parameters){
+ if(parameters == null)
+ return null;
+ for(Parameter param: parameters){
+ //if(param.getName().equals("_return") &&
paramName.equals("return") || param.getName().equals(paramName)) {
+ if(param.getName().equals(paramName)){
+ return param;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Compares two JAXBStructures.
+ *
+ * @param struct1
+ * @param struct2
+ * @return true if struct1 and struct2 are equivalent.
+ */
+ public static boolean isEquivalentLiteralStructures(
+ JAXBStructuredType struct1,
+ JAXBStructuredType struct2) {
+ if (struct1.getElementMembersCount() != struct2.getElementMembersCount())
+ return false;
+ Iterator members = struct1.getElementMembers();
+ JAXBElementMember member1;
+ JavaStructureMember javaMember1, javaMember2;
+ for (int i = 0; members.hasNext(); i++) {
+ member1 = (JAXBElementMember)members.next();
+ javaMember1 = member1.getJavaStructureMember();
+ javaMember2 =
+ ((JavaStructureType)struct2.getJavaType()).getMemberByName(
+ member1.getJavaStructureMember().getName());
+ if (javaMember2.getConstructorPos() != i
+ || !javaMember1.getType().equals(javaMember2.getType())) {
+ return false;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @param part
+ * @return true if part is bound to Mime content
+ */
+ public static boolean isBoundToMimeContent(MessagePart part) {
+ if((part != null) && part.getBindingExtensibilityElementKind() ==
MessagePart.WSDL_MIME_BINDING)
+ return true;
+ return false;
+ }
+
+ /**
+ * @param part
+ * @return true if part is bound to SOAPBody
+ */
+ public static boolean isBoundToSOAPBody(MessagePart part) {
+ if((part != null) && part.getBindingExtensibilityElementKind() ==
MessagePart.SOAP_BODY_BINDING)
+ return true;
+ return false;
+ }
+
+ /**
+ * @param part
+ * @return true if part is bound to SOAPHeader
+ */
+ public static boolean isBoundToSOAPHeader(MessagePart part) {
+ if((part != null) && part.getBindingExtensibilityElementKind() ==
MessagePart.SOAP_HEADER_BINDING)
+ return true;
+ return false;
+ }
+
+ public static boolean isUnbound(MessagePart part) {
+ if((part != null) && part.getBindingExtensibilityElementKind() ==
MessagePart.PART_NOT_BOUNDED)
+ return true;
+ return false;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/ModelerUtils.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/AnnotationProcessorContext.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/AnnotationProcessorContext.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/AnnotationProcessorContext.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,297 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.modeler.annotation;
+
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.declaration.MethodDeclaration;
+import com.sun.mirror.declaration.ParameterDeclaration;
+import com.sun.mirror.declaration.TypeDeclaration;
+import com.sun.mirror.type.TypeMirror;
+
+import com.sun.tools.xjc.api.Reference;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.processor.model.Model;
+import org.jboss.com.sun.tools.ws.processor.model.Operation;
+import org.jboss.com.sun.tools.ws.processor.model.Port;
+import org.jboss.com.sun.tools.ws.processor.model.Service;
+import org.jboss.com.sun.tools.ws.processor.model.jaxb.JAXBModel;
+import org.jboss.com.sun.tools.ws.processor.modeler.annotation.*;
+import org.jboss.com.sun.tools.ws.wsdl.document.soap.SOAPUse;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+
+
+/**
+ *
+ * @author dkohlert
+ */
+public class AnnotationProcessorContext {
+
+ private Map<String, SEIContext> seiContextMap;
+ private int round = 1;
+ private boolean modelCompleted = false;
+
+ /** Creates a new instance of AnnotationProcessorContext */
+ public AnnotationProcessorContext() {
+ seiContextMap = new HashMap<String, SEIContext>();
+ }
+
+ public void addSEIContext(String seiName, SEIContext seiContext) {
+ seiContextMap.put(seiName, seiContext);
+ }
+
+ public SEIContext getSEIContext(String seiName) {
+ SEIContext context = seiContextMap.get(seiName);
+ if (context == null) {
+ context = new SEIContext(seiName);
+ addSEIContext(seiName, context);
+ }
+ return context;
+ }
+
+ public SEIContext getSEIContext(TypeDeclaration d) {
+ SEIContext context = getSEIContext(d.getQualifiedName());
+ return context;
+ }
+
+ public Collection<SEIContext> getSEIContexts() {
+ return seiContextMap.values();
+ }
+
+ public boolean allEncoded() {
+ for (SEIContext seiContext : seiContextMap.values()) {
+ if (!isEncoded(seiContext.getModel()))
+ return false;
+ }
+ return true;
+ }
+
+ public int getRound() {
+ return round;
+ }
+
+ public void incrementRound() {
+ round++;
+ }
+
+ public static boolean isEncoded(Model model) {
+ if (model == null)
+ return false;
+ for (Service service : model.getServices()) {
+ for (Port port : service.getPorts()) {
+ for (Operation operation : port.getOperations()) {
+ if (operation.getUse() != null &&
operation.getUse().equals(SOAPUse.LITERAL))
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ public void setModelCompleted(boolean modelCompleted) {
+ this.modelCompleted = modelCompleted;
+ }
+
+ public boolean isModelCompleted() {
+ return modelCompleted;
+ }
+
+ public static class SEIContext {
+ private Map<String, WrapperInfo> reqOperationWrapperMap;
+ private Map<String, WrapperInfo> resOperationWrapperMap;
+ private Map<String, FaultInfo> exceptionBeanMap;
+
+ private Model model;
+ private Map<Object, Reference> schemaReferences;
+ private Map<QName, Reference> schemaElements;
+
+ private boolean modelCompiled = false;
+ private String seiName;
+ private String seiImplName;
+ private boolean implementsSEI = false;
+ private JAXBModel jaxBModel;
+ private String namespaceURI = null;
+
+ public SEIContext(String seiName) {
+ reqOperationWrapperMap = new HashMap<String, WrapperInfo>();
+ resOperationWrapperMap = new HashMap<String, WrapperInfo>();
+ exceptionBeanMap = new HashMap<String,FaultInfo>();
+ schemaReferences = new HashMap<Object, Reference>();
+ schemaElements = new HashMap<QName, Reference>();
+ this.seiName = seiName;
+ }
+
+ public void setImplementsSEI(boolean implementsSEI) {
+ this.implementsSEI = implementsSEI;
+ }
+
+ public boolean getImplementsSEI() {
+ return implementsSEI;
+ }
+
+ public void setNamespaceURI(String namespaceURI) {
+ this.namespaceURI = namespaceURI;
+ }
+
+ public String getNamespaceURI() {
+ return namespaceURI;
+ }
+
+ public void setJAXBModel(JAXBModel model) {
+ this.jaxBModel = model;
+ if (this.model != null)
+ this.model.setJAXBModel(model);
+ }
+
+ public JAXBModel getJAXBModel() {
+ return jaxBModel;
+ }
+
+ public String getSEIName() {
+ return seiName;
+ }
+
+ public String getSEIImplName() {
+ return seiImplName;
+ }
+
+ public void setSEIImplName(String implName) {
+ seiImplName = implName;
+ }
+
+ public void setReqWrapperOperation(MethodDeclaration method, WrapperInfo
wrapperInfo) {
+ reqOperationWrapperMap.put(methodToString(method), wrapperInfo);
+ }
+
+ public WrapperInfo getReqOperationWrapper(MethodDeclaration method) {
+ return reqOperationWrapperMap.get(methodToString(method));
+ }
+
+ public void setResWrapperOperation(MethodDeclaration method, WrapperInfo
wrapperInfo) {
+ resOperationWrapperMap.put(methodToString(method), wrapperInfo);
+ }
+
+ public WrapperInfo getResOperationWrapper(MethodDeclaration method) {
+ return resOperationWrapperMap.get(methodToString(method));
+ }
+
+ public String methodToString(MethodDeclaration method) {
+ StringBuffer buf = new StringBuffer(method.getSimpleName());
+ for (ParameterDeclaration param : method.getParameters())
+ buf.append(";"+param.getType().toString());
+ return buf.toString();
+ }
+
+ public void setModel(Model model) {
+ this.model = model;
+ model.setJAXBModel(jaxBModel);
+ }
+
+ public Model getModel() {
+ return model;
+ }
+
+ public boolean getModelCompiled() {
+ return modelCompiled;
+ }
+
+ public void setModelCompiled(boolean compiled) {
+ modelCompiled = compiled;
+ }
+
+ public Collection<Reference> getSchemaReferences(ModelBuilder builder) {
+ return schemaReferences.values();
+ }
+
+ public Map<QName, Reference> getSchemaElementMap(ModelBuilder builder) {
+ return schemaElements;
+ }
+
+ public Collection<Reference> getSchemaReferences() {
+ return schemaReferences.values();
+ }
+
+ public void clearExceptionMap() {
+ exceptionBeanMap.clear();
+ }
+
+ public void addExceptionBeanEntry(String exception, FaultInfo faultInfo,
ModelBuilder builder) {
+ exceptionBeanMap.put(exception,faultInfo);
+ }
+
+ public FaultInfo getExceptionBeanName(String exception) {
+ return exceptionBeanMap.get(exception);
+ }
+
+ public Reference addReference(MethodDeclaration method) {
+ Reference ref = schemaReferences.get(method);
+ if (ref == null)
+ ref = new Reference(method);
+ addReference(method, ref);
+ return ref;
+ }
+
+ public Reference addReference(ParameterDeclaration param) {
+ Reference ref = schemaReferences.get(param);
+ if (ref == null)
+ ref = new Reference(param);
+ addReference(param, ref);
+ return ref;
+ }
+
+ public Reference addReference(TypeMirror type, ParameterDeclaration param) {
+ Reference ref = schemaReferences.get(param);
+ if (ref == null)
+ ref = new Reference(type, param);
+ addReference(param, ref);
+ return ref;
+ }
+
+ public Reference addReference(TypeDeclaration type,
AnnotationProcessorEnvironment apEnv) {
+ Reference ref = schemaReferences.get(type);
+ if (ref == null)
+ ref = new Reference(type, apEnv);
+ addReference(type, ref);
+ return ref;
+ }
+
+ private void addReference(Object key, Reference reference) {
+ schemaReferences.put(key, reference);
+ }
+
+ public Reference getReference(Object key) {
+ return schemaReferences.get(key);
+ }
+
+ public void addSchemaElement(QName elemName, Reference reference) {
+ if (elemName == null)
+ throw new RuntimeException();
+ schemaElements.put(elemName, reference);
+ }
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/AnnotationProcessorContext.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/FaultInfo.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/FaultInfo.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/FaultInfo.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,97 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.modeler.annotation;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.processor.modeler.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ * @author dkohlert
+ */
+public class FaultInfo {
+ public String beanName;
+ public TypeMoniker beanTypeMoniker;
+ public boolean isWSDLException;
+ public QName elementName;
+ public List<MemberInfo> members;
+
+ /** Creates a new instance of FaultInfo */
+ public FaultInfo() {
+ }
+ public FaultInfo(String beanName) {
+ this.beanName = beanName;
+ }
+ public FaultInfo(String beanName, boolean isWSDLException) {
+ this.beanName = beanName;
+ this.isWSDLException = isWSDLException;
+ }
+ public FaultInfo(TypeMoniker typeMoniker, boolean isWSDLException) {
+ this.beanTypeMoniker = typeMoniker;
+ this.isWSDLException = isWSDLException;
+ }
+
+ public void setIsWSDLException(boolean isWSDLException) {
+ this.isWSDLException = isWSDLException;
+ }
+
+ public boolean isWSDLException() {
+ return isWSDLException;
+ }
+
+ public void setBeanName(String beanName) {
+ this.beanName = beanName;
+ }
+
+ public String getBeanName() {
+ return beanName;
+ }
+
+ public void setElementName(QName elementName) {
+ this.elementName = elementName;
+ }
+
+ public QName getElementName() {
+ return elementName;
+ }
+ public void setBeanTypeMoniker(TypeMoniker typeMoniker) {
+ this.beanTypeMoniker = typeMoniker;
+ }
+ public TypeMoniker getBeanTypeMoniker() {
+ return beanTypeMoniker;
+ }
+ public List<MemberInfo> getMembers() {
+ return members;
+ }
+ public void setMembers(List<MemberInfo> members) {
+ this.members = members;
+ }
+ public void addMember(MemberInfo member) {
+ if (members == null)
+ members = new ArrayList<MemberInfo>();
+ members.add(member);
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/FaultInfo.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/MakeSafeTypeVisitor.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/MakeSafeTypeVisitor.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/MakeSafeTypeVisitor.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,105 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.modeler.annotation;
+
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+
+
+import com.sun.istack.tools.APTTypeVisitor;
+
+import com.sun.mirror.declaration.TypeDeclaration;
+import com.sun.mirror.type.ArrayType;
+import com.sun.mirror.type.ClassType;
+import com.sun.mirror.type.DeclaredType;
+import com.sun.mirror.type.InterfaceType;
+import com.sun.mirror.type.PrimitiveType;
+import com.sun.mirror.type.ReferenceType;
+import com.sun.mirror.type.TypeMirror;
+import com.sun.mirror.type.TypeVariable;
+import com.sun.mirror.type.VoidType;
+import com.sun.mirror.type.WildcardType;
+import com.sun.mirror.util.Types;
+
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ *
+ * @author dkohlert
+ */
+public class MakeSafeTypeVisitor extends APTTypeVisitor<TypeMirror, Types>
implements WebServiceConstants {
+ TypeDeclaration collectionDecl;
+ TypeDeclaration mapDecl;
+
+ /**
+ * Creates a new instance of MakeSafeTypeVisitor
+ */
+ public MakeSafeTypeVisitor(AnnotationProcessorEnvironment apEnv) {
+ collectionDecl = apEnv.getTypeDeclaration(COLLECTION_CLASSNAME);
+ mapDecl = apEnv.getTypeDeclaration(MAP_CLASSNAME);
+ }
+
+ protected TypeMirror onArrayType(ArrayType type, Types apTypes) {
+ return apTypes.getErasure(type);
+ }
+
+ protected TypeMirror onPrimitiveType(PrimitiveType type, Types apTypes) {
+ return apTypes.getErasure(type);
+ }
+
+ protected TypeMirror onClassType(ClassType type, Types apTypes) {
+ return processDeclaredType(type, apTypes);
+ }
+
+ protected TypeMirror onInterfaceType(InterfaceType type, Types apTypes) {
+ return processDeclaredType(type, apTypes);
+ }
+
+ private TypeMirror processDeclaredType(DeclaredType type, Types apTypes) {
+ if (TypeModeler.isSubtype(type.getDeclaration(), collectionDecl) ||
+ TypeModeler.isSubtype(type.getDeclaration(), mapDecl)) {
+ Collection<TypeMirror> args = type.getActualTypeArguments();
+ TypeMirror[] safeArgs = new TypeMirror[args.size()];
+ int i = 0;
+ for (TypeMirror arg : args) {
+ safeArgs[i++]= apply(arg, apTypes);
+ }
+ return apTypes.getDeclaredType(type.getDeclaration(), safeArgs);
+ }
+ return apTypes.getErasure(type);
+ }
+
+ protected TypeMirror onTypeVariable(TypeVariable type, Types apTypes) {
+ return apTypes.getErasure(type);
+ }
+
+ protected TypeMirror onVoidType(VoidType type, Types apTypes) {
+ return type;
+ }
+
+ protected TypeMirror onWildcard(WildcardType type, Types apTypes) {
+ return apTypes.getErasure(type);
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/MakeSafeTypeVisitor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/MemberInfo.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/MemberInfo.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/MemberInfo.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,65 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.modeler.annotation;
+
+import javax.xml.namespace.QName;
+
+import com.sun.mirror.type.TypeMirror;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class MemberInfo implements Comparable<MemberInfo> {
+ int paramIndex;
+ TypeMirror paramType;
+ String paramName;
+ QName elementName;
+
+ public MemberInfo(int paramIndex, TypeMirror paramType, String paramName,
+ QName elementName) {
+ this.paramIndex = paramIndex;
+ this.paramType = paramType;
+ this.paramName = paramName;
+ this.elementName = elementName;
+ }
+
+ public int getParamIndex() {
+ return paramIndex;
+ }
+
+ public TypeMirror getParamType() {
+ return paramType;
+ }
+
+ public String getParamName() {
+ return paramName;
+ }
+
+ public QName getElementName() {
+ return elementName;
+ }
+
+ public int compareTo(MemberInfo member) {
+ return paramName.compareTo(member.paramName);
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/MemberInfo.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/ModelBuilder.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/ModelBuilder.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/ModelBuilder.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,73 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.modeler.annotation;
+
+import java.io.File;
+
+
+import java.net.URL;
+import java.util.Properties;
+
+import com.sun.mirror.apt.*;
+import com.sun.mirror.declaration.*;
+import com.sun.mirror.type.*;
+import com.sun.mirror.util.*;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.processor.model.Port;
+import org.jboss.com.sun.tools.ws.processor.model.Service;
+import org.jboss.com.sun.tools.ws.processor.modeler.ModelerException;
+import org.jboss.com.sun.tools.ws.processor.modeler.annotation.*;
+import org.jboss.com.sun.tools.ws.processor.util.ProcessorEnvironment;
+import org.jboss.com.sun.xml.ws.util.localization.Localizable;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public interface ModelBuilder {
+ public AnnotationProcessorEnvironment getAPEnv();
+ public void createModel(TypeDeclaration d, QName modelName, String targetNamespace,
String modelerClassName);
+ public void setService(Service service);
+ public void setPort(Port port);
+ public String getOperationName(String methodName);
+ public String getResponseName(String operationName);
+ public TypeMirror getHolderValueType(TypeMirror type);
+ public boolean checkAndSetProcessed(TypeDeclaration typeDecl);
+ public boolean isRemoteException(TypeDeclaration typeDecl);
+ public boolean isRemote(TypeDeclaration typeDecl);
+ public boolean canOverWriteClass(String className);
+ public void setWrapperGenerated(boolean wrapperGenerated);
+ public TypeDeclaration getTypeDeclaration(String typeName);
+ public String getSourceVersion();
+ public ProcessorEnvironment getProcessorEnvironment();
+ public File getSourceDir();
+ public String getXMLName(String javaName);
+ public void onError(String key);
+ public void onError(String key, Object[] args) throws ModelerException;
+ public void onError(SourcePosition srcPos, String key, Object[] args) throws
ModelerException;
+ public void onError(Localizable msg) throws ModelerException;
+ public void onWarning(Localizable msg);
+ public void onInfo(Localizable msg);
+ public void log(String msg);
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/ModelBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/TypeModeler.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/TypeModeler.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/TypeModeler.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,283 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.modeler.annotation;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.com.sun.tools.ws.processor.modeler.annotation.*;
+import org.jboss.com.sun.xml.ws.util.StringUtils;
+
+import com.sun.mirror.apt.*;
+import com.sun.mirror.declaration.*;
+import com.sun.mirror.type.*;
+import com.sun.mirror.util.*;
+
+
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class TypeModeler implements WebServiceConstants {
+
+ public static TypeDeclaration getDeclaration(TypeMirror typeMirror) {
+ TypeDeclaration retDecl = null;
+ if (typeMirror instanceof DeclaredType)
+ return ((DeclaredType)typeMirror).getDeclaration();
+ return null;
+ }
+
+ public static TypeDeclaration getTypeDeclaration(TypeMirror type) {
+ TypeDeclaration typeDecl = null;
+ if (type instanceof ClassType)
+ typeDecl = ((ClassType)type).getDeclaration();
+ else
+ typeDecl = ((InterfaceType)type).getDeclaration();
+ return typeDecl;
+ }
+
+ public static Collection<InterfaceType> getSuperinterfaces(TypeMirror type) {
+ Collection<InterfaceType> interfaces = null;
+ if (type instanceof ClassType)
+ interfaces = ((ClassType)type).getSuperinterfaces();
+ else
+ interfaces = ((InterfaceType)type).getSuperinterfaces();
+ return interfaces;
+ }
+
+ public static Collection<InterfaceType> getSuperinterfaces(TypeDeclaration
type) {
+ Collection<InterfaceType> interfaces = null;
+ if (type instanceof ClassDeclaration)
+ interfaces = ((ClassDeclaration)type).getSuperinterfaces();
+ else
+ interfaces = ((InterfaceDeclaration)type).getSuperinterfaces();
+ return interfaces;
+ }
+
+ public static TypeDeclaration getDeclaringClassMethod(
+ TypeMirror theClass,
+ String methodName,
+ TypeMirror[] args) {
+
+ return getDeclaringClassMethod(getDeclaration(theClass), methodName, args);
+ }
+
+ public static TypeDeclaration getDeclaringClassMethod(
+ TypeDeclaration theClass,
+ String methodName,
+ TypeMirror[] args) {
+
+ TypeDeclaration retClass = null;
+ if (theClass instanceof ClassDeclaration) {
+ ClassType superClass = ((ClassDeclaration)theClass).getSuperclass();
+ if (superClass != null)
+ retClass = getDeclaringClassMethod(superClass, methodName, args);
+ }
+ if (retClass == null) {
+ for (InterfaceType interfaceType : getSuperinterfaces(theClass))
+ retClass =
+ getDeclaringClassMethod(interfaceType, methodName, args);
+ }
+ if (retClass == null) {
+ Collection<? extends MethodDeclaration> methods;
+ methods = theClass.getMethods();
+ for (MethodDeclaration method : methods) {
+ if (method.getSimpleName().equals(methodName) &&
+ method.getDeclaringType().equals(theClass)) {
+ retClass = theClass;
+ break;
+ }
+ }
+ }
+ return retClass;
+ }
+
+ public static Collection<InterfaceType> collectInterfaces(TypeDeclaration type)
{
+ Collection<InterfaceType> superInterfaces = type.getSuperinterfaces();
+ Collection<InterfaceType> interfaces = type.getSuperinterfaces();
+ for (InterfaceType interfaceType : superInterfaces) {
+ interfaces.addAll(collectInterfaces(getDeclaration(interfaceType)));
+ }
+ return interfaces;
+ }
+
+ public static boolean isSubclass(String subTypeName, String superTypeName,
+ AnnotationProcessorEnvironment env) {
+ return isSubclass(env.getTypeDeclaration(subTypeName),
+ env.getTypeDeclaration(superTypeName));
+ }
+
+ public static boolean isSubclass(
+ TypeDeclaration subType,
+ TypeDeclaration superType) {
+
+ if (subType.equals(superType))
+ return false;
+ return isSubtype(subType, superType);
+ }
+
+ public static TypeMirror getHolderValueType(
+ TypeMirror type,
+ TypeDeclaration defHolder,
+ AnnotationProcessorEnvironment env) {
+
+ TypeDeclaration typeDecl = getDeclaration(type);
+ if (typeDecl == null)
+ return null;
+
+ if (isSubtype(typeDecl, defHolder)) {
+ if (type instanceof DeclaredType) {
+ Collection<TypeMirror> argTypes =
((DeclaredType)type).getActualTypeArguments();
+ if (argTypes.size() == 1) {
+ TypeMirror mirror = argTypes.iterator().next();
+// System.out.println("argsTypes.iterator().next():
"+mirror);
+ return mirror;
+ }
+ else if (argTypes.size() == 0) {
+ FieldDeclaration member = getValueMember(typeDecl);
+ if (member != null) {
+// System.out.println("member: "+member+"
getType(): "+member.getType());
+ return member.getType();
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ public static FieldDeclaration getValueMember(TypeMirror classType) {
+ return getValueMember(getDeclaration(classType));
+ }
+
+ public static FieldDeclaration getValueMember(TypeDeclaration type) {
+ FieldDeclaration member = null;
+ for (FieldDeclaration field : type.getFields()){
+ if (field.getSimpleName().equals("value")) {
+ member = field;
+ break;
+ }
+ }
+ if (member == null) {
+ if (type instanceof ClassDeclaration)
+ member = getValueMember(((ClassDeclaration)type).getSuperclass());
+ }
+ return member;
+ }
+
+
+ /* is d1 a subtype of d2 */
+ public static boolean isSubtype(TypeDeclaration d1, TypeDeclaration d2) {
+ if (d1.equals(d2))
+ return true;
+ ClassDeclaration superClassDecl = null;
+ if (d1 instanceof ClassDeclaration) {
+ ClassType superClass = ((ClassDeclaration)d1).getSuperclass();
+ if (superClass != null) {
+ superClassDecl = superClass.getDeclaration();
+ if (superClassDecl.equals(d2))
+ return true;
+ }
+ }
+ for (InterfaceType superIntf : d1.getSuperinterfaces()) {
+ if (superIntf.getDeclaration().equals(d2)) {
+ return true;
+ }
+ if (isSubtype(superIntf.getDeclaration(), d2)) {
+ return true;
+ } else if (superClassDecl != null && isSubtype(superClassDecl, d2))
{
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static Map<String,TypeMirror> getExceptionProperties(TypeMirror type) {
+ return getExceptionProperties(getDeclaration(type));
+ }
+
+ public static Map<String,TypeMirror> getExceptionProperties(TypeDeclaration
type) {
+ Map<String, TypeMirror> members = new HashMap<String, TypeMirror>();
+ collectExceptionProperties(type, members);
+ return members;
+ }
+
+ public static void collectExceptionProperties(TypeMirror type,
Map<String,TypeMirror> members) {
+ collectExceptionProperties(getDeclaration(type), members);
+ }
+
+ public static void collectExceptionProperties(TypeDeclaration type,
Map<String,TypeMirror> members) {
+// System.out.println("type: "+type.toString());
+ Collection<? extends MethodDeclaration> methods;
+ methods = type.getMethods();
+ for (MethodDeclaration method : methods) {
+ Collection<Modifier> modifiers = method.getModifiers();
+ if (!modifiers.contains(Modifier.PUBLIC)
+ || (modifiers.contains(Modifier.FINAL) &&
+ modifiers.contains(Modifier.STATIC))
+ || modifiers.contains(Modifier.TRANSIENT)) { // no final static,
transient, non-public
+ continue;
+ }
+ String name = method.getSimpleName();
+ if (name.length() <= 3 && !name.startsWith(IS_PREFIX) ||
+ skipProperties.contains(name)) {
+ // Optimization. Don't bother with invalid propertyNames.
+ continue;
+ }
+ TypeMirror resultType = method.getReturnType();
+ Collection<ParameterDeclaration> params = method.getParameters();
+ if (params.size() == 0) {
+ if (name.startsWith(GET_PREFIX) &&
+ !(resultType instanceof PrimitiveType &&
+ ((PrimitiveType)resultType).getKind() ==
PrimitiveType.Kind.BOOLEAN)) {
+ // Simple getter
+// System.out.println("exception property: "+
StringUtils.decapitalize(name.substring(3)));
+ members.put(StringUtils.decapitalize(name.substring(3)), resultType);
+ } else if (resultType instanceof PrimitiveType &&
+ ((PrimitiveType)resultType).getKind() ==
PrimitiveType.Kind.BOOLEAN &&
+ name.startsWith(IS_PREFIX)) {
+ // Boolean getter
+// System.out.println("exception property: "+
StringUtils.decapitalize(name.substring(2)));
+ members.put(StringUtils.decapitalize(name.substring(2)),
resultType);
+ }
+ }
+ }
+// System.out.println("type class: "+type.getClass().toString());
+ if (type instanceof ClassDeclaration &&
((ClassDeclaration)type).getSuperclass() != null) {
+ collectExceptionProperties(((ClassDeclaration)type).getSuperclass(),
members);
+ }
+ for (InterfaceType intfType : getSuperinterfaces(type)) {
+ collectExceptionProperties(intfType, members);
+ }
+ }
+
+ private static Set<String> skipProperties = new HashSet<String> ();
+ static{
+ skipProperties.add("getCause");
+ skipProperties.add("getLocalizedMessage");
+ skipProperties.add("getClass");
+ skipProperties.add("getStackTrace");
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/TypeModeler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/TypeMoniker.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/TypeMoniker.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/TypeMoniker.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,36 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.modeler.annotation;
+
+import org.jboss.com.sun.tools.ws.processor.modeler.annotation.*;
+
+import com.sun.mirror.type.TypeMirror;
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+
+/**
+ *
+ * @author dkohlert
+ */
+public interface TypeMoniker {
+
+ public TypeMirror create(AnnotationProcessorEnvironment apEnv);
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/TypeMoniker.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/TypeMonikerFactory.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/TypeMonikerFactory.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/TypeMonikerFactory.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,108 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.modeler.annotation;
+
+
+import com.sun.mirror.declaration.TypeDeclaration;
+import com.sun.mirror.type.*;
+import com.sun.mirror.util.Types;
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+
+import java.util.Collection;
+import java.util.ArrayList;
+
+import org.jboss.com.sun.tools.ws.processor.modeler.annotation.*;
+
+/**
+ *
+ * @author dkohlert
+ */
+public class TypeMonikerFactory {
+
+ public static TypeMoniker getTypeMoniker(TypeMirror typeMirror) {
+ if (typeMirror instanceof PrimitiveType)
+ return new PrimitiveTypeMoniker((PrimitiveType)typeMirror);
+ else if (typeMirror instanceof ArrayType)
+ return new ArrayTypeMoniker((ArrayType)typeMirror);
+ else if (typeMirror instanceof DeclaredType)
+ return new DeclaredTypeMoniker((DeclaredType)typeMirror);
+ return getTypeMoniker(typeMirror.toString());
+ }
+
+ public static TypeMoniker getTypeMoniker(String typeName) {
+ return new StringMoniker(typeName);
+ }
+
+ static class ArrayTypeMoniker implements TypeMoniker {
+ private TypeMoniker arrayType;
+
+ public ArrayTypeMoniker(ArrayType type) {
+ arrayType = TypeMonikerFactory.getTypeMoniker(type.getComponentType());
+ }
+
+ public TypeMirror create(AnnotationProcessorEnvironment apEnv) {
+ return apEnv.getTypeUtils().getArrayType(arrayType.create(apEnv));
+ }
+ }
+ static class DeclaredTypeMoniker implements TypeMoniker {
+ private String typeDeclName;
+ private Collection<TypeMoniker> typeArgs = new
ArrayList<TypeMoniker>();
+
+ public DeclaredTypeMoniker(DeclaredType type) {
+ typeDeclName = type.getDeclaration().getQualifiedName();
+ for (TypeMirror arg : type.getActualTypeArguments())
+ typeArgs.add(TypeMonikerFactory.getTypeMoniker(arg));
+ }
+
+ public TypeMirror create(AnnotationProcessorEnvironment apEnv) {
+ TypeDeclaration typeDecl = apEnv.getTypeDeclaration(typeDeclName);
+ TypeMirror[] tmpArgs = new TypeMirror[typeArgs.size()];
+ int idx = 0;
+ for (TypeMoniker moniker : typeArgs)
+ tmpArgs[idx++] = moniker.create(apEnv);
+
+ return apEnv.getTypeUtils().getDeclaredType(typeDecl, tmpArgs);
+ }
+ }
+ static class PrimitiveTypeMoniker implements TypeMoniker {
+ private PrimitiveType.Kind kind;
+
+ public PrimitiveTypeMoniker(PrimitiveType type) {
+ kind = type.getKind();
+ }
+
+ public TypeMirror create(AnnotationProcessorEnvironment apEnv) {
+ return apEnv.getTypeUtils().getPrimitiveType(kind);
+ }
+ }
+ static class StringMoniker implements TypeMoniker {
+ private String typeName;
+
+ public StringMoniker(String typeName) {
+ this.typeName = typeName;
+ }
+
+ public TypeMirror create(AnnotationProcessorEnvironment apEnv) {
+ return
apEnv.getTypeUtils().getDeclaredType(apEnv.getTypeDeclaration(typeName));
+ }
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/TypeMonikerFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/WebServiceAP.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/WebServiceAP.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/WebServiceAP.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,493 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.modeler.annotation;
+
+import com.sun.mirror.apt.AnnotationProcessor;
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.apt.Messager;
+import com.sun.mirror.declaration.ClassDeclaration;
+import com.sun.mirror.declaration.InterfaceDeclaration;
+import com.sun.mirror.declaration.MethodDeclaration;
+import com.sun.mirror.declaration.TypeDeclaration;
+import com.sun.mirror.declaration.TypeParameterDeclaration;
+import com.sun.mirror.type.ClassType;
+import com.sun.mirror.type.InterfaceType;
+import com.sun.mirror.type.TypeMirror;
+import com.sun.mirror.util.SourcePosition;
+import com.sun.tools.xjc.api.JavaCompiler;
+import com.sun.tools.xjc.api.Reference;
+import com.sun.tools.xjc.api.XJC;
+
+import javax.jws.WebService;
+import javax.xml.namespace.QName;
+import javax.xml.ws.WebServiceProvider;
+
+import org.jboss.com.sun.tools.ws.ToolVersion;
+import org.jboss.com.sun.tools.ws.processor.ProcessorNotificationListener;
+import org.jboss.com.sun.tools.ws.processor.ProcessorOptions;
+import org.jboss.com.sun.tools.ws.processor.generator.GeneratorUtil;
+import org.jboss.com.sun.tools.ws.processor.generator.Names;
+import org.jboss.com.sun.tools.ws.processor.model.Model;
+import org.jboss.com.sun.tools.ws.processor.model.ModelProperties;
+import org.jboss.com.sun.tools.ws.processor.model.Operation;
+import org.jboss.com.sun.tools.ws.processor.model.Port;
+import org.jboss.com.sun.tools.ws.processor.model.Service;
+import org.jboss.com.sun.tools.ws.processor.model.jaxb.JAXBModel;
+import org.jboss.com.sun.tools.ws.processor.modeler.ModelerException;
+import
org.jboss.com.sun.tools.ws.processor.modeler.annotation.AnnotationProcessorContext.SEIContext;
+import org.jboss.com.sun.tools.ws.processor.util.ClientProcessorEnvironment;
+import org.jboss.com.sun.tools.ws.processor.util.ProcessorEnvironment;
+import org.jboss.com.sun.tools.ws.util.ToolBase;
+import org.jboss.com.sun.xml.ws.util.localization.Localizable;
+import org.jboss.com.sun.xml.ws.util.localization.LocalizableMessage;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+
+
+/**
+ * WebServiceAP is a APT AnnotationProcessor for processing javax.jws.* and
+ * javax.xml.ws.* annotations. This class is used either by the WsGen (CompileTool) tool
or
+ * idirectly via the {@link org.jboss.com.sun.istack.ws.WSAP WSAP} when invoked by
APT.
+ *
+ * @author WS Development Team
+ */
+public class WebServiceAP extends ToolBase implements AnnotationProcessor, ModelBuilder,
WebServiceConstants,
+ ProcessorNotificationListener {
+
+ protected AnnotationProcessorEnvironment apEnv;
+ protected ProcessorEnvironment env;
+
+ private File sourceDir;
+
+ // the model being build
+ private Model model;
+
+ private TypeDeclaration remoteDecl;
+ private TypeDeclaration remoteExceptionDecl;
+ private TypeDeclaration exceptionDecl;
+ private TypeDeclaration defHolderDecl;
+ private Service service;
+ private Port port;
+ protected AnnotationProcessorContext context;
+ private Set<TypeDeclaration> processedTypeDecls = new
HashSet<TypeDeclaration>();
+ protected Messager messager;
+ private ByteArrayOutputStream output;
+ private ToolBase tool;
+ private boolean doNotOverWrite = false;
+ private boolean wrapperGenerated = false;
+ /*
+ * Is this invocation from APT or JavaC?
+ */
+ private boolean isAPTInvocation = false;
+
+
+ public void run() {
+ }
+
+ protected boolean parseArguments(String[] args) {
+ return true;
+ }
+
+ public WebServiceAP(ToolBase tool, ProcessorEnvironment env, Properties options,
AnnotationProcessorContext context) {
+ super(System.out, "WebServiceAP");
+ this.context = context;
+ this.tool = tool;
+ this.env = env;
+ if (options != null) {
+ sourceDir = new
File(options.getProperty(ProcessorOptions.SOURCE_DIRECTORY_PROPERTY));
+ String key = ProcessorOptions.DONOT_OVERWRITE_CLASSES;
+ this.doNotOverWrite =
+ Boolean.valueOf(options.getProperty(key));
+ }
+ }
+
+ public void init(AnnotationProcessorEnvironment apEnv) {
+ this.apEnv = apEnv;
+ remoteDecl = this.apEnv.getTypeDeclaration(REMOTE_CLASSNAME);
+ remoteExceptionDecl = this.apEnv.getTypeDeclaration(REMOTE_EXCEPTION_CLASSNAME);
+ exceptionDecl = this.apEnv.getTypeDeclaration(EXCEPTION_CLASSNAME);
+ defHolderDecl = this.apEnv.getTypeDeclaration(HOLDER_CLASSNAME);
+
+ if (env == null) {
+ Map<String, String> apOptions = apEnv.getOptions();
+ output = new ByteArrayOutputStream();
+ String classDir = apOptions.get("-d");
+ if (classDir == null)
+ classDir = ".";
+ if (apOptions.get("-s") != null)
+ sourceDir = new File(apOptions.get("-s"));
+ else
+ sourceDir = new File(classDir);
+ String cp = apOptions.get("-classpath");
+ String cpath = classDir +
+ File.pathSeparator +
+ cp + File.pathSeparator +
+ System.getProperty("java.class.path");
+ env = new ClientProcessorEnvironment(output, cpath, this);
+ ((ClientProcessorEnvironment) env).setNames(new Names());
+ boolean setVerbose = false;
+ for (String key : apOptions.keySet()) {
+ if (key.equals("-verbose"))
+ setVerbose=true;
+ }
+ if (setVerbose) {
+ env.setFlags(ProcessorEnvironment.F_VERBOSE);
+ }
+ messager = apEnv.getMessager();
+ isAPTInvocation = true;
+ }
+ env.setFiler(apEnv.getFiler());
+ }
+
+ public AnnotationProcessorEnvironment getAPEnv() {
+ return apEnv;
+ }
+
+ public ProcessorEnvironment getEnvironment() {
+ return env;
+ }
+
+ public ProcessorEnvironment getProcessorEnvironment() {
+ return env;
+ }
+
+ public File getSourceDir() {
+ return sourceDir;
+ }
+
+ public void onError(String key) {
+ onError(new LocalizableMessage(getResourceBundleName(), key));
+ }
+
+ public void onError(String key, Object[] args) throws ModelerException {
+ onError(null, key, args);
+ }
+
+ public void onError(SourcePosition pos, String key, Object[] args) throws
ModelerException {
+ onError(pos, new LocalizableMessage(getResourceBundleName(), key, args));
+ }
+
+ public void onError(Localizable msg) throws ModelerException {
+ onError(null, msg);
+ }
+
+ public void onError(SourcePosition pos, Localizable msg) throws ModelerException {
+ if (messager != null) {
+ messager.printError(pos, localizer.localize(msg));
+ } else {
+ throw new ModelerException(msg);
+ }
+ }
+
+ public void onWarning(String key) {
+ onWarning(new LocalizableMessage(getResourceBundleName(), key));
+ }
+
+ public void onWarning(Localizable msg) {
+ String message = localizer.localize(getMessage("webserviceap.warning",
localizer.localize(msg)));
+ if (messager != null) {
+ messager.printWarning(message);
+ } else {
+ report(message);
+ }
+ }
+ public void onInfo(Localizable msg) {
+ if (messager != null) {
+ String message = localizer.localize(msg);
+ messager.printNotice(message);
+ } else {
+ String message = localizer.localize(getMessage("webserviceap.info",
localizer.localize(msg)));
+ report(message);
+ }
+ }
+
+ public void process() {
+ if (context.getRound() == 1) {
+ buildModel();
+ }
+ if (!wrapperGenerated || // the wrappers already exist
+ context.getRound() == 2 ||
+ context.allEncoded()) {
+ if ((context.getRound() == 2 || !wrapperGenerated) &&
!context.isModelCompleted()) {
+ completeModel();
+ context.setModelCompleted(true);
+ }
+ try {
+ for (SEIContext seiContext : context.getSEIContexts()) {
+ if (!seiContext.getModelCompiled()) {
+ runProcessorActions(seiContext.getModel());
+ seiContext.setModelCompiled(true);
+ }
+ }
+ } catch(Exception e) {
+ e.printStackTrace();
+ } finally {
+ if (messager != null && output != null && output.size()
> 0) {
+ messager.printNotice(output.toString());
+ }
+ }
+ }
+ context.incrementRound();
+ }
+
+ public boolean checkAndSetProcessed(TypeDeclaration typeDecl) {
+ if (!processedTypeDecls.contains(typeDecl)) {
+ processedTypeDecls.add(typeDecl);
+ return false;
+ }
+ return true;
+ }
+
+ public void clearProcessed() {
+ processedTypeDecls.clear();
+ }
+
+ protected void runProcessorActions(Model model) throws Exception {
+ if (tool != null)
+ tool.runProcessorActions();
+ }
+
+
+ protected String getGenericErrorMessage() {
+ return "webserviceap.error";
+ }
+
+ protected String getResourceBundleName() {
+ return "org.jboss.com.sun.tools.ws.resources.webserviceap";
+ }
+
+ public void createModel(TypeDeclaration d, QName modelName, String targetNamespace,
+ String modelerClassName){
+
+ SEIContext seiContext = context.getSEIContext(d);
+ if (seiContext.getModel() != null) {
+ onError("webserviceap.model.already.exists");
+ return;
+ }
+ log("creating model: " + modelName);
+ model = new Model(modelName);
+ model.setTargetNamespaceURI(targetNamespace);
+ model.setProperty(
+ ModelProperties.PROPERTY_MODELER_NAME,
+ modelerClassName);
+ seiContext.setModel(model);
+ }
+
+ public void setService(Service service) {
+ this.service = service;
+ model.addService(service);
+ }
+
+ public void setPort(Port port) {
+ this.port = port;
+ service.addPort(port);
+ }
+
+ public void addOperation(Operation operation) {
+ port.addOperation(operation);
+ }
+
+ public void setWrapperGenerated(boolean wrapperGenerated) {
+ this.wrapperGenerated = wrapperGenerated;
+ }
+
+ public TypeDeclaration getTypeDeclaration(String typeName) {
+ return apEnv.getTypeDeclaration(typeName);
+ }
+
+ public String getSourceVersion() {
+ return ToolVersion.VERSION.MAJOR_VERSION;
+ }
+
+ private void buildModel() {
+ WebService webService;
+ WebServiceProvider webServiceProvider = null;
+ WebServiceVisitor wrapperGenerator = createWrapperGenerator();
+ boolean processedEndpoint = false;
+ for (TypeDeclaration typedecl: apEnv.getTypeDeclarations()) {
+ if (!(typedecl instanceof ClassDeclaration))
+ continue;
+ webServiceProvider = typedecl.getAnnotation(WebServiceProvider.class);
+ webService = typedecl.getAnnotation(WebService.class);
+ if (webServiceProvider != null) {
+ if (webService != null) {
+ onError("webserviceap.webservice.and.webserviceprovider",
+ new Object[] {typedecl.getQualifiedName()});
+ }
+ processedEndpoint = true;
+ }
+ if (!shouldProcessWebService(webService))
+ continue;
+ typedecl.accept(wrapperGenerator);
+ processedEndpoint = true;
+ }
+ if (!processedEndpoint) {
+ if (isAPTInvocation)
+ onWarning("webserviceap.no.webservice.endpoint.found");
+ else
+ onError("webserviceap.no.webservice.endpoint.found");
+ }
+ }
+
+ protected WebServiceVisitor createWrapperGenerator() {
+ return new WebServiceWrapperGenerator(this, context);
+ }
+
+ protected WebServiceVisitor createReferenceCollector() {
+ return new WebServiceReferenceCollector(this, context);
+ }
+
+ protected boolean shouldProcessWebService(WebService webService) {
+ return webService != null;
+ }
+
+
+ private void completeModel() {
+ clearProcessed();
+ JavaCompiler javaC = XJC.createJavaCompiler();
+ JAXBModel jaxBModel;
+ WebServiceVisitor referenceCollector = createReferenceCollector();
+ for (SEIContext seiContext : context.getSEIContexts()) {
+ log("completing model for endpoint:
"+seiContext.getSEIImplName());
+ TypeDeclaration decl =
apEnv.getTypeDeclaration(seiContext.getSEIImplName());
+ if (decl == null)
+ onError("webserviceap.could.not.find.typedecl",
+ new Object[] {seiContext.getSEIImplName(),
context.getRound()});
+ decl.accept(referenceCollector);
+ }
+ clearProcessed();
+ for (SEIContext seiContext : context.getSEIContexts()) {
+ TypeDeclaration decl = apEnv.getTypeDeclaration(seiContext.getSEIName());
+ Collection<Reference> schemaMirrors =
seiContext.getSchemaReferences(this);
+
+// System.out.println("schemaMirrors count: " +
schemaMirrors.size());
+// for (Reference reference : schemaMirrors)
{System.out.println("reference: "+reference.type);}
+// System.out.println("schemaElementMap count: "+
seiContext.getSchemaElementMap(this).entrySet().size());
+// for (Map.Entry<QName, ? extends Reference> entry :
seiContext.getSchemaElementMap(this).entrySet()) {
+// System.out.println("name: " + entry.getKey()+" value:
"+entry.getValue().type);
+// }
+
+// System.out.println("setting default namespaceURI:
"+seiContext.getNamespaceURI());
+ jaxBModel = new JAXBModel(javaC.bind(schemaMirrors,
seiContext.getSchemaElementMap(this),
+ seiContext.getNamespaceURI(), apEnv));
+// for (JAXBMapping map : jaxBModel.getMappings())
{System.out.println("map.getClazz: "+map.getClazz());}
+ seiContext.setJAXBModel(jaxBModel);
+ }
+ }
+
+ public boolean isException(TypeDeclaration typeDecl) {
+ return isSubtype(typeDecl, exceptionDecl);
+ }
+
+ public boolean isRemoteException(TypeDeclaration typeDecl) {
+ return isSubtype(typeDecl, remoteExceptionDecl);
+ }
+
+ public boolean isRemote(TypeDeclaration typeDecl) {
+ return isSubtype(typeDecl, remoteDecl);
+ }
+
+
+ public static boolean isSubtype(TypeDeclaration d1, TypeDeclaration d2) {
+ if (d1.equals(d2))
+ return true;
+ ClassDeclaration superClassDecl = null;
+ if (d1 instanceof ClassDeclaration) {
+ ClassType superClass = ((ClassDeclaration)d1).getSuperclass();
+ if (superClass != null) {
+ superClassDecl = superClass.getDeclaration();
+ if (superClassDecl.equals(d2))
+ return true;
+ }
+ }
+ InterfaceDeclaration superIntf = null;
+ for (InterfaceType interfaceType : d1.getSuperinterfaces()) {
+ superIntf = interfaceType.getDeclaration();
+ if (superIntf.equals(d2))
+ return true;
+ }
+ if (superIntf != null && isSubtype(superIntf, d2)) {
+ return true;
+ } else if (superClassDecl != null && isSubtype(superClassDecl, d2)) {
+ return true;
+ }
+ return false;
+ }
+
+
+ public static String getMethodSig(MethodDeclaration method) {
+ StringBuffer buf = new StringBuffer(method.getSimpleName() + "(");
+ Iterator<TypeParameterDeclaration> params =
method.getFormalTypeParameters().iterator();
+ TypeParameterDeclaration param;
+ for (int i =0; params.hasNext(); i++) {
+ if (i > 0)
+ buf.append(", ");
+ param = params.next();
+ buf.append(param.getSimpleName());
+ }
+ buf.append(")");
+ return buf.toString();
+ }
+
+ public String getOperationName(String messageName) {
+ return messageName;
+ }
+
+ public String getResponseName(String operationName) {
+ return Names.getResponseName(operationName);
+ }
+
+
+ public TypeMirror getHolderValueType(TypeMirror type) {
+ return TypeModeler.getHolderValueType(type, defHolderDecl, apEnv);
+ }
+
+ public boolean canOverWriteClass(String className) {
+ return !((doNotOverWrite && GeneratorUtil.classExists(env, className)));
+ }
+
+ public void log(String msg) {
+ if (env != null && env.verbose()) {
+ String message = "[" + msg + "]";
+ if (messager != null) {
+ messager.printNotice(message);
+ } else {
+ System.out.println(message);
+ }
+ }
+ }
+
+ public String getXMLName(String javaName) {
+ return javaName;
+ }
+}
+
+
+
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/WebServiceAP.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/WebServiceConstants.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/WebServiceConstants.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/WebServiceConstants.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,92 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.modeler.annotation;
+
+
+import javax.xml.ws.Holder;
+/**
+ *
+ * @author dkohlert
+ */
+public interface WebServiceConstants { //extends RmiConstants {
+
+ public static final String RETURN = "return";
+ public static final String RETURN_CAPPED = "Return";
+ public static final String RETURN_VALUE = "_return";
+ public static final String SERVICE = "Service";
+ public static final String PD = ".";
+ public static final String JAXWS = "jaxws";
+ public static final String JAXWS_PACKAGE_PD = JAXWS+PD;
+ public static final String PD_JAXWS_PACKAGE_PD = PD+JAXWS+PD;
+ public static final String BEAN = "Bean";
+ public static final String GET_PREFIX = "get";
+ public static final String IS_PREFIX = "is";
+ public static final String FAULT_INFO = "faultInfo";
+ public static final String GET_FAULT_INFO = "getFaultInfo";
+ public static final String HTTP_PREFIX = "http://";
+ public static final String JAVA_LANG_OBJECT =
"java.lang.Object";
+ public static final String EMTPY_NAMESPACE_ID = "";
+
+
+ public static final char SIGC_INNERCLASS = '$';
+ public static final char SIGC_UNDERSCORE = '_';
+
+ public static final String DOT = ".";
+ public static final String PORT = "Port";
+ public static final String BINDING = "Binding";
+ public static final String RESPONSE = "Response";
+
+ /*
+ * Identifiers potentially useful for all Generators
+ */
+ public static final String EXCEPTION_CLASSNAME =
+ java.lang.Exception.class.getName();
+ public static final String REMOTE_CLASSNAME =
+ java.rmi.Remote.class.getName();
+ public static final String REMOTE_EXCEPTION_CLASSNAME =
+ java.rmi.RemoteException.class.getName();
+ public static final String RUNTIME_EXCEPTION_CLASSNAME =
+ java.lang.RuntimeException.class.getName();
+ public static final String SERIALIZABLE_CLASSNAME =
+ java.io.Serializable.class.getName();
+ public static final String HOLDER_CLASSNAME =
+ javax.xml.ws.Holder.class.getName();
+ public static final String COLLECTION_CLASSNAME =
+ java.util.Collection.class.getName();
+ public static final String MAP_CLASSNAME =
+ java.util.Map.class.getName();
+
+
+ // 181 constants
+ public static final String WEBSERVICE_NAMESPACE =
"http://www.bea.com/xml/ns/jws";
+ public static final String HANDLER_CONFIG =
"handler-config";
+ public static final String HANDLER_CHAIN = "handler-chain";
+ public static final String HANDLER_CHAIN_NAME =
"handler-chain-name";
+ public static final String HANDLER = "handler";
+ public static final String HANDLER_NAME = "handler-name";
+ public static final String HANDLER_CLASS = "handler-class";
+ public static final String INIT_PARAM = "init-param";
+ public static final String SOAP_ROLE = "soap-role";
+ public static final String SOAP_HEADER = "soap-header";
+ public static final String PARAM_NAME = "param-name";
+ public static final String PARAM_VALUE = "param-value";
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/WebServiceConstants.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/WebServiceReferenceCollector.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/WebServiceReferenceCollector.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/WebServiceReferenceCollector.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,85 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.modeler.annotation;
+
+import com.sun.mirror.apt.*;
+import com.sun.mirror.declaration.*;
+import com.sun.mirror.type.*;
+
+import com.sun.tools.xjc.api.*;
+
+import javax.jws.*;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class WebServiceReferenceCollector extends WebServiceVisitor {
+
+ public WebServiceReferenceCollector(ModelBuilder builder, AnnotationProcessorContext
context) {
+ super(builder, context);
+ }
+
+
+ protected void processWebService(WebService webService, TypeDeclaration d) {
+ }
+
+ protected void processMethod(MethodDeclaration method, WebMethod webMethod) {
+ boolean isOneway = method.getAnnotation(Oneway.class) != null;
+ boolean generatedWrapper = false;
+ builder.log("WebServiceReferenceCollector - method: "+method);
+ collectTypes(method, webMethod, seiContext.getReqOperationWrapper(method) !=
null);
+ if (seiContext.getReqOperationWrapper(method) != null) {
+ AnnotationProcessorEnvironment apEnv = builder.getAPEnv();
+ TypeDeclaration typeDecl;
+ typeDecl =
builder.getTypeDeclaration(seiContext.getReqOperationWrapper(method).getWrapperName());
+ seiContext.addReference(typeDecl, apEnv);
+ if (!isOneway) {
+ typeDecl =
builder.getTypeDeclaration(seiContext.getResOperationWrapper(method).getWrapperName());
+ seiContext.addReference(typeDecl, apEnv);
+ }
+ }
+ collectExceptionBeans(method);
+ }
+
+ private void collectTypes(MethodDeclaration method, WebMethod webMethod, boolean
isDocLitWrapped) {
+ addSchemaElements(method, isDocLitWrapped);
+ }
+
+
+ private void collectExceptionBeans(MethodDeclaration method) {
+ AnnotationProcessorEnvironment apEnv = builder.getAPEnv();
+ for (ReferenceType thrownType : method.getThrownTypes()) {
+ FaultInfo faultInfo =
seiContext.getExceptionBeanName(thrownType.toString());
+ if (faultInfo != null) {
+ if (!faultInfo.isWSDLException()) {
+
seiContext.addReference(builder.getTypeDeclaration(faultInfo.getBeanName()), apEnv);
+ } else {
+ TypeMirror bean = faultInfo.beanTypeMoniker.create(apEnv);
+ Reference ref =
seiContext.addReference(((DeclaredType)bean).getDeclaration(), apEnv);
+ seiContext.addSchemaElement(faultInfo.getElementName(), ref);
+ }
+ }
+ }
+ }
+}
+
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/WebServiceReferenceCollector.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/WebServiceVisitor.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/WebServiceVisitor.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/WebServiceVisitor.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,908 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.modeler.annotation;
+
+
+import com.sun.mirror.declaration.ClassDeclaration;
+import com.sun.mirror.declaration.ConstructorDeclaration;
+import com.sun.mirror.declaration.Declaration;
+import com.sun.mirror.declaration.FieldDeclaration;
+import com.sun.mirror.declaration.InterfaceDeclaration;
+import com.sun.mirror.declaration.MethodDeclaration;
+import com.sun.mirror.declaration.Modifier;
+import com.sun.mirror.declaration.PackageDeclaration;
+import com.sun.mirror.declaration.ParameterDeclaration;
+import com.sun.mirror.declaration.TypeDeclaration;
+import com.sun.mirror.type.ClassType;
+import com.sun.mirror.type.DeclaredType;
+import com.sun.mirror.type.InterfaceType;
+import com.sun.mirror.type.ReferenceType;
+import com.sun.mirror.type.TypeMirror;
+import com.sun.mirror.type.VoidType;
+import com.sun.mirror.util.DeclarationVisitor;
+import com.sun.mirror.util.SimpleDeclarationVisitor;
+import com.sun.mirror.util.SourcePosition;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.Stack;
+import java.util.StringTokenizer;
+
+
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+
+import javax.jws.HandlerChain;
+import javax.jws.Oneway;
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.jws.soap.SOAPBinding.ParameterStyle;
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.processor.model.Parameter;
+import org.jboss.com.sun.tools.ws.processor.model.Port;
+import org.jboss.com.sun.tools.ws.processor.model.Service;
+import org.jboss.com.sun.tools.ws.processor.model.java.JavaInterface;
+import org.jboss.com.sun.tools.ws.processor.model.java.JavaSimpleType;
+import org.jboss.com.sun.tools.ws.processor.model.java.JavaType;
+import org.jboss.com.sun.tools.ws.processor.modeler.JavaSimpleTypeCreator;
+import
org.jboss.com.sun.tools.ws.processor.modeler.annotation.AnnotationProcessorContext;
+import org.jboss.com.sun.tools.ws.processor.modeler.annotation.ModelBuilder;
+import org.jboss.com.sun.tools.ws.processor.modeler.annotation.WebServiceConstants;
+import
org.jboss.com.sun.tools.ws.processor.modeler.annotation.AnnotationProcessorContext.SEIContext;
+import org.jboss.com.sun.tools.ws.util.ClassNameInfo;
+import org.jboss.com.sun.tools.ws.wsdl.document.soap.SOAPStyle;
+import org.jboss.com.sun.tools.ws.wsdl.document.soap.SOAPUse;
+import org.jboss.com.sun.xml.ws.modeler.RuntimeModeler;
+
+import com.sun.tools.xjc.api.Reference;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public abstract class WebServiceVisitor extends SimpleDeclarationVisitor implements
WebServiceConstants {
+ protected ModelBuilder builder;
+ protected String wsdlNamespace;
+ protected String typeNamespace;
+ protected Stack<SOAPBinding> soapBindingStack;
+ protected SOAPBinding typeDeclSOAPBinding;
+ protected SOAPUse soapUse = SOAPUse.LITERAL;
+ protected SOAPStyle soapStyle = SOAPStyle.DOCUMENT;
+ protected boolean wrapped = true;
+ protected HandlerChain hChain;
+ protected Port port;
+ protected String serviceImplName;
+ protected String endpointInterfaceName;
+ protected AnnotationProcessorContext context;
+ protected SEIContext seiContext;
+ protected boolean processingSEI = false;
+ protected String serviceName;
+ protected String packageName;
+ protected String portName;
+ protected boolean endpointReferencesInterface = false;
+ protected boolean hasWebMethods = false;
+ protected JavaSimpleTypeCreator simpleTypeCreator;
+ protected TypeDeclaration typeDecl;
+ protected Set<String> processedMethods;
+ protected boolean pushedSOAPBinding = false;
+ protected static final String ANNOTATION_ELEMENT_ERROR =
"webserviceap.endpointinteface.plus.element";
+
+
+
+ public WebServiceVisitor(ModelBuilder builder, AnnotationProcessorContext context) {
+ this.builder = builder;
+ this.context = context;
+ this.simpleTypeCreator = new JavaSimpleTypeCreator();
+ soapBindingStack = new Stack<SOAPBinding>();
+ processedMethods = new HashSet<String>();
+ }
+
+ public void visitInterfaceDeclaration(InterfaceDeclaration d) {
+ WebService webService = (WebService)d.getAnnotation(WebService.class);
+ if (!shouldProcessWebService(webService, d))
+ return;
+ if (builder.checkAndSetProcessed(d))
+ return;
+ typeDecl = d;
+ if (endpointInterfaceName != null &&
!endpointInterfaceName.equals(d.getQualifiedName())) {
+ builder.onError(d.getPosition(),
"webserviceap.endpointinterfaces.do.not.match", new Object[]
+ {endpointInterfaceName, d.getQualifiedName()});
+ }
+ verifySEIAnnotations(webService, d);
+ endpointInterfaceName = d.getQualifiedName();
+ processingSEI = true;
+ preProcessWebService(webService, d);
+ processWebService(webService, d);
+ postProcessWebService(webService, d);
+ }
+
+ public void visitClassDeclaration(ClassDeclaration d) {
+ WebService webService = d.getAnnotation(WebService.class);
+ if (!shouldProcessWebService(webService, d))
+ return;
+ if (builder.checkAndSetProcessed(d))
+ return;
+ typeDeclSOAPBinding = d.getAnnotation(SOAPBinding.class);
+ typeDecl = d;
+ if (serviceImplName == null)
+ serviceImplName = d.getQualifiedName();
+ String endpointInterfaceName = webService != null ?
webService.endpointInterface() : null;
+ if (endpointInterfaceName != null && endpointInterfaceName.length() >
0) {
+ SourcePosition pos = pos = d.getPosition();
+ checkForInvalidImplAnnotation(d, SOAPBinding.class);
+ if (webService.name().length() > 0)
+ annotationError(pos, ANNOTATION_ELEMENT_ERROR,"name");
+ endpointReferencesInterface = true;
+ verifyImplAnnotations(d);
+ inspectEndpointInterface(endpointInterfaceName, d);
+ serviceImplName = null;
+ return;
+ }
+ processingSEI = false;
+ preProcessWebService(webService, d);
+ processWebService(webService, d);
+ serviceImplName = null;
+ postProcessWebService(webService, d);
+ serviceImplName = null;
+ }
+
+ protected void verifySEIAnnotations(WebService webService, InterfaceDeclaration d) {
+ if (webService.endpointInterface().length() > 0) {
+ builder.onError(d.getPosition(),
"webservicefactory.endpointinterface.on.interface",
+ new Object[] {d.getQualifiedName(),
webService.endpointInterface()});
+ }
+ if (webService.serviceName().length() > 0) {
+ builder.onError(d.getPosition(),
"webserviceap.invalid.sei.annotation.element",
+ new Object[] {"serviceName", d.getQualifiedName()});
+ }
+ if (webService.portName().length() > 0) {
+ builder.onError(d.getPosition(),
"webserviceap.invalid.sei.annotation.element",
+ new Object[] {"portName", d.getQualifiedName()});
+ }
+ }
+
+ protected void verifyImplAnnotations(ClassDeclaration d) {
+ for (MethodDeclaration method : d.getMethods()) {
+ checkForInvalidImplAnnotation(method, WebMethod.class);
+ checkForInvalidImplAnnotation(method, Oneway.class);
+ checkForInvalidImplAnnotation(method, WebResult.class);
+ for (ParameterDeclaration param : method.getParameters()) {
+ checkForInvalidImplAnnotation(param, WebParam.class);
+ }
+ }
+ }
+
+ protected void checkForInvalidSEIAnnotation(InterfaceDeclaration d, Class
annotationClass) {
+ Object annotation = d.getAnnotation(annotationClass);
+ if (annotation != null) {
+ SourcePosition pos = d.getPosition();
+ annotationError(pos, "webserviceap.invalid.sei.annotation",
+ new Object[] {annotationClass.getName(), d.getQualifiedName()});
+ }
+ }
+
+ protected void checkForInvalidImplAnnotation(Declaration d, Class annotationClass) {
+ Object annotation = d.getAnnotation(annotationClass);
+ if (annotation != null) {
+ SourcePosition pos = d.getPosition();
+ annotationError(pos,
"webserviceap.endpointinteface.plus.annotation",
+ annotationClass.getName());
+ }
+ }
+
+ protected void annotationError(SourcePosition pos, String key, String element) {
+ annotationError(pos, key, new Object[] {element});
+ }
+
+ protected void annotationError(SourcePosition pos, String key, Object[] args) {
+ builder.onError(pos, key, args);
+ }
+
+
+ protected void preProcessWebService(WebService webService, TypeDeclaration d) {
+ seiContext = context.getSEIContext(d);
+ String targetNamespace = null;
+ if (webService != null)
+ targetNamespace = webService.targetNamespace();
+ if (targetNamespace == null || targetNamespace.length() == 0) {
+ String packageName = d.getPackage().getQualifiedName();
+ if (packageName == null || packageName.length() == 0) {
+ builder.onError(d.getPosition(),
"webserviceap.no.package.class.must.have.targetnamespace",
+ new Object[] {d.getQualifiedName()});
+ }
+ targetNamespace = getNamespace(d.getPackage());
+ }
+ seiContext.setNamespaceURI(targetNamespace);
+ if (serviceImplName == null)
+ serviceImplName = seiContext.getSEIImplName();
+ if (serviceImplName != null) {
+ seiContext.setSEIImplName(serviceImplName);
+ context.addSEIContext(serviceImplName, seiContext);
+ }
+ portName = ClassNameInfo.getName(
+ d.getSimpleName().replace(
+ SIGC_INNERCLASS,
+ SIGC_UNDERSCORE));;
+ packageName = d.getPackage().getQualifiedName();
+ portName = webService != null && webService.name() != null
&& webService.name().length() >0 ?
+ webService.name() : portName;
+ serviceName = ClassNameInfo.getName(d.getQualifiedName())+SERVICE;
+ serviceName = webService != null && webService.serviceName() !=
null &&
+ webService.serviceName().length() > 0 ?
+ webService.serviceName() : serviceName;
+ wsdlNamespace = seiContext.getNamespaceURI();
+ typeNamespace = wsdlNamespace;
+
+ SOAPBinding soapBinding = d.getAnnotation(SOAPBinding.class);
+ if (soapBinding != null) {
+ pushedSOAPBinding = pushSOAPBinding(soapBinding, d, d);
+ } else if (d.equals(typeDecl)) {
+ pushedSOAPBinding = pushSOAPBinding(new MySOAPBinding(), d, d);
+ }
+ }
+
+ public static boolean sameStyle(SOAPBinding.Style style, SOAPStyle soapStyle) {
+ if (style.equals(SOAPBinding.Style.DOCUMENT) &&
+ soapStyle.equals(SOAPStyle.DOCUMENT))
+ return true;
+ if (style.equals(SOAPBinding.Style.RPC) &&
+ soapStyle.equals(SOAPStyle.RPC))
+ return true;
+ return false;
+ }
+
+ protected boolean pushSOAPBinding(SOAPBinding soapBinding, Declaration bindingDecl,
+ TypeDeclaration classDecl) {
+ boolean changed = false;
+ if (!sameStyle(soapBinding.style(), soapStyle)) {
+ changed = true;
+ if (pushedSOAPBinding)
+ builder.onError(bindingDecl.getPosition(),
"webserviceap.mixed.binding.style",
+ new Object[] {classDecl.getQualifiedName()});
+ }
+ if (soapBinding.style().equals(SOAPBinding.Style.RPC)) {
+ soapStyle = SOAPStyle.RPC;
+ wrapped = true;
+ if (soapBinding.parameterStyle().equals(ParameterStyle.BARE)) {
+ builder.onError(bindingDecl.getPosition(),
"webserviceap.rpc.literal.must.not.be.bare",
+ new Object[] {classDecl.getQualifiedName()});
+ }
+
+ } else {
+ soapStyle = SOAPStyle.DOCUMENT;
+ if (wrapped != soapBinding.parameterStyle().equals(ParameterStyle.WRAPPED))
{
+ wrapped = soapBinding.parameterStyle().equals(ParameterStyle.WRAPPED);
+ changed = true;
+ }
+ }
+ if (soapBinding.use().equals(SOAPBinding.Use.ENCODED)) {
+ builder.onError(bindingDecl.getPosition(),
"webserviceap.rpc.encoded.not.supported",
+ new Object[] {classDecl.getQualifiedName()});
+ }
+ if (changed || soapBindingStack.empty()) {
+ soapBindingStack.push(soapBinding);
+ pushedSOAPBinding = true;
+ }
+ return changed;
+ }
+
+
+ protected SOAPBinding popSOAPBinding() {
+ if (pushedSOAPBinding)
+ soapBindingStack.pop();
+ SOAPBinding soapBinding = null;
+ if (!soapBindingStack.empty()) {
+ soapBinding = soapBindingStack.peek();
+ if (soapBinding.style().equals(SOAPBinding.Style.RPC)) {
+ soapStyle = SOAPStyle.RPC;
+ wrapped = true;
+ } else {
+ soapStyle = SOAPStyle.DOCUMENT;
+ wrapped = soapBinding.parameterStyle().equals(ParameterStyle.WRAPPED);
+ }
+ }
+ return soapBinding;
+ }
+
+ protected String getNamespace(PackageDeclaration packageDecl) {
+ return RuntimeModeler.getNamespace(packageDecl.getQualifiedName());
+ }
+
+// abstract protected boolean shouldProcessWebService(WebService webService,
InterfaceDeclaration intf);
+
+// abstract protected boolean shouldProcessWebService(WebService webService,
ClassDeclaration decl);
+ protected boolean shouldProcessWebService(WebService webService, InterfaceDeclaration
intf) {
+ hasWebMethods = false;
+ if (webService == null)
+ builder.onError(intf.getPosition(),
"webserviceap.endpointinterface.has.no.webservice.annotation",
+ new Object[] {intf.getQualifiedName()});
+ if (isLegalSEI(intf))
+ return true;
+ return false;
+ }
+
+ protected boolean shouldProcessWebService(WebService webService, ClassDeclaration
classDecl) {
+ if (webService == null)
+ return false;
+ hasWebMethods = hasWebMethods(classDecl);
+ return isLegalImplementation(webService, classDecl);
+ }
+
+ abstract protected void processWebService(WebService webService, TypeDeclaration d);
+
+ protected void postProcessWebService(WebService webService, InterfaceDeclaration d)
{
+ processMethods(d);
+ popSOAPBinding();
+ }
+
+ protected void postProcessWebService(WebService webService, ClassDeclaration d) {
+ processMethods(d);
+ popSOAPBinding();
+ }
+
+
+ protected boolean hasWebMethods(ClassDeclaration d) {
+ if (d.getQualifiedName().equals(JAVA_LANG_OBJECT))
+ return false;
+ WebMethod webMethod;
+ for (MethodDeclaration method : d.getMethods()) {
+ webMethod = method.getAnnotation(WebMethod.class);
+ if (webMethod != null) {
+ if (webMethod.exclude()) {
+ if (webMethod.operationName().length() > 0)
+ builder.onError(method.getPosition(),
"webserviceap.invalid.webmethod.element.with.exclude",
+ new Object[] {"operationName",
d.getQualifiedName(), method.toString()});
+ if (webMethod.action().length() > 0)
+ builder.onError(method.getPosition(),
"webserviceap.invalid.webmethod.element.with.exclude",
+ new Object[] {"action",
d.getQualifiedName(), method.toString()});
+ } else {
+ return true;
+ }
+ }
+ }
+ return false;//hasWebMethods(d.getSuperclass().getDeclaration());
+ }
+
+ protected void processMethods(InterfaceDeclaration d) {
+ builder.log("ProcessedMethods Interface: "+d);
+ hasWebMethods = false;
+ for (MethodDeclaration methodDecl : d.getMethods()) {
+ methodDecl.accept((DeclarationVisitor)this);
+ }
+ for (InterfaceType superType : d.getSuperinterfaces())
+ processMethods(superType.getDeclaration());
+ }
+
+ protected void processMethods(ClassDeclaration d) {
+ builder.log("ProcessedMethods Class: "+d);
+ hasWebMethods = hasWebMethods(d);
+ if (d.getQualifiedName().equals(JAVA_LANG_OBJECT))
+ return;
+ if (d.getAnnotation(WebService.class) != null) {
+ // Super classes must have @WebService annotations to pick up their methods
+ for (MethodDeclaration methodDecl : d.getMethods()) {
+ methodDecl.accept((DeclarationVisitor)this);
+ }
+ }
+ if (d.getSuperclass() != null) {
+ processMethods(d.getSuperclass().getDeclaration());
+ }
+ }
+
+ private InterfaceDeclaration getEndpointInterfaceDecl(String endpointInterfaceName,
+ ClassDeclaration d) {
+ InterfaceDeclaration intTypeDecl = null;
+ for (InterfaceType interfaceType : d.getSuperinterfaces()) {
+ if (endpointInterfaceName.equals(interfaceType.toString())) {
+ intTypeDecl = interfaceType.getDeclaration();
+ seiContext = context.getSEIContext(intTypeDecl.getQualifiedName());
+ assert(seiContext != null);
+ seiContext.setImplementsSEI(true);
+ break;
+ }
+ }
+ if (intTypeDecl == null) {
+ intTypeDecl =
(InterfaceDeclaration)builder.getTypeDeclaration(endpointInterfaceName);
+ }
+ if (intTypeDecl == null)
+ builder.onError("webserviceap.endpointinterface.class.not.found",
+ new Object[] {endpointInterfaceName});
+ return intTypeDecl;
+ }
+
+
+ private void inspectEndpointInterface(String endpointInterfaceName, ClassDeclaration
d) {
+ TypeDeclaration intTypeDecl = getEndpointInterfaceDecl(endpointInterfaceName,
d);
+ if (intTypeDecl != null)
+ intTypeDecl.accept((DeclarationVisitor)this);
+ }
+
+ public void visitMethodDeclaration(MethodDeclaration method) {
+ // Methods must be public
+ if (!method.getModifiers().contains(Modifier.PUBLIC))
+ return;
+ if (processedMethod(method))
+ return;
+ WebMethod webMethod = method.getAnnotation(WebMethod.class);
+ if (webMethod != null && webMethod.exclude())
+ return;
+ SOAPBinding soapBinding = method.getAnnotation(SOAPBinding.class);
+ if (soapBinding == null && !method.getDeclaringType().equals(typeDecl))
{
+ if (method.getDeclaringType() instanceof ClassDeclaration) {
+ soapBinding =
method.getDeclaringType().getAnnotation(SOAPBinding.class);
+ if (soapBinding != null)
+ builder.log("using "+method.getDeclaringType()+"'s
SOAPBinding.");
+ else {
+ soapBinding = new MySOAPBinding();
+ }
+ }
+ }
+ boolean newBinding = false;
+ if (soapBinding != null) {
+ newBinding = pushSOAPBinding(soapBinding, method, typeDecl);
+ }
+ try {
+ if (shouldProcessMethod(method, webMethod)) {
+ processMethod(method, webMethod);
+ }
+ } finally {
+ if (newBinding) {
+ popSOAPBinding();
+ }
+ }
+ }
+
+ protected boolean processedMethod(MethodDeclaration method) {
+ String id = method.toString();
+ if (processedMethods.contains(id))
+ return true;
+ processedMethods.add(id);
+ return false;
+ }
+
+
+ protected boolean shouldProcessMethod(MethodDeclaration method, WebMethod webMethod)
{
+ builder.log("should process method: "+method.getSimpleName()+"
hasWebMethods: "+ hasWebMethods+" ");
+ if (hasWebMethods && webMethod == null) {
+ builder.log("webMethod == null");
+ return false;
+ }
+ boolean retval = (endpointReferencesInterface ||
+ method.getDeclaringType().equals(typeDecl) ||
+ (method.getDeclaringType().getAnnotation(WebService.class) != null));
+ builder.log("endpointReferencesInterface:
"+endpointReferencesInterface);
+ builder.log("declaring class has WebSevice:
"+(method.getDeclaringType().getAnnotation(WebService.class) != null));
+ builder.log("returning: "+retval);
+ return retval;
+ }
+
+ abstract protected void processMethod(MethodDeclaration method, WebMethod
webMethod);
+
+
+ protected boolean isLegalImplementation(WebService webService, ClassDeclaration
classDecl) {
+ Collection<Modifier> modifiers = classDecl.getModifiers();
+ if (!modifiers.contains(Modifier.PUBLIC)){
+ builder.onError(classDecl.getPosition(),
"webserviceap.webservice.class.not.public",
+ new Object[] {classDecl.getQualifiedName()});
+ return false;
+ }
+ if (modifiers.contains(Modifier.FINAL)) {
+ builder.onError(classDecl.getPosition(),
"webserviceap.webservice.class.is.final",
+ new Object[] {classDecl.getQualifiedName()});
+ return false;
+ }
+ if (modifiers.contains(Modifier.ABSTRACT)) {
+ builder.onError(classDecl.getPosition(),
"webserviceap.webservice.class.is.abstract",
+ new Object[] {classDecl.getQualifiedName()});
+ return false;
+ }
+ if (classDecl.getDeclaringType() != null &&
!modifiers.contains(Modifier.STATIC)) {
+ builder.onError(classDecl.getPosition(),
"webserviceap.webservice.class.is.innerclass.not.static",
+ new Object[] {classDecl.getQualifiedName()});
+ return false;
+ }
+ boolean hasDefaultConstructor = false;
+ for (ConstructorDeclaration constructor : classDecl.getConstructors()) {
+ if (constructor.getModifiers().contains(Modifier.PUBLIC) &&
+ constructor.getParameters().size() == 0) {
+ hasDefaultConstructor = true;
+ break;
+ }
+ }
+ if (!hasDefaultConstructor) {
+ builder.onError(classDecl.getPosition(),
"webserviceap.webservice.no.default.constructor",
+ new Object[] {classDecl.getQualifiedName()});
+ return false;
+ }
+ if (webService.endpointInterface().length() == 0) {
+ if (!methodsAreLegal(classDecl))
+ return false;
+ } else {
+ InterfaceDeclaration intfDecl =
getEndpointInterfaceDecl(webService.endpointInterface(), classDecl);
+ if (!classImplementsSEI(classDecl, intfDecl))
+ return false;
+ }
+
+ return true;
+ }
+
+ protected boolean classImplementsSEI(ClassDeclaration classDecl,
+ InterfaceDeclaration intfDecl) {
+ for (InterfaceType interfaceType : classDecl.getSuperinterfaces()) {
+ if (interfaceType.getDeclaration().equals(intfDecl))
+ return true;
+ }
+ boolean implementsMethod;
+ for (MethodDeclaration method : intfDecl.getMethods()) {
+ implementsMethod = false;
+ for (MethodDeclaration classMethod : classDecl.getMethods()) {
+ if (sameMethod(method, classMethod)) {
+ implementsMethod = true;
+ break;
+ }
+ }
+ if (!implementsMethod) {
+ builder.onError(method.getPosition(),
"webserviceap.method.not.implemented",
+ new Object[] {intfDecl.getSimpleName(),
classDecl.getSimpleName(),
+ method});
+ return false;
+ }
+ }
+ return true;
+ }
+
+ protected boolean sameMethod(MethodDeclaration method1, MethodDeclaration method2) {
+ if (!method1.getSimpleName().equals(method2.getSimpleName()))
+ return false;
+ if (!method1.getReturnType().equals(method2.getReturnType()))
+ return false;
+ ParameterDeclaration[] params1 = method1.getParameters().toArray(new
ParameterDeclaration[0]);
+ ParameterDeclaration[] params2 = method2.getParameters().toArray(new
ParameterDeclaration[0]);
+ if (params1.length != params2.length)
+ return false;
+ int pos = 0;
+ for (ParameterDeclaration param1 : method1.getParameters()) {
+ if (!param1.getType().equals(params2[pos++].getType()))
+ return false;
+ }
+ return true;
+ }
+
+ protected boolean isLegalSEI(InterfaceDeclaration intf) {
+ for (FieldDeclaration field : intf.getFields()) {
+ if (field.getConstantValue() != null) {
+
builder.onError("webserviceap.sei.cannot.contain.constant.values",
+ new Object[] {intf.getQualifiedName(), field.getSimpleName()});
+ return false;
+ }
+ }
+ if (!methodsAreLegal(intf))
+ return false;
+ return true;
+ }
+
+ protected boolean methodsAreLegal(InterfaceDeclaration intfDecl) {
+ hasWebMethods = false;
+ for (MethodDeclaration method : intfDecl.getMethods()) {
+ if (!isLegalMethod(method, intfDecl))
+ return false;
+ }
+ for (InterfaceType superIntf : intfDecl.getSuperinterfaces()) {
+ if (!methodsAreLegal(superIntf.getDeclaration()))
+ return false;
+ }
+ return true;
+ }
+
+ protected boolean methodsAreLegal(ClassDeclaration classDecl) {
+ hasWebMethods = hasWebMethods(classDecl);
+ for (MethodDeclaration method : classDecl.getMethods()) {
+ if (!isLegalMethod(method, classDecl))
+ return false;
+ }
+ ClassType superClass = classDecl.getSuperclass();
+ if (superClass != null && !methodsAreLegal(superClass.getDeclaration()))
{
+ return false;
+ }
+ return true;
+ }
+
+
+ protected boolean isLegalMethod(MethodDeclaration method, TypeDeclaration typeDecl)
{
+ WebMethod webMethod = method.getAnnotation(WebMethod.class);
+ if (hasWebMethods && (webMethod == null))
+ return true;
+ if (!hasWebMethods && (webMethod !=null) && webMethod.exclude())
{
+ return true;
+ }
+ if (typeDecl instanceof ClassDeclaration &&
method.getModifiers().contains(Modifier.ABSTRACT)) {
+ builder.onError(method.getPosition(),
"webserviceap.webservice.method.is.abstract",
+ new Object[] {typeDecl.getQualifiedName(), method.getSimpleName()});
+ return false;
+ }
+
+ if (!isLegalType(method.getReturnType())) {
+ builder.onError(method.getPosition(),
"webserviceap.method.return.type.cannot.implement.remote",
+ new Object[] {typeDecl.getQualifiedName(),
+ method.getSimpleName(),
+ method.getReturnType()});
+ }
+ boolean isOneway = method.getAnnotation(Oneway.class) != null;
+ if (isOneway && !isValidOnewayMethod(method, typeDecl))
+ return false;
+
+
+ SOAPBinding soapBinding = method.getAnnotation(SOAPBinding.class);
+ if (soapBinding != null) {
+ if (soapBinding.style().equals(SOAPBinding.Style.RPC)) {
+
builder.onError(method.getPosition(),"webserviceap.rpc.soapbinding.not.allowed.on.method",
+ new Object[] {typeDecl.getQualifiedName(), method.toString()});
+ }
+ }
+
+ int paramIndex = 0;
+ for (ParameterDeclaration parameter : method.getParameters()) {
+ if (!isLegalParameter(parameter, method, typeDecl, paramIndex++))
+ return false;
+ }
+
+ if (!isDocLitWrapped() &&
+ soapStyle.equals(SOAPStyle.DOCUMENT)) {
+ ParameterDeclaration outParam = getOutParameter(method);
+ int inParams = getModeParameterCount(method, WebParam.Mode.IN);
+ int outParams = getModeParameterCount(method, WebParam.Mode.OUT);
+ if (inParams != 1) {
+ builder.onError(method.getPosition(),
+ "webserviceap.doc.bare.and.no.one.in",
+ new Object[] {typeDecl.getQualifiedName(), method.toString()});
+ }
+ if (method.getReturnType() instanceof VoidType) {
+ if (outParam == null && !isOneway) {
+ builder.onError(method.getPosition(),
+ "webserviceap.doc.bare.no.out",
+ new Object[] {typeDecl.getQualifiedName(),
method.toString()});
+ }
+ if (outParams != 1) {
+ if (!isOneway && outParams != 0)
+ builder.onError(method.getPosition(),
+ "webserviceap.doc.bare.no.return.and.no.out",
+ new Object[] {typeDecl.getQualifiedName(),
method.toString()});
+ }
+ } else {
+ if (outParams > 0) {
+ builder.onError(outParam.getPosition(),
+ "webserviceap.doc.bare.return.and.out",
+ new Object[] {typeDecl.getQualifiedName(),
method.toString()});
+ }
+ }
+ }
+ return true;
+ }
+
+ protected boolean isLegalParameter(ParameterDeclaration param,
+ MethodDeclaration method,
+ TypeDeclaration typeDecl,
+ int paramIndex) {
+ if (!isLegalType(param.getType())) {
+ builder.onError(param.getPosition(),
"webserviceap.method.parameter.types.cannot.implement.remote",
+ new Object[] {typeDecl.getQualifiedName(),
+ method.getSimpleName(),
+ param.getSimpleName(),
+ param.getType().toString()});
+ return false;
+ }
+ TypeMirror holderType;
+ holderType = builder.getHolderValueType(param.getType());
+ WebParam webParam = param.getAnnotation(WebParam.class);
+ WebParam.Mode mode = null;
+ if (webParam != null)
+ mode = webParam.mode();
+
+ if (holderType != null) {
+ if (mode != null && mode.equals(WebParam.Mode.IN))
+ builder.onError(param.getPosition(),
"webserviceap.holder.parameters.must.not.be.in.only",
+ new Object[] {typeDecl.getQualifiedName(), method.toString(),
paramIndex});
+ } else if (mode != null && !mode.equals(WebParam.Mode.IN)) {
+ builder.onError(param.getPosition(),
"webserviceap.non.in.parameters.must.be.holder",
+ new Object[] {typeDecl.getQualifiedName(), method.toString(),
paramIndex});
+ }
+
+ return true;
+ }
+
+ protected boolean isDocLitWrapped() {
+ return soapStyle.equals(SOAPStyle.DOCUMENT) && wrapped;
+ }
+
+ protected boolean isValidOnewayMethod(MethodDeclaration method, TypeDeclaration
typeDecl) {
+ boolean valid = true;
+ if (!(method.getReturnType() instanceof VoidType)) {
+ // this is an error, cannot be Oneway and have a return type
+ builder.onError(method.getPosition(),
"webserviceap.oneway.operation.cannot.have.return.type",
+ new Object[] {typeDecl.getQualifiedName(), method.toString()});
+ valid = false;
+ }
+ ParameterDeclaration outParam = getOutParameter(method);
+ if (outParam != null) {
+ builder.onError(outParam.getPosition(),
+ "webserviceap.oneway.and.out",
+ new Object[] {typeDecl.getQualifiedName(), method.toString()});
+ valid = false;
+ }
+ if (!isDocLitWrapped() && soapStyle.equals(SOAPStyle.DOCUMENT)) {
+ int inCnt = getModeParameterCount(method, WebParam.Mode.IN);
+ if (inCnt != 1) {
+ builder.onError(method.getPosition(),
+ "webserviceap.oneway.and.not.one.in",
+ new Object[] {typeDecl.getQualifiedName(), method.toString()});
+ valid = false;
+ }
+ }
+ ClassDeclaration exDecl;
+ for (ReferenceType thrownType : method.getThrownTypes()) {
+ exDecl = ((ClassType)thrownType).getDeclaration();
+ if (!builder.isRemoteException(exDecl)) {
+ builder.onError(method.getPosition(),
"webserviceap.oneway.operation.cannot.declare.exceptions",
+ new Object[] {typeDecl.getQualifiedName(), method.toString(),
exDecl.getQualifiedName()});
+ valid = false;
+ }
+ }
+ return valid;
+ }
+
+ protected int getModeParameterCount(MethodDeclaration method, WebParam.Mode mode) {
+ WebParam webParam;
+ int cnt = 0;
+ for (ParameterDeclaration param : method.getParameters()) {
+ webParam = param.getAnnotation(WebParam.class);
+ if (webParam != null) {
+ if (webParam.header())
+ continue;
+ if (isEquivalentModes(mode, webParam.mode()))
+ cnt++;
+ } else {
+ if (isEquivalentModes(mode, WebParam.Mode.IN)) {
+ cnt++;
+ }
+ }
+ }
+ return cnt;
+ }
+
+ protected boolean isEquivalentModes(WebParam.Mode mode1, WebParam.Mode mode2) {
+ if (mode1.equals(mode2))
+ return true;
+ assert(mode1.equals(WebParam.Mode.IN) ||
+ mode1.equals(WebParam.Mode.OUT));
+ if (mode1.equals(WebParam.Mode.IN) &&
+ !(mode2.equals(WebParam.Mode.OUT)))
+ return true;
+ if (mode1.equals(WebParam.Mode.OUT) &&
+ !(mode2.equals(WebParam.Mode.IN)))
+ return true;
+ return false;
+ }
+
+ protected boolean isHolder(ParameterDeclaration param) {
+ return builder.getHolderValueType(param.getType()) != null;
+ }
+
+ protected boolean isLegalType(TypeMirror type) {
+ if (!(type instanceof DeclaredType))
+ return true;
+ return !builder.isRemote(((DeclaredType)type).getDeclaration());
+ }
+
+ public void addSchemaElements(MethodDeclaration method, boolean isDocLitWrapped) {
+ addReturnSchemaElement(method, isDocLitWrapped);
+ boolean hasInParam = false;
+ for (ParameterDeclaration param : method.getParameters()) {
+ hasInParam |= addParamSchemaElement(param, method, isDocLitWrapped);
+ }
+ if (!hasInParam && soapStyle.equals(SOAPStyle.DOCUMENT) &&
!isDocLitWrapped) {
+ QName paramQName = new QName(wsdlNamespace, method.getSimpleName());
+ seiContext.addSchemaElement(paramQName, null);
+ }
+ }
+
+ public void addReturnSchemaElement(MethodDeclaration method, boolean isDocLitWrapped)
{
+ TypeMirror returnType = method.getReturnType();
+ WebResult webResult = method.getAnnotation(WebResult.class);
+ String responseName = builder.getResponseName(method.getSimpleName());
+ String responseNamespace = wsdlNamespace;
+ boolean isResultHeader = false;
+ if (webResult != null) {
+ responseName = webResult.name().length() > 0 ? webResult.name() :
responseName;
+ responseNamespace = webResult.targetNamespace().length() > 0 ?
webResult.targetNamespace() : responseNamespace;
+ isResultHeader = webResult.header();
+ }
+ QName typeName = new QName(responseNamespace, responseName);
+ if (!(returnType instanceof VoidType) &&
+ (!isDocLitWrapped || isResultHeader)) {
+ Reference ref = seiContext.addReference(method);
+ if (!soapStyle.equals(SOAPStyle.RPC))
+ seiContext.addSchemaElement(typeName, ref);
+ }
+ }
+
+ public boolean addParamSchemaElement(ParameterDeclaration param, MethodDeclaration
method, boolean isDocLitWrappped) {
+ boolean isInParam = false;
+ WebParam webParam = param.getAnnotation(WebParam.class);
+ String paramName = param.getSimpleName();
+ String paramNamespace = wsdlNamespace;
+ TypeMirror paramType = param.getType();
+ TypeMirror holderType = builder.getHolderValueType(paramType);
+ boolean isHeader = false;
+ if (soapStyle.equals(SOAPStyle.DOCUMENT) && !wrapped) {
+ paramName = method.getSimpleName();
+ }
+ if (webParam != null) {
+ paramName = webParam.name() != null && webParam.name().length() >
0 ? webParam.name() : paramName;
+ isHeader = webParam.header();
+ paramNamespace = webParam.targetNamespace().length() > 0 ?
webParam.targetNamespace() : paramNamespace;
+ }
+ if (holderType != null) {
+ paramType = holderType;
+ }
+ if (isHeader || soapStyle.equals(SOAPStyle.DOCUMENT)) {
+ if (isHeader || !isDocLitWrappped) {
+ QName paramQName = new QName(paramNamespace, paramName);
+ Reference ref = seiContext.addReference(paramType, param);
+ seiContext.addSchemaElement(paramQName, ref);
+ }
+ } else
+ seiContext.addReference(paramType, param);
+ if (!isHeader && (holderType == null ||
+ (webParam == null || !webParam.mode().equals(WebParam.Mode.OUT)))) {
+ isInParam = true;
+ }
+ return isInParam;
+ }
+
+ protected ParameterDeclaration getOutParameter(MethodDeclaration method) {
+ WebParam webParam;
+ for (ParameterDeclaration param : method.getParameters()) {
+ webParam = (WebParam)param.getAnnotation(WebParam.class);
+ if (webParam != null &&
+ !webParam.mode().equals(WebParam.Mode.IN)) {
+ return param;
+ }
+ }
+ return null;
+ }
+
+ protected static class MySOAPBinding implements SOAPBinding {
+ public Style style() {return SOAPBinding.Style.DOCUMENT;}
+ public Use use() {return SOAPBinding.Use.LITERAL; }
+ public ParameterStyle parameterStyle() { return
SOAPBinding.ParameterStyle.WRAPPED;}
+ public Class<? extends java.lang.annotation.Annotation> annotationType() {
+ return SOAPBinding.class;
+ }
+ }
+}
+
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/WebServiceVisitor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/WebServiceWrapperGenerator.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/WebServiceWrapperGenerator.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/WebServiceWrapperGenerator.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,589 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.modeler.annotation;
+
+import static com.sun.codemodel.ClassType.CLASS;
+import com.sun.codemodel.CodeWriter;
+import com.sun.codemodel.JAnnotationArrayMember;
+import com.sun.codemodel.JAnnotationUse;
+import com.sun.codemodel.JBlock;
+import com.sun.codemodel.JCodeModel;
+import com.sun.codemodel.JCommentPart;
+import com.sun.codemodel.JDefinedClass;
+import com.sun.codemodel.JDocComment;
+import com.sun.codemodel.JExpr;
+import com.sun.codemodel.JFieldVar;
+import com.sun.codemodel.JMethod;
+import com.sun.codemodel.JMod;
+import com.sun.codemodel.JType;
+import com.sun.codemodel.JVar;
+import com.sun.codemodel.writer.ProgressCodeWriter;
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.declaration.ClassDeclaration;
+import com.sun.mirror.declaration.FieldDeclaration;
+import com.sun.mirror.declaration.InterfaceDeclaration;
+import com.sun.mirror.declaration.MethodDeclaration;
+import com.sun.mirror.declaration.ParameterDeclaration;
+import com.sun.mirror.declaration.TypeDeclaration;
+
+import com.sun.mirror.type.ClassType;
+import com.sun.mirror.type.ReferenceType;
+import com.sun.mirror.type.TypeMirror;
+import com.sun.mirror.type.VoidType;
+
+
+import javax.jws.Oneway;
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
+import javax.xml.namespace.QName;
+import javax.xml.ws.RequestWrapper;
+import javax.xml.ws.ResponseWrapper;
+import javax.xml.ws.WebFault;
+
+import org.jboss.com.sun.tools.ws.ToolVersion;
+import org.jboss.com.sun.tools.ws.processor.generator.GeneratorBase;
+import org.jboss.com.sun.tools.ws.processor.generator.GeneratorConstants;
+import org.jboss.com.sun.tools.ws.processor.generator.Names;
+import org.jboss.com.sun.tools.ws.processor.modeler.ModelerException;
+import org.jboss.com.sun.tools.ws.processor.util.DirectoryUtil;
+import org.jboss.com.sun.tools.ws.processor.util.GeneratedFileInfo;
+import org.jboss.com.sun.tools.ws.processor.util.ProcessorEnvironment;
+import org.jboss.com.sun.tools.ws.util.ClassNameInfo;
+import org.jboss.com.sun.tools.ws.wscompile.FilerCodeWriter;
+import org.jboss.com.sun.tools.ws.wsdl.document.soap.SOAPStyle;
+import org.jboss.com.sun.xml.ws.util.StringUtils;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+
+
+/**
+ * This class generates the request/response and Exception Beans
+ * used by the JAX-WS runtime.
+ *
+ * @author WS Development Team
+ */
+public class WebServiceWrapperGenerator extends WebServiceVisitor {
+ protected Set<String> wrapperNames;
+ protected Set<String> processedExceptions;
+ protected JCodeModel cm;
+ protected MakeSafeTypeVisitor makeSafeVisitor;
+
+
+ public WebServiceWrapperGenerator(ModelBuilder builder, AnnotationProcessorContext
context) {
+ super(builder, context);
+ makeSafeVisitor = new MakeSafeTypeVisitor(builder.getAPEnv());
+ }
+
+ protected void processWebService(WebService webService, TypeDeclaration d) {
+ cm = new JCodeModel();
+ wrapperNames = new HashSet<String>();
+ processedExceptions = new HashSet<String>();
+ }
+
+ protected void postProcessWebService(WebService webService, InterfaceDeclaration d)
{
+ super.postProcessWebService(webService, d);
+ doPostProcessWebService(webService, d);
+ }
+ protected void postProcessWebService(WebService webService, ClassDeclaration d) {
+ super.postProcessWebService(webService, d);
+ doPostProcessWebService(webService, d);
+ }
+
+ protected void doPostProcessWebService(WebService webService, TypeDeclaration d) {
+ if (cm != null) {
+ File sourceDir = builder.getSourceDir();
+ assert(sourceDir != null);
+ ProcessorEnvironment env = builder.getProcessorEnvironment();
+ try {
+ CodeWriter cw = new FilerCodeWriter(sourceDir, env);
+ if(env.verbose())
+ cw = new ProgressCodeWriter(cw, System.out);
+ cm.build(cw);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ protected void processMethod(MethodDeclaration method, WebMethod webMethod) {
+ builder.log("WrapperGen - method: "+method);
+ builder.log("method.getDeclaringType(): "+method.getDeclaringType());
+ boolean generatedWrapper = false;
+ if (wrapped && soapStyle.equals(SOAPStyle.DOCUMENT)) {
+ generatedWrapper = generateWrappers(method, webMethod);
+ }
+ generatedWrapper = generateExceptionBeans(method) || generatedWrapper;
+ if (generatedWrapper) {
+ // Theres not going to be a second round
+ builder.setWrapperGenerated(generatedWrapper);
+ }
+ }
+
+ private boolean generateExceptionBeans(MethodDeclaration method) {
+ String beanPackage = packageName + PD_JAXWS_PACKAGE_PD;
+ if (packageName.length() == 0)
+ beanPackage = JAXWS_PACKAGE_PD;
+ boolean beanGenerated = false;
+ try {
+ for (ReferenceType thrownType : method.getThrownTypes()) {
+ ClassDeclaration typeDecl = ((ClassType)thrownType).getDeclaration();
+ if (typeDecl == null)
+ builder.onError("webserviceap.could.not.find.typedecl",
+ new Object[] {thrownType.toString(), context.getRound()});
+ boolean tmp = generateExceptionBean(typeDecl, beanPackage);
+ beanGenerated = beanGenerated || tmp;
+ }
+ } catch (Exception e) {
+ throw new ModelerException("modeler.nestedGeneratorError",e);
+ }
+ return beanGenerated;
+ }
+
+ private boolean duplicateName(String name) {
+ for (String str : wrapperNames) {
+ if (str.equalsIgnoreCase(name))
+ return true;
+ }
+ wrapperNames.add(name);
+ return false;
+ }
+
+ private boolean generateWrappers(MethodDeclaration method, WebMethod webMethod) {
+ boolean isOneway = method.getAnnotation(Oneway.class) != null;
+ String beanPackage = packageName + PD_JAXWS_PACKAGE_PD;
+ if (packageName.length() == 0)
+ beanPackage = JAXWS_PACKAGE_PD;
+ String methodName = method.getSimpleName();
+ String operationName = builder.getOperationName(methodName);
+ operationName = webMethod != null && webMethod.operationName().length()
> 0 ?
+ webMethod.operationName() : operationName;
+ String reqName = operationName;
+ String resName = operationName+RESPONSE;
+ String reqNamespace = typeNamespace;
+ String resNamespace = typeNamespace;
+
+ String requestClassName = beanPackage +
StringUtils.capitalize(method.getSimpleName());
+ RequestWrapper reqWrapper = method.getAnnotation(RequestWrapper.class);
+ if (reqWrapper != null) {
+ if (reqWrapper.className().length() > 0)
+ requestClassName = reqWrapper.className();
+ if (reqWrapper.localName().length() > 0)
+ reqName = reqWrapper.localName();
+ if (reqWrapper.targetNamespace().length() > 0)
+ reqNamespace = reqWrapper.targetNamespace();
+ }
+ builder.log("requestWrapper: "+requestClassName);
+///// fix for wsgen CR 6442344
+ GeneratedFileInfo gfi=new GeneratedFileInfo();
+ gfi.setFile(new File(DirectoryUtil.getOutputDirectoryFor(requestClassName,
builder.getSourceDir(), builder.getProcessorEnvironment()),
+ Names.stripQualifier(requestClassName) +
GeneratorConstants.JAVA_SRC_SUFFIX));
+ builder.getProcessorEnvironment().addGeneratedFile(gfi);
+//////////
+ boolean canOverwriteRequest = builder.canOverWriteClass(requestClassName);
+ if (!canOverwriteRequest) {
+ builder.log("Class " + requestClassName + " exists. Not
overwriting.");
+ }
+ if (duplicateName(requestClassName) && canOverwriteRequest) {
+
builder.onError("webserviceap.method.request.wrapper.bean.name.not.unique",
+ new Object[] {typeDecl.getQualifiedName(),
method.toString()});
+ }
+
+ String responseClassName = null;
+ boolean canOverwriteResponse = canOverwriteRequest;
+ if (!isOneway) {
+ responseClassName =
beanPackage+StringUtils.capitalize(method.getSimpleName())+RESPONSE;
+ ResponseWrapper resWrapper = method.getAnnotation(ResponseWrapper.class);
+ if(resWrapper != null) {
+ if (resWrapper.className().length() > 0)
+ responseClassName = resWrapper.className();
+ if (resWrapper.localName().length() > 0)
+ resName = resWrapper.localName();
+ if (resWrapper.targetNamespace().length() > 0)
+ resNamespace = resWrapper.targetNamespace();
+ }
+ canOverwriteResponse = builder.canOverWriteClass(requestClassName);
+ if (!canOverwriteResponse) {
+ builder.log("Class " + responseClassName + " exists. Not
overwriting.");
+ }
+ if (duplicateName(responseClassName) && canOverwriteResponse) {
+
builder.onError("webserviceap.method.response.wrapper.bean.name.not.unique",
+ new Object[] {typeDecl.getQualifiedName(),
method.toString()});
+ }
+ ///// fix for wsgen CR 6442344
+ gfi=new GeneratedFileInfo();
+ gfi.setFile(new File(DirectoryUtil.getOutputDirectoryFor(responseClassName,
builder.getSourceDir(), builder.getProcessorEnvironment()),
+ Names.stripQualifier(responseClassName) +
GeneratorConstants.JAVA_SRC_SUFFIX));
+ builder.getProcessorEnvironment().addGeneratedFile(gfi);
+////////////
+ }
+ ArrayList<MemberInfo> reqMembers = new ArrayList<MemberInfo>();
+ ArrayList<MemberInfo> resMembers = new ArrayList<MemberInfo>();
+ WrapperInfo reqWrapperInfo = new WrapperInfo(requestClassName);
+ reqWrapperInfo.setMembers(reqMembers);
+ WrapperInfo resWrapperInfo = null;
+ if (!isOneway) {
+ resWrapperInfo = new WrapperInfo(responseClassName);
+ resWrapperInfo.setMembers(resMembers);
+ }
+ seiContext.setReqWrapperOperation(method, reqWrapperInfo);
+ if (!isOneway)
+ seiContext.setResWrapperOperation(method, resWrapperInfo);
+ try {
+ if (!canOverwriteRequest && !canOverwriteResponse) {
+ return false;
+ }
+
+ JDefinedClass reqCls = null;
+ if (canOverwriteRequest) {
+ reqCls = getCMClass(requestClassName, CLASS);
+ }
+
+ JDefinedClass resCls = null;
+ if (!isOneway && canOverwriteResponse) {
+ resCls = getCMClass(responseClassName, CLASS);
+ }
+
+ // XMLElement Declarations
+ writeXmlElementDeclaration(reqCls, reqName,reqNamespace);
+ writeXmlElementDeclaration(resCls, resName, resNamespace);
+
+ collectMembers(method, operationName, typeNamespace, reqMembers,
resMembers);
+
+ // XmlType
+ writeXmlTypeDeclaration(reqCls, reqName, reqNamespace, reqMembers);
+ writeXmlTypeDeclaration(resCls, resName, resNamespace, resMembers);
+
+ // class members
+ writeMembers(reqCls, reqMembers);
+ writeMembers(resCls, resMembers);
+
+ } catch (Exception e) {
+ throw new ModelerException("modeler.nestedGeneratorError",e);
+ }
+ return true;
+ }
+
+ private void collectMembers(MethodDeclaration method, String operationName, String
namespace,
+ ArrayList<MemberInfo> requestMembers,
+ ArrayList<MemberInfo> responseMembers) {
+
+ AnnotationProcessorEnvironment apEnv = builder.getAPEnv();
+ WebResult webResult = method.getAnnotation(WebResult.class);
+ String responseElementName = RETURN;
+ String responseNamespace = wrapped ? EMTPY_NAMESPACE_ID : typeNamespace;
+ boolean isResultHeader = false;
+ if (webResult != null) {
+ if (webResult.name().length() > 0) {
+ responseElementName = webResult.name();
+ }
+ responseNamespace = webResult.targetNamespace().length() > 1 ?
+ webResult.targetNamespace() :
+ responseNamespace;
+ isResultHeader = webResult.header();
+ }
+
+ // class members
+ WebParam webParam;
+ TypeMirror paramType;
+ String paramName;
+ String paramNamespace;
+ TypeMirror holderType;
+ int paramIndex = -1;
+// System.out.println("method: "+method.toString());
+// System.out.println("returnType: "+ method.getReturnType());
+
+// TypeMirror typeMirror =
apEnv.getTypeUtils().getErasure(method.getReturnType());
+ TypeMirror typeMirror = getSafeType(method.getReturnType());
+ String retType = typeMirror.toString();
+ if (!(method.getReturnType() instanceof VoidType) && !isResultHeader) {
+ responseMembers.add(new MemberInfo(-1, typeMirror, RETURN_VALUE,
+ new QName(responseNamespace, responseElementName)));
+ }
+
+ for (ParameterDeclaration param : method.getParameters()) {
+ WebParam.Mode mode = null;
+ paramIndex++;
+// System.out.println("param.getType(): "+param.getType());
+ holderType = builder.getHolderValueType(param.getType());
+ webParam = param.getAnnotation(WebParam.class);
+// typeMirror = apEnv.getTypeUtils().getErasure(param.getType());
+ typeMirror = getSafeType(param.getType());
+ paramType = typeMirror;
+ paramNamespace = wrapped ? EMTPY_NAMESPACE_ID : typeNamespace;
+ if (holderType != null) {
+ paramType = holderType;
+ }
+ paramName = "arg"+paramIndex;
+ if (webParam != null && webParam.header()) {
+ continue;
+ }
+ if (webParam != null) {
+ mode = webParam.mode();
+ if (webParam.name().length() > 0)
+ paramName = webParam.name();
+ if (webParam.targetNamespace().length() > 0)
+ paramNamespace = webParam.targetNamespace();
+ }
+ MemberInfo memInfo = new MemberInfo(paramIndex, paramType, paramName,
+ new QName(paramNamespace, paramName));
+ if (holderType != null) {
+ if (mode == null || mode.equals(WebParam.Mode.INOUT)) {
+ requestMembers.add(memInfo);
+ }
+ responseMembers.add(memInfo);
+ } else {
+ requestMembers.add(memInfo);
+ }
+ }
+ }
+
+ private TypeMirror getSafeType(TypeMirror type) {
+// System.out.println("type: "+type+" type.getClass():
"+type.getClass());
+ TypeMirror retType = makeSafeVisitor.apply(type,
builder.getAPEnv().getTypeUtils());
+// System.out.println("retType: "+retType+" retType.getClass():
"+retType.getClass());
+ return retType;
+ }
+
+ private JType getType(TypeMirror typeMirror) throws IOException {
+ String type = typeMirror.toString();
+ JType jType = null;
+ try {
+// System.out.println("typeName: "+typeName);
+ jType = cm.parseType(type);
+// System.out.println("type: "+type);
+ return jType;
+ } catch (ClassNotFoundException e) {
+ jType = cm.ref(type);
+ }
+ return jType;
+ }
+
+ private ArrayList<MemberInfo> sortMembers(ArrayList<MemberInfo> members)
{
+ Map<String, MemberInfo> sortedMap = new java.util.TreeMap<String,
MemberInfo>();
+ for (MemberInfo member : members) {
+ sortedMap.put(member.getParamName(), member);
+ }
+ ArrayList<MemberInfo> sortedMembers = new ArrayList<MemberInfo>();
+ sortedMembers.addAll(sortedMap.values());
+ return sortedMembers;
+ }
+
+ private void writeMembers(JDefinedClass cls, ArrayList<MemberInfo> members)
throws IOException {
+ if (cls == null)
+ return;
+ for (MemberInfo memInfo : members) {
+ JType type = getType(memInfo.getParamType());
+ JFieldVar field = cls.field(JMod.PRIVATE, type, memInfo.getParamName());
+ QName elementName = memInfo.getElementName();
+ if (elementName != null) {
+ if (soapStyle.equals(SOAPStyle.RPC) || wrapped) {
+ JAnnotationUse xmlElementAnn = field.annotate(XmlElement.class);
+ xmlElementAnn.param("name", elementName.getLocalPart());
+ xmlElementAnn.param("namespace",
elementName.getNamespaceURI());
+ } else {
+ JAnnotationUse xmlValueAnnn = field.annotate(XmlValue.class);
+ }
+ }
+ }
+ for (MemberInfo memInfo : members) {
+ writeMember(cls, memInfo.getParamIndex(), memInfo.getParamType(),
+ memInfo.getParamName(), memInfo.getElementName());
+ }
+ }
+
+ protected JDefinedClass getCMClass(String className, com.sun.codemodel.ClassType
type) {
+ JDefinedClass cls = null;
+ try {
+ cls = cm._class(className, type);
+ } catch (com.sun.codemodel.JClassAlreadyExistsException e){
+ cls = cm._getClass(className);
+ }
+ return cls;
+ }
+
+ private boolean generateExceptionBean(ClassDeclaration thrownDecl, String
beanPackage) throws IOException {
+ if (builder.isRemoteException(thrownDecl))
+ return false;
+ AnnotationProcessorEnvironment apEnv = builder.getAPEnv();
+ String exceptionName = ClassNameInfo.getName(thrownDecl.getQualifiedName());
+ if (processedExceptions.contains(exceptionName))
+ return false;
+ processedExceptions.add(exceptionName);
+ WebFault webFault = thrownDecl.getAnnotation(WebFault.class);
+ String className = beanPackage+ exceptionName + BEAN;
+
+ Map<String, TypeMirror> propertyToTypeMap;
+ propertyToTypeMap = TypeModeler.getExceptionProperties(thrownDecl);
+ boolean isWSDLException = isWSDLException(propertyToTypeMap, thrownDecl);
+ String namespace = typeNamespace;
+ String name = exceptionName;
+ FaultInfo faultInfo;
+ if (isWSDLException) {
+ TypeMirror beanType = getSafeType(propertyToTypeMap.get(FAULT_INFO));
+ faultInfo = new FaultInfo(TypeMonikerFactory.getTypeMoniker(beanType),
true);
+ namespace = webFault.targetNamespace().length()>0 ?
+ webFault.targetNamespace() : namespace;
+ name = webFault.name().length()>0 ?
+ webFault.name() : name;
+ faultInfo.setElementName(new QName(namespace, name));
+ seiContext.addExceptionBeanEntry(thrownDecl.getQualifiedName(), faultInfo,
builder);
+ return false;
+ }
+ if (webFault != null) {
+ namespace = webFault.targetNamespace().length()>0 ?
+ webFault.targetNamespace() : namespace;
+ name = webFault.name().length()>0 ?
+ webFault.name() : name;
+ className = webFault.faultBean().length()>0 ?
+ webFault.faultBean() : className;
+
+ }
+ JDefinedClass cls = getCMClass(className, CLASS);
+ faultInfo = new FaultInfo(className, false);
+
+ if (duplicateName(className)) {
+
builder.onError("webserviceap.method.exception.bean.name.not.unique",
+ new Object[] {typeDecl.getQualifiedName(),
thrownDecl.getQualifiedName()});
+ }
+
+ ArrayList<MemberInfo> members = new ArrayList<MemberInfo>();
+ MemberInfo member;
+ String typeString;
+ TypeMirror erasureType;
+ TreeSet<String> keys = new
TreeSet<String>(propertyToTypeMap.keySet());
+ for (String key : keys) {
+ TypeMirror type = propertyToTypeMap.get(key);
+ erasureType = getSafeType(type);
+ member = new MemberInfo(-10, erasureType, key, null);
+ members.add(member);
+ }
+ faultInfo.setMembers(members);
+
+ boolean canOverWriteBean = builder.canOverWriteClass(className);
+ if (!canOverWriteBean) {
+ builder.log("Class " + className + " exists. Not
overwriting.");
+ seiContext.addExceptionBeanEntry(thrownDecl.getQualifiedName(), faultInfo,
builder);
+ return false;
+ }
+ if (seiContext.getExceptionBeanName(thrownDecl.getQualifiedName()) != null)
+ return false;
+
+ //write class comment - JAXWS warning
+ JDocComment comment = cls.javadoc();
+ for (String doc : GeneratorBase.getJAXWSClassComment(builder.getSourceVersion()))
{
+ comment.add(doc);
+ }
+
+ // XmlElement Declarations
+ writeXmlElementDeclaration(cls, name, namespace);
+
+ // XmlType Declaration
+ members = sortMembers(members);
+ writeXmlTypeDeclaration(cls, exceptionName, typeNamespace, members);
+
+ writeMembers(cls, members);
+
+ seiContext.addExceptionBeanEntry(thrownDecl.getQualifiedName(), faultInfo,
builder);
+ return true;
+ }
+
+ protected boolean isWSDLException(Map<String, TypeMirror>map, ClassDeclaration
thrownDecl) {
+ WebFault webFault = thrownDecl.getAnnotation(WebFault.class);
+ if (webFault == null)
+ return false;
+ if (map.size() != 2 || map.get(FAULT_INFO) == null)
+ return false;
+ return true;
+ }
+
+ private void writeXmlElementDeclaration(JDefinedClass cls, String elementName, String
namespaceUri)
+ throws IOException {
+
+ if (cls == null)
+ return;
+ JAnnotationUse xmlRootElementAnn = cls.annotate(XmlRootElement.class);
+ xmlRootElementAnn.param("name", elementName);
+ if (namespaceUri.length() > 0) {
+ xmlRootElementAnn.param("namespace", namespaceUri);
+ }
+ JAnnotationUse xmlAccessorTypeAnn = cls.annotate(cm.ref(XmlAccessorType.class));
+ xmlAccessorTypeAnn.param("value", XmlAccessType.FIELD);
+ }
+
+ private void writeXmlTypeDeclaration(JDefinedClass cls, String typeName, String
namespaceUri,
+ ArrayList<MemberInfo> members) throws
IOException {
+ if (cls == null)
+ return;
+ JAnnotationUse xmlTypeAnn = cls.annotate(cm.ref(XmlType.class));
+ xmlTypeAnn.param("name", typeName);
+ xmlTypeAnn.param("namespace", namespaceUri);
+ if (members.size() > 1) {
+ JAnnotationArrayMember paramArray =
xmlTypeAnn.paramArray("propOrder");
+ for (MemberInfo memInfo : members) {
+ paramArray.param(memInfo.getParamName());
+ }
+ }
+ }
+
+ private void writeMember(JDefinedClass cls, int paramIndex, TypeMirror paramType,
+ String paramName, QName elementName) throws IOException {
+
+ if (cls == null)
+ return;
+ String capPropName = StringUtils.capitalize(paramName);
+ String getterPrefix = paramType.equals("boolean") ||
paramType.equals("java.lang.Boolean") ? "is" : "get";
+ JMethod m = null;
+ JDocComment methodDoc = null;
+ JType propType = getType(paramType);
+ m = cls.method(JMod.PUBLIC, propType, getterPrefix+capPropName);
+ methodDoc = m.javadoc();
+ JCommentPart ret = methodDoc.addReturn();
+ ret.add("returns "+propType.name());
+ JBlock body = m.body();
+ body._return( JExpr._this().ref(paramName) );
+
+ m = cls.method(JMod.PUBLIC, cm.VOID, "set"+capPropName);
+ JVar param = m.param(propType, paramName);
+ methodDoc = m.javadoc();
+ JCommentPart part = methodDoc.addParam(paramName);
+ part.add("the value for the "+ paramName+" property");
+ body = m.body();
+ body.assign( JExpr._this().ref(paramName), param );
+ }
+}
+
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/WebServiceWrapperGenerator.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/WrapperInfo.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/WrapperInfo.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/WrapperInfo.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,64 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.modeler.annotation;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.processor.modeler.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ * @author dkohlert
+ */
+public class WrapperInfo {
+ public String wrapperName;
+ public List<MemberInfo> members;
+
+ /** Creates a new instance of FaultInfo */
+ public WrapperInfo() {
+ }
+ public WrapperInfo(String wrapperName) {
+ this.wrapperName = wrapperName;
+ }
+
+ public void setWrapperName(String wrapperName) {
+ this.wrapperName = wrapperName;
+ }
+
+ public String getWrapperName() {
+ return wrapperName;
+ }
+ public List<MemberInfo> getMembers() {
+ return members;
+ }
+ public void setMembers(List<MemberInfo> members) {
+ this.members = members;
+ }
+ public void addMember(MemberInfo member) {
+ if (members == null)
+ members = new ArrayList<MemberInfo>();
+ members.add(member);
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/annotation/WrapperInfo.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/wsdl/AccessorElement.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/wsdl/AccessorElement.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/wsdl/AccessorElement.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,70 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.modeler.wsdl;
+
+import javax.xml.namespace.QName;
+
+
+/**
+ * @author Vivek Pandey
+ *
+ * Rpc/Lit AccessorElement to be used to generate pseudo schema
+ */
+class AccessorElement {
+
+ private QName type;
+ private String name;
+
+
+ /**
+ * @param type
+ * @param name
+ */
+ public AccessorElement(String name, QName type) {
+ this.type = type;
+ this.name = name;
+ }
+ /**
+ * @return Returns the type.
+ */
+ public QName getType() {
+ return type;
+ }
+ /**
+ * @param type The type to set.
+ */
+ public void setType(QName type) {
+ this.type = type;
+ }
+ /**
+ * @return Returns the name.
+ */
+ public String getName() {
+ return name;
+ }
+ /**
+ * @param name The name to set.
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/wsdl/AccessorElement.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/wsdl/ClassNameAllocatorImpl.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/wsdl/ClassNameAllocatorImpl.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/wsdl/ClassNameAllocatorImpl.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,77 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.modeler.wsdl;
+
+import com.sun.tools.xjc.api.ClassNameAllocator;
+
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.HashMap;
+
+import org.jboss.com.sun.tools.ws.processor.util.ClassNameCollector;
+
+/**
+ * @author Vivek Pandey
+ * <p/>
+ * Implementation of Callback interface that allows the driver of the XJC API to
rename JAXB-generated classes/interfaces/enums.
+ */
+public class ClassNameAllocatorImpl implements ClassNameAllocator {
+ public ClassNameAllocatorImpl(ClassNameCollector classNameCollector) {
+ this.classNameCollector = classNameCollector;
+ this.jaxbClasses = new HashSet<String>();
+ }
+
+ public String assignClassName(String packageName, String className) {
+ if(packageName== null || className == null){
+ //TODO: throw Exception
+ return className;
+ }
+
+ //if either of the values are empty string return the default className
+ if(packageName.equals("") || className.equals(""))
+ return className;
+
+ String fullClassName = packageName+"."+className;
+
+ // Check if there is any conflict with jaxws generated classes
+ Set<String> seiClassNames = classNameCollector.getSeiClassNames();
+ if(seiClassNames != null && seiClassNames.contains(fullClassName)){
+ className += TYPE_SUFFIX;
+ }
+
+ jaxbClasses.add(packageName+"."+className);
+ return className;
+ }
+
+ /**
+ *
+ * @return jaxbGenerated classNames
+ */
+ public Set<String> getJaxbGeneratedClasses() {
+ return jaxbClasses;
+ }
+
+ private final static String TYPE_SUFFIX = "_Type";
+ private ClassNameCollector classNameCollector;
+ private Set<String> jaxbClasses;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/wsdl/ClassNameAllocatorImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/wsdl/ConsoleErrorReporter.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/wsdl/ConsoleErrorReporter.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/wsdl/ConsoleErrorReporter.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,121 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.modeler.wsdl;
+
+import com.sun.tools.xjc.api.ErrorListener;
+
+import org.jboss.com.sun.tools.ws.processor.util.ProcessorEnvironment;
+import org.jboss.com.sun.xml.ws.util.localization.LocalizableMessageFactory;
+import org.xml.sax.SAXParseException;
+
+import java.util.ResourceBundle;
+import java.text.MessageFormat;
+
+public class ConsoleErrorReporter implements ErrorListener{
+
+ private LocalizableMessageFactory messageFactory;
+ private ProcessorEnvironment env;
+ private boolean printStackTrace;
+ private boolean hasError;
+
+ public ConsoleErrorReporter(ProcessorEnvironment env, boolean printStackTrace) {
+ this.env = env;
+ this.printStackTrace = printStackTrace;
+ messageFactory =
+ new
LocalizableMessageFactory("org.jboss.com.sun.tools.ws.resources.model");
+ }
+
+ public boolean hasError() {
+ return hasError;
+ }
+
+ // will be null unless set in #error or #fatalError
+ //TODO: remove it after error handling is straightened
+ private Exception e;
+ Exception getException(){
+ return e;
+ }
+
+ public void error(SAXParseException e) {
+ hasError = true;
+ this.e = e;
+ if(printStackTrace)
+ e.printStackTrace();
+ env.error(messageFactory.getMessage("model.saxparser.exception",
+ new Object[]{e.getMessage(), getLocationString(e)}));
+ }
+
+ public void fatalError(SAXParseException e) {
+ hasError = true;
+ this.e = e;
+ if(printStackTrace)
+ e.printStackTrace();
+
+ env.error(messageFactory.getMessage("model.saxparser.exception",
+ new Object[]{e.getMessage(), getLocationString(e)}));
+ }
+
+ public void warning(SAXParseException e) {
+ env.warn(messageFactory.getMessage("model.saxparser.exception",
+ new Object[]{e.getMessage(), getLocationString(e)}));
+ }
+
+ /**
+ * Used to report possibly verbose information that
+ * can be safely ignored.
+ */
+ public void info(SAXParseException e) {
+ env.info(messageFactory.getMessage("model.saxparser.exception",
+ new Object[]{e.getMessage(), getLocationString(e)}));
+ }
+
+ /**
+ * Returns the human readable string representation of the
+ * {@link org.xml.sax.Locator} part of the specified
+ * {@link SAXParseException}.
+ *
+ * @return non-null valid object.
+ */
+ protected final String getLocationString( SAXParseException e ) {
+ if(e.getLineNumber()!=-1 || e.getSystemId()!=null) {
+ int line = e.getLineNumber();
+ return format("ConsoleErrorReporter.LineXOfY",
line==-1?"?":Integer.toString( line ),
+ getShortName( e.getSystemId() ) );
+ } else {
+ return format("ConsoleErrorReporter.UnknownLocation");
+ }
+ }
+
+ /** Computes a short name of a given URL for display. */
+ private String getShortName( String url ) {
+ if(url==null)
+ return format("ConsoleErrorReporter.UnknownLocation");
+ return url;
+ }
+
+ private String format( String property, Object... args ) {
+ String text =
ResourceBundle.getBundle("org.jboss.com.sun.tools.ws.resources.model").getString(property);
+ return MessageFormat.format(text,args);
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/wsdl/ConsoleErrorReporter.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/wsdl/JAXBModelBuilder.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/wsdl/JAXBModelBuilder.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/wsdl/JAXBModelBuilder.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,166 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.modeler.wsdl;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.processor.ProcessorOptions;
+import org.jboss.com.sun.tools.ws.processor.config.ModelInfo;
+import org.jboss.com.sun.tools.ws.processor.config.WSDLModelInfo;
+import org.jboss.com.sun.tools.ws.processor.model.ModelException;
+import org.jboss.com.sun.tools.ws.processor.model.java.JavaSimpleType;
+import org.jboss.com.sun.tools.ws.processor.model.java.JavaType;
+import org.jboss.com.sun.tools.ws.processor.model.jaxb.JAXBMapping;
+import org.jboss.com.sun.tools.ws.processor.model.jaxb.JAXBModel;
+import org.jboss.com.sun.tools.ws.processor.model.jaxb.JAXBType;
+import org.jboss.com.sun.tools.ws.processor.modeler.JavaSimpleTypeCreator;
+import org.jboss.com.sun.tools.ws.processor.util.ClassNameCollector;
+import org.jboss.com.sun.tools.ws.processor.util.ProcessorEnvironment;
+import org.jboss.com.sun.xml.ws.util.JAXWSUtils;
+import org.jboss.com.sun.xml.ws.util.localization.LocalizableMessageFactory;
+import org.w3c.dom.Element;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXParseException;
+
+import com.sun.tools.xjc.api.ErrorListener;
+import com.sun.tools.xjc.api.SchemaCompiler;
+import com.sun.tools.xjc.api.XJC;
+import com.sun.tools.xjc.api.TypeAndAnnotation;
+
+/**
+ * @author Kathy Walsh, Vivek Pandey
+ *
+ * Uses JAXB XJC apis to build JAXBModel and resolves xml to java type mapping from
JAXBModel
+ */
+public class JAXBModelBuilder {
+ public JAXBModelBuilder(ModelInfo modelInfo,
+ Properties options, ClassNameCollector classNameCollector,
List elements) {
+ _messageFactory =
+ new
LocalizableMessageFactory("org.jboss.com.sun.tools.ws.resources.model");
+ _modelInfo = modelInfo;
+ _env = (ProcessorEnvironment) modelInfo.getParent().getEnvironment();
+ _classNameAllocator = new ClassNameAllocatorImpl(classNameCollector);
+
+ printstacktrace =
Boolean.valueOf(options.getProperty(ProcessorOptions.PRINT_STACK_TRACE_PROPERTY));
+ consoleErrorReporter = new ConsoleErrorReporter(_env, false);
+ internalBuildJAXBModel(elements);
+ }
+
+ /**
+ * Builds model from WSDL document. Model contains abstraction which is used by the
+ * generators to generate the stub/tie/serializers etc. code.
+ *
+ * @see org.jboss.com.sun.tools.ws.processor.modeler.Modeler#buildModel()
+ */
+
+ private void internalBuildJAXBModel(List elements){
+ try {
+ schemaCompiler = XJC.createSchemaCompiler();
+ schemaCompiler.setClassNameAllocator(_classNameAllocator);
+ schemaCompiler.setErrorListener(consoleErrorReporter);
+ schemaCompiler.setEntityResolver(_modelInfo.getEntityResolver());
+ int schemaElementCount = 1;
+ for(Iterator iter = elements.iterator(); iter.hasNext();){
+ Element schemaElement = (Element)iter.next();
+ String location = schemaElement.getOwnerDocument().getDocumentURI();
+ String systemId = new String(location +
"#types?schema"+schemaElementCount++);
+ schemaCompiler.parseSchema(systemId,schemaElement);
+ }
+
+ //feed external jaxb:bindings file
+ Set<InputSource> externalBindings =
((WSDLModelInfo)_modelInfo).getJAXBBindings();
+ if(externalBindings != null){
+ for(InputSource jaxbBinding : externalBindings){
+ schemaCompiler.parseSchema(jaxbBinding);
+ }
+ }
+ } catch (Exception e) {
+ throw new ModelException(e);
+ }
+ }
+
+ public JAXBType getJAXBType(QName qname){
+ JAXBMapping mapping = jaxbModel.get(qname);
+ if (mapping == null){
+ fail("model.schema.elementNotFound", new Object[]{qname});
+ }
+
+ JavaType javaType = new JavaSimpleType(mapping.getType());
+ JAXBType type = new JAXBType(qname, javaType, mapping, jaxbModel);
+ return type;
+ }
+
+ public TypeAndAnnotation getElementTypeAndAnn(QName qname){
+ JAXBMapping mapping = jaxbModel.get(qname);
+ if (mapping == null){
+ fail("model.schema.elementNotFound", new Object[]{qname});
+ }
+ return mapping.getType().getTypeAnn();
+ }
+
+ protected void bind(){
+ com.sun.tools.xjc.api.JAXBModel rawJaxbModel = schemaCompiler.bind();
+ if(consoleErrorReporter.hasError()){
+ throw new ModelException(consoleErrorReporter.getException());
+ }
+ jaxbModel = new JAXBModel(rawJaxbModel);
+ jaxbModel.setGeneratedClassNames(_classNameAllocator.getJaxbGeneratedClasses());
+ }
+
+ protected SchemaCompiler getJAXBSchemaCompiler(){
+ return schemaCompiler;
+ }
+
+ protected void fail(String key, Object[] arg) {
+ throw new ModelException(key, arg);
+ }
+
+ protected void error(String key, Object[] args){
+ _env.error(_messageFactory.getMessage(key, args));
+ }
+
+ protected void warn(String key, Object[] args) {
+ _env.warn(_messageFactory.getMessage(key, args));
+ }
+
+ protected void inform(String key, Object[] args) {
+ _env.info(_messageFactory.getMessage(key, args));
+ }
+
+ public JAXBModel getJAXBModel(){
+ return jaxbModel;
+ }
+
+ private JAXBModel jaxbModel;
+ private SchemaCompiler schemaCompiler;
+ private final LocalizableMessageFactory _messageFactory;
+ private final ModelInfo _modelInfo;
+ private final ProcessorEnvironment _env;
+ private final boolean printstacktrace;
+ private final ClassNameAllocatorImpl _classNameAllocator;
+ private final ConsoleErrorReporter consoleErrorReporter;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/wsdl/JAXBModelBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/wsdl/MimeHelper.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/wsdl/MimeHelper.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/wsdl/MimeHelper.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,104 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.modeler.wsdl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.com.sun.tools.ws.processor.modeler.JavaSimpleTypeCreator;
+
+
+/**
+ * @author Vivek Pandey
+ *
+ */
+public class MimeHelper {
+ /**
+ * @param mimePart
+ * @return unique attachment ID
+ */
+ protected static String getAttachmentUniqueID(String mimePart) {
+ //return "uuid@" + mimePart;
+ return mimePart;
+ }
+
+ /**
+ * @param mimeType
+ * @return true if mimeType is a binary type
+ */
+ protected static boolean isMimeTypeBinary(String mimeType) {
+ if (mimeType.equals(JPEG_IMAGE_MIME_TYPE)
+ || mimeType.equals(GIF_IMAGE_MIME_TYPE)
+ ) {
+ return true;
+ } else if (
+ mimeType.equals(TEXT_XML_MIME_TYPE)
+ || mimeType.equals(TEXT_HTML_MIME_TYPE)
+ || mimeType.equals(TEXT_PLAIN_MIME_TYPE)
+ || mimeType.equals(APPLICATION_XML_MIME_TYPE)
+ || mimeType.equals(MULTIPART_MIME_TYPE)) {
+ return false;
+ }
+ //some unknown mime type, will be mapped to DataHandler java type so
+ // return true
+ return true;
+ }
+
+ protected static void initMimeTypeToJavaType() {
+ mimeTypeToJavaType.put(JPEG_IMAGE_MIME_TYPE, javaType.IMAGE_JAVATYPE);
+ //mimeTypeToJavaType.put(PNG_IMAGE_MIME_TYPE, javaType.IMAGE_JAVATYPE);
+ mimeTypeToJavaType.put(GIF_IMAGE_MIME_TYPE,
+ javaType.IMAGE_JAVATYPE);
+ mimeTypeToJavaType.put(TEXT_XML_MIME_TYPE, javaType.SOURCE_JAVATYPE);
+ //mimeTypeToJavaType.put(TEXT_HTML_MIME_TYPE, javaType.SOURCE_JAVATYPE);
+ mimeTypeToJavaType.put(
+ APPLICATION_XML_MIME_TYPE,
+ javaType.SOURCE_JAVATYPE);
+ mimeTypeToJavaType.put(TEXT_PLAIN_MIME_TYPE, javaType.STRING_JAVATYPE);
+ mimeTypeToJavaType.put(
+ MULTIPART_MIME_TYPE,
+ javaType.MIME_MULTIPART_JAVATYPE);
+
+ }
+
+ protected static Map mimeTypeToJavaType;
+ protected static JavaSimpleTypeCreator javaType;
+
+ public static final String JPEG_IMAGE_MIME_TYPE = "image/jpeg";
+ //public static final String PNG_IMAGE_MIME_TYPE = "image/png";
+ public static final String GIF_IMAGE_MIME_TYPE = "image/gif";
+ public static final String TEXT_XML_MIME_TYPE = "text/xml";
+ public static final String TEXT_HTML_MIME_TYPE = "text/html";
+ public static final String TEXT_PLAIN_MIME_TYPE = "text/plain";
+ public static final String APPLICATION_XML_MIME_TYPE = "application/xml";
+ public static final String MULTIPART_MIME_TYPE = "multipart/*";
+
+ /**
+ *
+ */
+ public MimeHelper() {
+ mimeTypeToJavaType = new HashMap();
+ javaType = new JavaSimpleTypeCreator();
+ initMimeTypeToJavaType();
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/wsdl/MimeHelper.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/wsdl/PseudoSchemaBuilder.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/wsdl/PseudoSchemaBuilder.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/wsdl/PseudoSchemaBuilder.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,277 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.modeler.wsdl;
+
+import static org.jboss.com.sun.tools.ws.processor.modeler.wsdl.WSDLModelerBase.*;
+
+import org.jboss.com.sun.tools.ws.processor.config.ModelInfo;
+import
org.jboss.com.sun.tools.ws.processor.modeler.wsdl.WSDLModelerBase.ProcessSOAPOperationInfo;
+import org.jboss.com.sun.tools.ws.wsdl.document.Binding;
+import org.jboss.com.sun.tools.ws.wsdl.document.BindingOperation;
+import org.jboss.com.sun.tools.ws.wsdl.document.Kinds;
+import org.jboss.com.sun.tools.ws.wsdl.document.Message;
+import org.jboss.com.sun.tools.ws.wsdl.document.MessagePart;
+import org.jboss.com.sun.tools.ws.wsdl.document.Operation;
+import org.jboss.com.sun.tools.ws.wsdl.document.Port;
+import org.jboss.com.sun.tools.ws.wsdl.document.PortType;
+import org.jboss.com.sun.tools.ws.wsdl.document.Service;
+import org.jboss.com.sun.tools.ws.wsdl.document.WSDLDocument;
+import org.jboss.com.sun.tools.ws.wsdl.document.jaxws.JAXWSBinding;
+import org.jboss.com.sun.tools.ws.wsdl.document.schema.SchemaKinds;
+import org.jboss.com.sun.tools.ws.wsdl.document.soap.*;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extensible;
+import org.jboss.com.sun.tools.ws.wsdl.framework.NoSuchEntityException;
+import org.xml.sax.InputSource;
+
+import javax.xml.namespace.QName;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+
+
+
+/**
+ * @author Vivek Pandey
+ *
+ * Builds all possible pseudo schemas for async operation ResponseBean to feed to XJC.
+ */
+public class PseudoSchemaBuilder {
+
+ private final StringWriter buf = new StringWriter();
+ private final WSDLDocument wsdlDocument;
+ private final ModelInfo modelInfo;
+ private WSDLModeler wsdlModeler;
+ private final List<InputSource> schemas = new ArrayList<InputSource>();
+ private final HashMap<QName, Port> bindingNameToPortMap = new HashMap<QName,
Port>();
+
+ public static List<InputSource> build(WSDLModeler wsdlModeler, ModelInfo
modelInfo) {
+ PseudoSchemaBuilder b = new PseudoSchemaBuilder(wsdlModeler.document,
modelInfo);
+ b.wsdlModeler = wsdlModeler;
+ JAXBModelBuilder analyzer = wsdlModeler.getJAXBModelBuilder();
+ b.build();
+ for(int i = 0; i < b.schemas.size(); i++){
+ InputSource is = b.schemas.get(i);
+ is.setSystemId("http://dummy.pseudo-schema#schema"+(i+1));
+ }
+ return b.schemas;
+ }
+
+ private PseudoSchemaBuilder(WSDLDocument _wsdl, ModelInfo _modelInfo) {
+ this.wsdlDocument = _wsdl;
+ this.modelInfo = _modelInfo;
+ }
+
+ private void build() {
+ for(Iterator<Service> itr=wsdlDocument.getDefinitions().services();
itr.hasNext(); )
+ build(itr.next());
+ }
+
+ private void build(Service service) {
+ for( Iterator<Port> itr=service.ports(); itr.hasNext(); )
+ build(itr.next() );
+ }
+
+ private void build(Port port) {
+ if(wsdlModeler.isProvider(port))
+ return;
+ Binding binding = port.resolveBinding(wsdlDocument);
+
+ SOAPBinding soapBinding =
+ (SOAPBinding)getExtensionOfType(binding, SOAPBinding.class);
+ //lets try and see if its SOAP 1.2. dont worry about extension flag, its
+ // handled much earlier
+ if (soapBinding == null) {
+ soapBinding =
+ (SOAPBinding)getExtensionOfType(binding,
SOAP12Binding.class);
+ }
+ if(soapBinding == null)
+ return;
+ PortType portType = binding.resolvePortType(wsdlDocument);
+
+ QName bindingName = WSDLModelerBase.getQNameOf(binding);
+
+ //we dont want to process the port bound to the binding processed earlier
+ if(bindingNameToPortMap.containsKey(bindingName))
+ return;
+
+ bindingNameToPortMap.put(bindingName, port);
+
+
+ for(Iterator itr=binding.operations(); itr.hasNext();){
+ BindingOperation bindingOperation = (BindingOperation)itr.next();
+ SOAPOperation soapOperation =
+ (SOAPOperation)getExtensionOfType(bindingOperation,
+ SOAPOperation.class);
+
+ // get only the bounded operations
+ Set boundedOps = portType.getOperationsNamed(bindingOperation.getName());
+ if(boundedOps.size() != 1)
+ continue;
+ Operation operation = (Operation)boundedOps.iterator().next();
+
+ // No pseudo schema required for doc/lit
+ SOAPStyle bindingStyle = soapBinding.getStyle();
+ SOAPStyle operationStyle = (soapOperation != null) ? soapOperation.getStyle()
: bindingStyle;
+ if(wsdlModeler.isAsync(portType, operation)){
+ buildAsync(portType, operation, bindingOperation);
+ }
+ }
+ }
+
+ /**
+ * @param portType
+ * @param operation
+ * @param bindingOperation
+ */
+ private void buildAsync(PortType portType, Operation operation, BindingOperation
bindingOperation) {
+ String operationName =
getCustomizedOperationName(operation);//operation.getName();
+ if(operationName == null)
+ return;
+ Message outputMessage = null;
+ if(operation.getOutput() != null)
+ outputMessage = operation.getOutput().resolveMessage(wsdlDocument);
+ if(outputMessage != null){
+ List<MessagePart> allParts = new
ArrayList<MessagePart>(outputMessage.getParts());
+ if(allParts.size() > 1)
+ build(getOperationName(portType, operationName,
bindingOperation.getOutput()), allParts);
+ }
+
+ }
+
+ private String getCustomizedOperationName(Operation operation) {
+ JAXWSBinding jaxwsCustomization = (JAXWSBinding)getExtensionOfType(operation,
JAXWSBinding.class);
+ String operationName = (jaxwsCustomization !=
null)?((jaxwsCustomization.getMethodName() !=
null)?jaxwsCustomization.getMethodName().getName():null):null;
+ if(operationName != null){
+
if(wsdlModeler.getEnvironment().getNames().isJavaReservedWord(operationName)){
+ return null;
+ }
+
+ return operationName;
+ }
+ return operation.getName();
+ }
+
+ private void writeImports(QName elementName, List<MessagePart> parts){
+ Set<String> uris = new HashSet<String>();
+ for(MessagePart p:parts){
+ String ns = p.getDescriptor().getNamespaceURI();
+ if(!uris.contains(ns) &&
!ns.equals("http://www.w3.org/2001/XMLSchema") &&
!ns.equals(elementName.getNamespaceURI())){
+ print("<xs:import namespace=''{0}''/>",
ns);
+ uris.add(ns);
+ }
+ }
+ }
+
+ boolean asyncRespBeanBinding = false;
+ private void build(QName elementName, List<MessagePart> allParts){
+
+ print(
+ "<xs:schema
xmlns:xs=''http://www.w3.org/2001/XMLSchema''" +
+ "
xmlns:jaxb=''http://java.sun.com/xml/ns/jaxb''" +
+ "
xmlns:xjc=''http://java.sun.com/xml/ns/jaxb/xjc''" +
+ "
jaxb:extensionBindingPrefixes=''xjc''" +
+ " jaxb:version=''1.0''");
+ if((elementName != null) && elementName.getNamespaceURI().length() >
0){
+ print(" targetNamespace=''{0}''>",
elementName.getNamespaceURI());
+ }else{
+ print(" >");
+ }
+
+ writeImports(elementName, allParts);
+
+ if(!asyncRespBeanBinding){
+ print(
+ "<xs:annotation><xs:appinfo>" +
+ " <jaxb:schemaBindings>" +
+ " <jaxb:package name=''{0}'' />"
+
+ " </jaxb:schemaBindings>" +
+ "</xs:appinfo></xs:annotation>",
+ wsdlModeler.getJavaPackage() );
+ asyncRespBeanBinding = true;
+ }
+
+ print("<xs:element name=''{0}''>",
elementName.getLocalPart());
+ print("<xs:complexType>");
+ print("<xs:sequence>");
+
+
+ for(MessagePart p:allParts) {
+ //rpclit wsdl:part must reference schema type not element, also it must
exclude headers and mime parts
+ if(p.getDescriptorKind() == SchemaKinds.XSD_ELEMENT){
+ print("<xs:element ref=''types:{0}''
xmlns:types=''{1}''/>",p.getDescriptor().getLocalPart(),
p.getDescriptor().getNamespaceURI());
+ }else{
+ print("<xs:element name=''{0}''
type=''{1}'' xmlns=''{2}'' />",
+ p.getName(),
+ p.getDescriptor().getLocalPart(),
+ p.getDescriptor().getNamespaceURI() );
+ }
+ }
+
+ print("</xs:sequence>");
+ print("</xs:complexType>");
+ print("</xs:element>");
+ print("</xs:schema>");
+
+ // reset the StringWriter, so that next operation element could be written
+ if(buf.toString().length() > 0){
+// System.out.println("Response bean Schema for operation========>
"+ elementName+"\n\n"+buf);
+ InputSource is = new InputSource(new StringReader(buf.toString()));
+ schemas.add(is);
+ buf.getBuffer().setLength(0);
+ }
+ }
+
+ private QName getOperationName(PortType portType, String operationName, Extensible
binding){
+ if(operationName == null)
+ return null;
+// String namespaceURI =
wsdlDocument.getDefinitions().getTargetNamespaceURI()+"?"+portType.getName()+"?"
+ operationName;
+ String namespaceURI = "";
+ return new QName(namespaceURI, operationName+"Response");
+ }
+
+ private void print( String msg ) {
+ print( msg, new Object[0] );
+ }
+ private void print( String msg, Object arg1 ) {
+ print( msg, new Object[]{arg1} );
+ }
+ private void print( String msg, Object arg1, Object arg2 ) {
+ print( msg, new Object[]{arg1, arg2} );
+ }
+ private void print( String msg, Object arg1, Object arg2, Object arg3 ) {
+ print( msg, new Object[]{arg1,arg2,arg3} );
+ }
+ private void print( String msg, Object[] args ) {
+ buf.write(MessageFormat.format(msg,args));
+ buf.write('\n');
+ }
+
+ private static final Set<QName> nspaceToPackageSchema = new
HashSet<QName>();
+ private static int schemaCounter;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/wsdl/PseudoSchemaBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/wsdl/WSDLModeler.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/wsdl/WSDLModeler.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/wsdl/WSDLModeler.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,2793 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.processor.modeler.wsdl;
+
+import com.sun.codemodel.JCodeModel;
+import com.sun.codemodel.JType;
+import com.sun.tools.xjc.api.S2JJAXBModel;
+import com.sun.tools.xjc.api.TypeAndAnnotation;
+import com.sun.tools.xjc.api.XJC;
+import com.sun.xml.bind.api.JAXBRIContext;
+
+import org.jboss.com.sun.tools.ws.processor.ProcessorOptions;
+import org.jboss.com.sun.tools.ws.processor.config.WSDLModelInfo;
+import org.jboss.com.sun.tools.ws.processor.generator.GeneratorConstants;
+import org.jboss.com.sun.tools.ws.processor.model.AsyncOperation;
+import org.jboss.com.sun.tools.ws.processor.model.AsyncOperationType;
+import org.jboss.com.sun.tools.ws.processor.model.Block;
+import org.jboss.com.sun.tools.ws.processor.model.Fault;
+import org.jboss.com.sun.tools.ws.processor.model.Model;
+import org.jboss.com.sun.tools.ws.processor.model.ModelException;
+import org.jboss.com.sun.tools.ws.processor.model.ModelObject;
+import org.jboss.com.sun.tools.ws.processor.model.ModelProperties;
+import org.jboss.com.sun.tools.ws.processor.model.Operation;
+import org.jboss.com.sun.tools.ws.processor.model.Parameter;
+import org.jboss.com.sun.tools.ws.processor.model.Port;
+import org.jboss.com.sun.tools.ws.processor.model.Request;
+import org.jboss.com.sun.tools.ws.processor.model.Response;
+import org.jboss.com.sun.tools.ws.processor.model.Service;
+import org.jboss.com.sun.tools.ws.processor.model.java.JavaException;
+import org.jboss.com.sun.tools.ws.processor.model.java.JavaInterface;
+import org.jboss.com.sun.tools.ws.processor.model.java.JavaMethod;
+import org.jboss.com.sun.tools.ws.processor.model.java.JavaParameter;
+import org.jboss.com.sun.tools.ws.processor.model.java.JavaSimpleType;
+import org.jboss.com.sun.tools.ws.processor.model.java.JavaStructureMember;
+import org.jboss.com.sun.tools.ws.processor.model.java.JavaType;
+import org.jboss.com.sun.tools.ws.processor.model.jaxb.JAXBElementMember;
+import org.jboss.com.sun.tools.ws.processor.model.jaxb.JAXBProperty;
+import org.jboss.com.sun.tools.ws.processor.model.jaxb.JAXBStructuredType;
+import org.jboss.com.sun.tools.ws.processor.model.jaxb.JAXBType;
+import org.jboss.com.sun.tools.ws.processor.model.jaxb.JAXBTypeAndAnnotation;
+import org.jboss.com.sun.tools.ws.processor.model.jaxb.RpcLitMember;
+import org.jboss.com.sun.tools.ws.processor.model.jaxb.RpcLitStructure;
+import org.jboss.com.sun.tools.ws.processor.modeler.JavaSimpleTypeCreator;
+import org.jboss.com.sun.tools.ws.processor.modeler.ModelerException;
+import org.jboss.com.sun.tools.ws.processor.modeler.ModelerUtils;
+import org.jboss.com.sun.tools.ws.processor.util.ClassNameCollector;
+import org.jboss.com.sun.tools.ws.processor.util.ProcessorEnvironment;
+import org.jboss.com.sun.tools.ws.wsdl.document.Binding;
+import org.jboss.com.sun.tools.ws.wsdl.document.BindingFault;
+import org.jboss.com.sun.tools.ws.wsdl.document.BindingOperation;
+import org.jboss.com.sun.tools.ws.wsdl.document.Documentation;
+import org.jboss.com.sun.tools.ws.wsdl.document.Kinds;
+import org.jboss.com.sun.tools.ws.wsdl.document.Message;
+import org.jboss.com.sun.tools.ws.wsdl.document.MessagePart;
+import org.jboss.com.sun.tools.ws.wsdl.document.OperationStyle;
+import org.jboss.com.sun.tools.ws.wsdl.document.PortType;
+import org.jboss.com.sun.tools.ws.wsdl.document.WSDLConstants;
+import org.jboss.com.sun.tools.ws.wsdl.document.WSDLDocument;
+import org.jboss.com.sun.tools.ws.wsdl.document.jaxws.CustomName;
+import org.jboss.com.sun.tools.ws.wsdl.document.jaxws.JAXWSBinding;
+import org.jboss.com.sun.tools.ws.wsdl.document.mime.MIMEContent;
+import org.jboss.com.sun.tools.ws.wsdl.document.schema.SchemaKinds;
+import org.jboss.com.sun.tools.ws.wsdl.document.soap.SOAP12Binding;
+import org.jboss.com.sun.tools.ws.wsdl.document.soap.SOAP12Constants;
+import org.jboss.com.sun.tools.ws.wsdl.document.soap.SOAPAddress;
+import org.jboss.com.sun.tools.ws.wsdl.document.soap.SOAPBinding;
+import org.jboss.com.sun.tools.ws.wsdl.document.soap.SOAPBody;
+import org.jboss.com.sun.tools.ws.wsdl.document.soap.SOAPConstants;
+import org.jboss.com.sun.tools.ws.wsdl.document.soap.SOAPFault;
+import org.jboss.com.sun.tools.ws.wsdl.document.soap.SOAPHeader;
+import org.jboss.com.sun.tools.ws.wsdl.document.soap.SOAPOperation;
+import org.jboss.com.sun.tools.ws.wsdl.document.soap.SOAPStyle;
+import org.jboss.com.sun.tools.ws.wsdl.document.soap.SOAPUse;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Entity;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extensible;
+import org.jboss.com.sun.tools.ws.wsdl.framework.NoSuchEntityException;
+import org.jboss.com.sun.tools.ws.wsdl.framework.ParseException;
+import org.jboss.com.sun.tools.ws.wsdl.framework.ParserListener;
+import org.jboss.com.sun.tools.ws.wsdl.framework.ValidationException;
+import org.jboss.com.sun.tools.ws.wsdl.parser.SOAPEntityReferenceValidator;
+import org.jboss.com.sun.tools.ws.wsdl.parser.WSDLParser;
+import org.jboss.com.sun.xml.ws.model.Mode;
+import org.jboss.com.sun.xml.ws.util.xml.XmlUtil;
+import org.xml.sax.InputSource;
+
+import javax.xml.namespace.QName;
+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.Properties;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+
+/**
+ * The WSDLModeler processes a WSDL to create a Model.
+ *
+ * @author WS Development Team
+ */
+public class WSDLModeler extends WSDLModelerBase {
+
+ //map of wsdl:operation QName to <soapenv:Body> child, as per BP it must be
unique in a port
+ private final Map<QName, QName> uniqueBodyBlocks = new HashMap<QName,
QName>();
+ private final QName VOID_BODYBLOCK = new QName("");
+ private ClassNameCollector classNameCollector;
+ private boolean extensions = false;
+ protected enum StyleAndUse {RPC_LITERAL, DOC_LITERAL};
+ private ModelerUtils modelerUtils;
+ private JAXBModelBuilder jaxbModelBuilder;
+
+ /**
+ * @param modelInfo
+ * @param options
+ */
+ public WSDLModeler(WSDLModelInfo modelInfo, Properties options) {
+ super(modelInfo, options);
+ classNameCollector = new ClassNameCollector();
+ }
+
+ public Model buildModel() {
+ try {
+
+ parser = new WSDLParser(_modelInfo);
+ parser.addParserListener(new ParserListener() {
+ public void ignoringExtension(QName name, QName parent) {
+ if (parent.equals(WSDLConstants.QNAME_TYPES)) {
+ // check for a schema element with the wrong namespace URI
+ if (name.getLocalPart().equals("schema")
+ && !name.getNamespaceURI().equals("")) {
+ warn(
+
"wsdlmodeler.warning.ignoringUnrecognizedSchemaExtension",
+ name.getNamespaceURI());
+ }
+ }
+ }
+ public void doneParsingEntity(QName element, Entity entity) {
+ }
+ });
+ hSet = parser.getUse();
+
+ extensions =
Boolean.valueOf(_options.getProperty(ProcessorOptions.EXTENSION));
+
+ useWSIBasicProfile = !extensions;
+ document =
+ parser.parse();
+ document.validateLocally();
+
+ boolean validateWSDL =
+ Boolean
+ .valueOf(
+ _options.getProperty(
+ ProcessorOptions.VALIDATE_WSDL_PROPERTY))
+ .booleanValue();
+ if (validateWSDL) {
+ document.validate(new SOAPEntityReferenceValidator());
+ }
+
+
+ Model model = internalBuildModel(document);
+ //ClassNameCollector classNameCollector = new ClassNameCollector();
+ classNameCollector.process(model);
+ if (classNameCollector.getConflictingClassNames().isEmpty()) {
+ return model;
+ }
+ // do another pass, this time with conflict resolution enabled
+ model = internalBuildModel(document);
+ classNameCollector.process(model);
+ if (classNameCollector.getConflictingClassNames().isEmpty()) {
+ // we're done
+ return model;
+ }
+ // give up
+ StringBuffer conflictList = new StringBuffer();
+ boolean first = true;
+ for (Iterator iter =
+ classNameCollector.getConflictingClassNames().iterator();
+ iter.hasNext();
+ ) {
+ if (!first) {
+ conflictList.append(", ");
+ } else {
+ first = false;
+ }
+ conflictList.append((String)iter.next());
+ }
+ throw new ModelerException(
+ "wsdlmodeler.unsolvableNamingConflicts",
+ conflictList.toString());
+
+ } catch (ModelException e) {
+ throw new ModelerException((Exception)e);
+ } catch (ParseException e) {
+ throw new ModelerException((Exception)e);
+ } catch (ValidationException e) {
+ throw new ModelerException((Exception)e);
+ }
+ }
+
+ private Model internalBuildModel(WSDLDocument document) {
+
+ //build the jaxbModel to be used latter
+ buildJAXBModel(document, _modelInfo, classNameCollector);
+
+ QName modelName =
+ new QName(
+ document.getDefinitions().getTargetNamespaceURI(),
+ document.getDefinitions().getName() == null
+ ? "model"
+ : document.getDefinitions().getName());
+ Model model = new Model(modelName);
+ model.setJAXBModel(getJAXBModelBuilder().getJAXBModel());
+
+ // This fails with the changed classname (WSDLModeler to WSDLModeler11 etc.)
+ // with this source comaptibility change the WSDL Modeler class name is changed.
Right now hardcoding the
+ // modeler class name to the same one being checked in WSDLGenerator.
+
+ model.setProperty(
+ ModelProperties.PROPERTY_MODELER_NAME,
+ ModelProperties.WSDL_MODELER_NAME);
+
+ _javaTypes = new JavaSimpleTypeCreator();
+ _javaExceptions = new HashMap();
+ _bindingNameToPortMap = new HashMap();
+
+ // grab target namespace
+ model.setTargetNamespaceURI(document.getDefinitions().getTargetNamespaceURI());
+
+ setDocumentationIfPresent(model,
+ document.getDefinitions().getDocumentation());
+
+ boolean hasServices = document.getDefinitions().services().hasNext();
+ if (hasServices) {
+ for (Iterator iter = document.getDefinitions().services();
+ iter.hasNext();
+ ) {
+
processService((org.jboss.com.sun.tools.ws.wsdl.document.Service)iter.next(),
+ model, document);
+ hasServices = true;
+ }
+ } else {
+ // emit a warning if there are no service definitions
+ warn("wsdlmodeler.warning.noServiceDefinitionsFound");
+ }
+
+ return model;
+ }
+
+
+ /* (non-Javadoc)
+ * @see WSDLModelerBase#processService(Service, Model, WSDLDocument)
+ */
+ protected void processService(org.jboss.com.sun.tools.ws.wsdl.document.Service
wsdlService, Model model, WSDLDocument document) {
+ String serviceInterface = "";
+ QName serviceQName = getQNameOf(wsdlService);
+ serviceInterface = getServiceInterfaceName(serviceQName, wsdlService);
+ if (isConflictingServiceClassName(serviceInterface)) {
+ serviceInterface += "_Service";
+ }
+ Service service =
+ new Service(
+ serviceQName,
+ new JavaInterface(serviceInterface, serviceInterface +
"Impl"));
+
+ setDocumentationIfPresent(service, wsdlService.getDocumentation());
+ boolean hasPorts = false;
+ for (Iterator iter = wsdlService.ports(); iter.hasNext();) {
+ boolean processed =
+ processPort(
+ (org.jboss.com.sun.tools.ws.wsdl.document.Port)iter.next(),
+ service,
+ document);
+ hasPorts = hasPorts || processed;
+ }
+ if (!hasPorts) {
+ // emit a warning if there are no ports
+ warn("wsdlmodeler.warning.noPortsInService",
wsdlService.getName());
+ }else{
+ model.addService(service);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see WSDLModelerBase#processPort(Port, Service, WSDLDocument)
+ */
+ protected boolean processPort(org.jboss.com.sun.tools.ws.wsdl.document.Port
wsdlPort,
+ Service service, WSDLDocument document) {
+ try {
+
+ //clear the unique block map
+ uniqueBodyBlocks.clear();
+
+ QName portQName = getQNameOf(wsdlPort);
+ Port port = new Port(portQName);
+
+ setDocumentationIfPresent(port, wsdlPort.getDocumentation());
+
+ SOAPAddress soapAddress =
+ (SOAPAddress)getExtensionOfType(wsdlPort, SOAPAddress.class);
+ if (soapAddress == null) {
+ // not a SOAP port, ignore it
+ warn("wsdlmodeler.warning.ignoringNonSOAPPort.noAddress",
wsdlPort.getName());
+ return false;
+ }
+
+ port.setAddress(soapAddress.getLocation());
+ Binding binding = wsdlPort.resolveBinding(document);
+ QName bindingName = getQNameOf(binding);
+ PortType portType = binding.resolvePortType(document);
+
+ port.setProperty(
+ ModelProperties.PROPERTY_WSDL_PORT_NAME,
+ getQNameOf(wsdlPort));
+ port.setProperty(
+ ModelProperties.PROPERTY_WSDL_PORT_TYPE_NAME,
+ getQNameOf(portType));
+ port.setProperty(
+ ModelProperties.PROPERTY_WSDL_BINDING_NAME,
+ bindingName);
+
+ boolean isProvider = isProvider(wsdlPort);
+ if (_bindingNameToPortMap.containsKey(bindingName) && !isProvider) {
+ // this binding has been processed before
+ Port existingPort =
+ _bindingNameToPortMap.get(bindingName);
+ port.setOperations(existingPort.getOperations());
+ port.setJavaInterface(existingPort.getJavaInterface());
+ port.setStyle(existingPort.getStyle());
+ port.setWrapped(existingPort.isWrapped());
+ } else {
+ // find out the SOAP binding extension, if any
+ SOAPBinding soapBinding =
+ (SOAPBinding)getExtensionOfType(binding, SOAPBinding.class);
+
+ if (soapBinding == null) {
+ soapBinding =
+ (SOAPBinding)getExtensionOfType(binding,
SOAP12Binding.class);
+ if (soapBinding == null) {
+ // cannot deal with non-SOAP ports
+ warn(
+ "wsdlmodeler.warning.ignoringNonSOAPPort",
+ wsdlPort.getName());
+ return false;
+ }
+ // we can only do soap1.2 if extensions are on
+ if (extensions) {
+ warn("wsdlmodeler.warning.port.SOAPBinding12",
wsdlPort.getName());
+ } else {
+ warn("wsdlmodeler.warning.ignoringSOAPBinding12",
+ wsdlPort.getName());
+ return false;
+ }
+ }
+
+ if (soapBinding.getTransport() == null
+ || (!soapBinding.getTransport().equals(
+ SOAPConstants.URI_SOAP_TRANSPORT_HTTP) &&
!soapBinding.getTransport().equals(
+ SOAP12Constants.URI_SOAP_TRANSPORT_HTTP))) {
+ // cannot deal with non-HTTP ports
+ warn(
+
"wsdlmodeler.warning.ignoringSOAPBinding.nonHTTPTransport",
+ wsdlPort.getName());
+ return false;
+ }
+
+ /**
+ * validate wsdl:binding uniqueness in style, e.g. rpclit or doclit
+ * ref: WSI BP 1.1 R 2705
+ */
+ if(!validateWSDLBindingStyle(binding)){
+ if(extensions){
+ warn("wsdlmodeler.warning.port.SOAPBinding.mixedStyle",
wsdlPort.getName());
+ }else{
+
fail("wsdlmodeler.warning.ignoringSOAPBinding.mixedStyle",
+ wsdlPort.getName());
+ return false;
+ }
+ }
+
+ port.setStyle(soapBinding.getStyle());
+ boolean hasOverloadedOperations = false;
+ Set<String> operationNames = new HashSet<String>();
+ for (Iterator iter = portType.operations(); iter.hasNext();) {
+ org.jboss.com.sun.tools.ws.wsdl.document.Operation operation =
+ (org.jboss.com.sun.tools.ws.wsdl.document.Operation)iter.next();
+
+ if (operationNames.contains(operation.getName())) {
+ hasOverloadedOperations = true;
+ break;
+ }
+ operationNames.add(operation.getName());
+
+ for (Iterator itr = binding.operations();
+ iter.hasNext();
+ ) {
+ BindingOperation bindingOperation =
+ (BindingOperation)itr.next();
+ if (operation
+ .getName()
+ .equals(bindingOperation.getName())) {
+ break;
+ } else if (!itr.hasNext()) {
+ throw new ModelerException(
+
"wsdlmodeler.invalid.bindingOperation.notFound",
+ new Object[] {
+ operation.getName(),
+ binding.getName()});
+ }
+ }
+ }
+
+ Map headers = new HashMap();
+ boolean hasOperations = false;
+ for (Iterator iter = binding.operations(); iter.hasNext();) {
+ BindingOperation bindingOperation =
+ (BindingOperation)iter.next();
+
+ org.jboss.com.sun.tools.ws.wsdl.document.Operation portTypeOperation
=
+ null;
+ Set operations =
+ portType.getOperationsNamed(bindingOperation.getName());
+ if (operations.size() == 0) {
+ // the WSDL document is invalid
+ throw new ModelerException(
+
"wsdlmodeler.invalid.bindingOperation.notInPortType",
+ new Object[] {
+ bindingOperation.getName(),
+ binding.getName()});
+ } else if (operations.size() == 1) {
+ portTypeOperation =
+
(org.jboss.com.sun.tools.ws.wsdl.document.Operation)operations
+ .iterator()
+ .next();
+ } else {
+ boolean found = false;
+ String expectedInputName =
+ bindingOperation.getInput().getName();
+ String expectedOutputName =
+ bindingOperation.getOutput().getName();
+
+ for (Iterator iter2 = operations.iterator();iter2.hasNext();) {
+ org.jboss.com.sun.tools.ws.wsdl.document.Operation
candidateOperation =
+
(org.jboss.com.sun.tools.ws.wsdl.document.Operation)iter2
+ .next();
+
+ if (expectedInputName == null) {
+ // the WSDL document is invalid
+ throw new ModelerException(
+
"wsdlmodeler.invalid.bindingOperation.missingInputName",
+ new Object[] {
+ bindingOperation.getName(),
+ binding.getName()});
+ }
+ if (expectedOutputName == null) {
+ // the WSDL document is invalid
+ throw new ModelerException(
+
"wsdlmodeler.invalid.bindingOperation.missingOutputName",
+ new Object[] {
+ bindingOperation.getName(),
+ binding.getName()});
+ }
+ if (expectedInputName
+ .equals(candidateOperation.getInput().getName())
+ && expectedOutputName.equals(
+ candidateOperation
+ .getOutput()
+ .getName())) {
+ if (found) {
+ // the WSDL document is invalid
+ throw new ModelerException(
+
"wsdlmodeler.invalid.bindingOperation.multipleMatchingOperations",
+ new Object[] {
+ bindingOperation.getName(),
+ binding.getName()});
+ }
+ // got it!
+ found = true;
+ portTypeOperation = candidateOperation;
+ }
+ }
+ if (!found) {
+ // the WSDL document is invalid
+ throw new ModelerException(
+
"wsdlmodeler.invalid.bindingOperation.notFound",
+ new Object[] {
+ bindingOperation.getName(),
+ binding.getName()});
+ }
+ }
+ if(!isProvider){
+ this.info =
+ new ProcessSOAPOperationInfo(
+ port,
+ wsdlPort,
+ portTypeOperation,
+ bindingOperation,
+ soapBinding,
+ document,
+ hasOverloadedOperations,
+ headers);
+
+ Operation operation = processSOAPOperation();
+ if (operation != null) {
+ port.addOperation(operation);
+ hasOperations = true;
+ }
+ }
+ }
+ if (!isProvider && !hasOperations) {
+ // emit a warning if there are no operations, except when its a
provider port
+ warn("wsdlmodeler.warning.noOperationsInPort",
+ wsdlPort.getName());
+ return false;
+ }
+ createJavaInterfaceForPort(port, isProvider);
+ PortType pt = binding.resolvePortType(document);
+ String jd = (pt.getDocumentation() !=
null)?pt.getDocumentation().getContent():null;
+ port.getJavaInterface().setJavaDoc(jd);
+ _bindingNameToPortMap.put(bindingName, port);
+ }
+
+ // now deal with the configured handlers
+ port.setClientHandlerChainInfo(
+ _modelInfo.getClientHandlerChainInfo());
+ port.setServerHandlerChainInfo(
+ _modelInfo.getServerHandlerChainInfo());
+
+ service.addPort(port);
+ applyPortMethodCustomization(port, wsdlPort);
+ applyWrapperStyleCustomization(port, binding.resolvePortType(document));
+
+ return true;
+
+ } catch (NoSuchEntityException e) {
+ warn(e);
+ // should not happen
+ return false;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see WSDLModelerBase#processSOAPOperation()
+ */
+ protected Operation processSOAPOperation() {
+ Operation operation =
+ new Operation(new QName(null, info.bindingOperation.getName()));
+
+ setDocumentationIfPresent(
+ operation,
+ info.portTypeOperation.getDocumentation());
+
+ if (info.portTypeOperation.getStyle()
+ != OperationStyle.REQUEST_RESPONSE
+ && info.portTypeOperation.getStyle() != OperationStyle.ONE_WAY) {
+ if(extensions){
+ warn(
+ "wsdlmodeler.warning.ignoringOperation.notSupportedStyle",
+ info.portTypeOperation.getName());
+ return null;
+ }
+ fail("wsdlmodeler.invalid.operation.notSupportedStyle",
+ new Object[]{info.portTypeOperation.getName(),
+
info.port.resolveBinding(document).resolvePortType(document).getName()});
+ }
+
+ SOAPStyle soapStyle = info.soapBinding.getStyle();
+
+ // find out the SOAP operation extension, if any
+ SOAPOperation soapOperation =
+ (SOAPOperation)getExtensionOfType(info.bindingOperation,
+ SOAPOperation.class);
+
+ if (soapOperation != null) {
+ if (soapOperation.getStyle() != null) {
+ soapStyle = soapOperation.getStyle();
+ }
+ if (soapOperation.getSOAPAction() != null) {
+ operation.setSOAPAction(soapOperation.getSOAPAction());
+ }
+ }
+
+ operation.setStyle(soapStyle);
+
+ String uniqueOperationName =
+ getUniqueName(info.portTypeOperation, info.hasOverloadedOperations);
+ if (info.hasOverloadedOperations) {
+ operation.setUniqueName(uniqueOperationName);
+ }
+
+ info.operation = operation;
+ info.uniqueOperationName = uniqueOperationName;
+
+ //attachment
+ SOAPBody soapRequestBody = getSOAPRequestBody();
+ if (soapRequestBody == null) {
+ // the WSDL document is invalid
+ throw new ModelerException(
+ "wsdlmodeler.invalid.bindingOperation.inputMissingSoapBody",
+ new Object[] { info.bindingOperation.getName()});
+ }
+
+ if (soapStyle == SOAPStyle.RPC) {
+ if (soapRequestBody.isEncoded()) {
+ throw new
ModelerException("wsdlmodeler20.rpcenc.not.supported");
+ }
+ return processLiteralSOAPOperation(StyleAndUse.RPC_LITERAL);
+ }
+ // document style
+ return processLiteralSOAPOperation(StyleAndUse.DOC_LITERAL);
+ }
+
+ protected Operation processLiteralSOAPOperation(StyleAndUse styleAndUse){
+ //returns false if the operation name is not acceptable
+ if(!applyOperationNameCustomization())
+ return null;
+
+ boolean isRequestResponse = info.portTypeOperation.getStyle() ==
OperationStyle.REQUEST_RESPONSE;
+ Request request = new Request();
+ Response response = new Response();
+ info.operation.setUse(SOAPUse.LITERAL);
+ SOAPBody soapRequestBody = getSOAPRequestBody();
+ if((StyleAndUse.DOC_LITERAL == styleAndUse) &&
(soapRequestBody.getNamespace() != null)){
+ warn("wsdlmodeler.warning.r2716", new
Object[]{"soapbind:body", info.bindingOperation.getName()});
+ }
+
+ Message inputMessage = getInputMessage();
+
+ SOAPBody soapResponseBody = null;
+ Message outputMessage = null;
+ if (isRequestResponse) {
+ soapResponseBody = getSOAPResponseBody();
+ if (isOperationDocumentLiteral(styleAndUse) &&
(soapResponseBody.getNamespace() != null)) {
+ warn("wsdlmodeler.warning.r2716", new
Object[]{"soapbind:body", info.bindingOperation.getName()});
+ }
+ outputMessage = getOutputMessage();
+ }
+
+ //ignore operation if there are more than one root part
+ if(!validateMimeParts(getMimeParts(info.bindingOperation.getInput())) ||
+ !validateMimeParts(getMimeParts(info.bindingOperation.getOutput())))
+ return null;
+
+
+ if(!validateBodyParts(info.bindingOperation)){
+ // BP 1.1
+ // R2204 A document-literal binding in a DESCRIPTION MUST refer, in each of
its soapbind:body element(s),
+ // only to wsdl:part element(s) that have been defined using the element
attribute.
+
+ // R2203 An rpc-literal binding in a DESCRIPTION MUST refer, in its
soapbind:body element(s),
+ // only to wsdNl:part element(s) that have been defined using the type
attribute.
+ if(isOperationDocumentLiteral(styleAndUse))
+ if(extensions)
+
warn("wsdlmodeler.warning.ignoringOperation.cannotHandleTypeMessagePart",
info.portTypeOperation.getName());
+ else
+ fail("wsdlmodeler.invalid.doclitoperation",
info.portTypeOperation.getName());
+ else if(isOperationRpcLiteral(styleAndUse)) {
+ if(extensions)
+
warn("wsdlmodeler.warning.ignoringOperation.cannotHandleElementMessagePart",
info.portTypeOperation.getName());
+ else
+ fail("wsdlmodeler.invalid.rpclitoperation",
info.portTypeOperation.getName());
+ }
+ return null;
+ }
+
+ // Process parameterOrder and get the parameterList
+ List<MessagePart> parameterList = getParameterOrder();
+
+ //binding is invalid in the wsdl, ignore the operation.
+ if(!setMessagePartsBinding(styleAndUse))
+ return null;
+
+ List<Parameter> params = null;
+ boolean unwrappable = isUnwrappable();
+ info.operation.setWrapped(unwrappable);
+ if(isOperationDocumentLiteral(styleAndUse)){
+ params = getDoclitParameters(request, response, parameterList);
+ }else if(isOperationRpcLiteral(styleAndUse)){
+ String operationName = info.bindingOperation.getName();
+ Block reqBlock = null;
+ if (inputMessage != null) {
+ QName name = new QName(getRequestNamespaceURI(soapRequestBody),
operationName);
+ RpcLitStructure rpcStruct = new RpcLitStructure(name,
getJAXBModelBuilder().getJAXBModel());
+ rpcStruct.setJavaType(new
JavaSimpleType("org.jboss.com.sun.xml.ws.encoding.jaxb.RpcLitPayload", null));
+ reqBlock = new Block(name, rpcStruct);
+ request.addBodyBlock(reqBlock);
+ }
+
+ Block resBlock = null;
+ if (isRequestResponse && outputMessage != null) {
+ QName name = new QName(getResponseNamespaceURI(soapResponseBody),
operationName + "Response");
+ RpcLitStructure rpcStruct = new RpcLitStructure(name,
getJAXBModelBuilder().getJAXBModel());
+ rpcStruct.setJavaType(new
JavaSimpleType("org.jboss.com.sun.xml.ws.encoding.jaxb.RpcLitPayload", null));
+ resBlock = new Block(name, rpcStruct);
+ response.addBodyBlock(resBlock);
+ }
+ params = getRpcLitParameters(request, response, reqBlock, resBlock,
parameterList);
+ }
+
+
+ if(!validateParameterName(params)) {
+ return null;
+ }
+
+ // create a definitive list of parameters to match what we'd like to get
+ // in the java interface (which is generated much later), parameterOrder
+ List<Parameter> definitiveParameterList = new
ArrayList<Parameter>();
+ for (Parameter param: params) {
+ if(param.isReturn()){
+ info.operation.setProperty(WSDL_RESULT_PARAMETER, param);
+ response.addParameter(param);
+ continue;
+ }
+ if(param.isIN()){
+ request.addParameter(param);
+ }else if(param.isOUT()){
+ response.addParameter(param);
+ }else if(param.isINOUT()){
+ request.addParameter(param);
+ response.addParameter(param);
+ }
+ definitiveParameterList.add(param);
+ }
+
+ info.operation.setRequest(request);
+
+ if (isRequestResponse) {
+ info.operation.setResponse(response);
+ }
+
+ Iterator<Block> bb = request.getBodyBlocks();
+ QName body = VOID_BODYBLOCK;
+ QName opName = null;
+
+ if(bb.hasNext()){
+ body = bb.next().getName();
+ opName = uniqueBodyBlocks.get(body);
+ }else{
+ //there is no body block
+ body = VOID_BODYBLOCK;
+ opName = uniqueBodyBlocks.get(VOID_BODYBLOCK);
+ }
+ if(opName != null){
+ fail("wsdlmodeler.nonUnique.body", new
Object[]{info.port.getName(), info.operation.getName(), opName, body});
+ }else{
+ uniqueBodyBlocks.put(body, info.operation.getName());
+ }
+
+ // faults with duplicate names
+ Set duplicateNames = getDuplicateFaultNames();
+
+ // handle soap:fault
+ handleLiteralSOAPFault(response, duplicateNames);
+ info.operation.setProperty(
+ WSDL_PARAMETER_ORDER,
+ definitiveParameterList);
+
+ //set Async property
+ Binding binding = info.port.resolveBinding(document);
+ PortType portType = binding.resolvePortType(document);
+ if(isAsync(portType, info.portTypeOperation)){
+ addAsyncOperations(info.operation, styleAndUse);
+ }
+
+ return info.operation;
+ }
+
+ /**
+ *
+ * @param params
+ * @return
+ */
+ private boolean validateParameterName(List<Parameter> params) {
+ Message msg = getInputMessage();
+ for(Parameter param : params){
+ if(param.isOUT())
+ continue;
+ if(param.getCustomName() != null){
+
if(getEnvironment().getNames().isJavaReservedWord(param.getCustomName())){
+ if(extensions)
+
warn("wsdlmodeler.warning.ignoringOperation.javaReservedWordNotAllowed.customName",
+ new Object[]{info.operation.getName(),
param.getCustomName()});
+ else
+
fail("wsdlmodeler.invalid.operation.javaReservedWordNotAllowed.customName",
+ new Object[]{info.operation.getName(),
param.getCustomName()});
+ return false;
+ }
+ return true;
+ }
+ //process doclit wrapper style
+ if(param.isEmbedded() && !(param.getBlock().getType() instanceof
RpcLitStructure)){
+ if(getEnvironment().getNames().isJavaReservedWord(param.getName())){
+ if(extensions)
+
warn("wsdlmodeler.warning.ignoringOperation.javaReservedWordNotAllowed.wrapperStyle",
new Object[]{info.operation.getName(), param.getName(), param.getBlock().getName()});
+ else
+
fail("wsdlmodeler.invalid.operation.javaReservedWordNotAllowed.wrapperStyle",
new Object[]{info.operation.getName(), param.getName(), param.getBlock().getName()});
+ return false;
+ }
+ }else{
+ //non-wrapper style and rpclit
+ if(getEnvironment().getNames().isJavaReservedWord(param.getName())){
+ if(extensions)
+
warn("wsdlmodeler.warning.ignoringOperation.javaReservedWordNotAllowed.nonWrapperStyle",
new Object[]{info.operation.getName(), msg.getName(), param.getName()});
+ else
+
fail("wsdlmodeler.invalid.operation.javaReservedWordNotAllowed.nonWrapperStyle",
new Object[]{info.operation.getName(), msg.getName(), param.getName()});
+ return false;
+ }
+ }
+ }
+
+ boolean isRequestResponse = info.portTypeOperation.getStyle() ==
OperationStyle.REQUEST_RESPONSE;
+ if(isRequestResponse){
+ msg = getOutputMessage();
+ for(Parameter param : params){
+ if(param.isIN())
+ continue;
+ if(param.getCustomName() != null){
+
if(getEnvironment().getNames().isJavaReservedWord(param.getCustomName())){
+ if(extensions)
+
warn("wsdlmodeler.warning.ignoringOperation.javaReservedWordNotAllowed.customName",
+ new Object[]{info.operation.getName(),
param.getCustomName()});
+ else
+
fail("wsdlmodeler.invalid.operation.javaReservedWordNotAllowed.customName",
+ new Object[]{info.operation.getName(),
param.getCustomName()});
+ return false;
+ }
+ return true;
+ }
+ //process doclit wrapper style
+ if(param.isEmbedded() && !(param.getBlock().getType() instanceof
RpcLitStructure)){
+ if(param.isReturn())
+ continue;
+ if(!param.getName().equals("return") &&
getEnvironment().getNames().isJavaReservedWord(param.getName())){
+ if(extensions)
+
warn("wsdlmodeler.warning.ignoringOperation.javaReservedWordNotAllowed.wrapperStyle",
+ new Object[]{info.operation.getName(),
param.getName(), param.getBlock().getName()});
+ else
+
fail("wsdlmodeler.invalid.operation.javaReservedWordNotAllowed.wrapperStyle",
+ new Object[]{info.operation.getName(),
param.getName(), param.getBlock().getName()});
+ return false;
+ }
+ }else{
+ if(param.isReturn())
+ continue;
+
+ //non-wrapper style and rpclit
+ if(getEnvironment().getNames().isJavaReservedWord(param.getName())){
+ if(extensions)
+
warn("wsdlmodeler.warning.ignoringOperation.javaReservedWordNotAllowed.nonWrapperStyle",
new Object[]{info.operation.getName(), msg.getName(), param.getName()});
+ else
+
fail("wsdlmodeler.invalid.operation.javaReservedWordNotAllowed.nonWrapperStyle",
+ new Object[]{info.operation.getName(), msg.getName(),
param.getName()});
+ return false;
+ }
+ }
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * @return
+ */
+ private boolean enableMimeContent() {
+ //first we look at binding operation
+ JAXWSBinding jaxwsCustomization =
(JAXWSBinding)getExtensionOfType(info.bindingOperation, JAXWSBinding.class);
+ Boolean mimeContentMapping = (jaxwsCustomization !=
null)?jaxwsCustomization.isEnableMimeContentMapping():null;
+ if(mimeContentMapping != null)
+ return mimeContentMapping;
+
+ //then in wsdl:binding
+ Binding binding = info.port.resolveBinding(info.document);
+ jaxwsCustomization = (JAXWSBinding)getExtensionOfType(binding,
JAXWSBinding.class);
+ mimeContentMapping = (jaxwsCustomization !=
null)?jaxwsCustomization.isEnableMimeContentMapping():null;
+ if(mimeContentMapping != null)
+ return mimeContentMapping;
+
+ //at last look in wsdl:definitions
+ jaxwsCustomization =
(JAXWSBinding)getExtensionOfType(info.document.getDefinitions(), JAXWSBinding.class);
+ mimeContentMapping = (jaxwsCustomization !=
null)?jaxwsCustomization.isEnableMimeContentMapping():null;
+ if(mimeContentMapping != null)
+ return mimeContentMapping;
+ return false;
+ }
+
+ /**
+ *
+ */
+ private boolean applyOperationNameCustomization() {
+ JAXWSBinding jaxwsCustomization =
(JAXWSBinding)getExtensionOfType(info.portTypeOperation, JAXWSBinding.class);
+ String operationName = (jaxwsCustomization !=
null)?((jaxwsCustomization.getMethodName() !=
null)?jaxwsCustomization.getMethodName().getName():null):null;
+ if(operationName != null){
+ if(getEnvironment().getNames().isJavaReservedWord(operationName)){
+ if(extensions)
+
warn("wsdlmodeler.warning.ignoringOperation.javaReservedWordNotAllowed.customizedOperationName",
new Object[]{info.operation.getName(), operationName});
+ else
+
fail("wsdlmodeler.invalid.operation.javaReservedWordNotAllowed.customizedOperationName",
new Object[]{info.operation.getName(), operationName});
+ return false;
+ }
+
+ info.operation.setCustomizedName(operationName);
+ }
+
+
if(getEnvironment().getNames().isJavaReservedWord(info.operation.getJavaMethodName())){
+ if(extensions)
+
warn("wsdlmodeler.warning.ignoringOperation.javaReservedWordNotAllowed.operationName",
new Object[]{info.operation.getName()});
+ else
+
fail("wsdlmodeler.invalid.operation.javaReservedWordNotAllowed.operationName",
new Object[]{info.operation.getName()});
+ return false;
+ }
+ return true;
+ }
+
+ protected String getAsyncOperationName(Operation operation){
+ String name = operation.getCustomizedName();
+ if(name == null)
+ name = operation.getUniqueName();
+ return name;
+ }
+
+ /**
+ * @param styleAndUse
+ */
+ private void addAsyncOperations(Operation syncOperation, StyleAndUse styleAndUse) {
+ Operation operation = createAsyncOperation(syncOperation, styleAndUse,
AsyncOperationType.POLLING);
+ if(operation != null)
+ info.modelPort.addOperation(operation);
+
+ operation = createAsyncOperation(syncOperation, styleAndUse,
AsyncOperationType.CALLBACK);
+ if(operation != null)
+ info.modelPort.addOperation(operation);
+ }
+
+ /**
+ *
+ * @param syncOperation
+ * @param styleAndUse
+ * @param asyncType
+ * @return
+ */
+ private Operation createAsyncOperation(Operation syncOperation, StyleAndUse
styleAndUse, AsyncOperationType asyncType) {
+ boolean isRequestResponse = info.portTypeOperation.getStyle() ==
OperationStyle.REQUEST_RESPONSE;
+ if(!isRequestResponse)
+ return null;
+ Request request = new Request();
+ Response response = new Response();
+
+ //create async operations
+ AsyncOperation operation = new AsyncOperation(info.operation);
+
+ //creation the async operation name: operationName+Async or customized name
+ //operation.setName(new QName(operation.getName().getNamespaceURI(),
getAsyncOperationName(info.portTypeOperation, operation)));
+ if(asyncType.equals(AsyncOperationType.CALLBACK))
+
operation.setUniqueName(info.operation.getUniqueName()+"_async_callback");
+ else if(asyncType.equals(AsyncOperationType.POLLING))
+
operation.setUniqueName(info.operation.getUniqueName()+"_async_polling");
+
+ setDocumentationIfPresent(
+ operation,
+ info.portTypeOperation.getDocumentation());
+
+ operation.setAsyncType(asyncType);
+ operation.setSOAPAction(info.operation.getSOAPAction());
+ boolean unwrappable = info.operation.isWrapped();
+ operation.setWrapped(unwrappable);
+ SOAPBody soapRequestBody = getSOAPRequestBody();
+
+ Message inputMessage = getInputMessage();
+
+ SOAPBody soapResponseBody = null;
+ Message outputMessage = null;
+ if (isRequestResponse) {
+ soapResponseBody = getSOAPResponseBody();
+ outputMessage = getOutputMessage();
+ }
+
+ // Process parameterOrder and get the parameterList
+ java.util.List<String> parameterList = getAsynParameterOrder();
+
+ List<Parameter> inParameters = null;
+ if(isOperationDocumentLiteral(styleAndUse)){
+ inParameters = getRequestParameters(request, parameterList);
+ // outParameters = getResponseParameters(response);
+ // re-create parameterList with unwrapped parameters
+ if(unwrappable){
+ List<String> unwrappedParameterList = new
ArrayList<String>();
+ if(inputMessage != null){
+ Iterator<MessagePart> parts = inputMessage.parts();
+ if(parts.hasNext()){
+ MessagePart part = parts.next();
+ JAXBType jaxbType = getJAXBType(part.getDescriptor());
+ List<JAXBProperty> memberList =
jaxbType.getWrapperChildren();
+ Iterator<JAXBProperty> props = memberList.iterator();
+ while(props.hasNext()){
+ JAXBProperty prop = props.next();
+
unwrappedParameterList.add(prop.getElementName().getLocalPart());
+ }
+ }
+ }
+
+ parameterList.clear();
+ parameterList.addAll(unwrappedParameterList);
+ }
+ }else if(isOperationRpcLiteral(styleAndUse)){
+ String operationName = info.bindingOperation.getName();
+ Block reqBlock = null;
+ if (inputMessage != null) {
+ QName name = new QName(getRequestNamespaceURI(soapRequestBody),
operationName);
+ RpcLitStructure rpcStruct = new RpcLitStructure(name,
getJAXBModelBuilder().getJAXBModel());
+ rpcStruct.setJavaType(new
JavaSimpleType("org.jboss.com.sun.xml.ws.encoding.jaxb.RpcLitPayload", null));
+ reqBlock = new Block(name, rpcStruct);
+ request.addBodyBlock(reqBlock);
+ }
+ inParameters = createRpcLitRequestParameters(request, parameterList,
reqBlock);
+ }
+
+ // add response blocks, we dont need to create respnse parameters, just blocks
will be fine, lets
+ // copy them from sync optraions
+ //copy the response blocks from the sync operation
+ Iterator<Block> blocks = info.operation.getResponse().getBodyBlocks();
+
+ while(blocks.hasNext()){
+ response.addBodyBlock(blocks.next());
+ }
+
+ blocks = info.operation.getResponse().getHeaderBlocks();
+ while(blocks.hasNext()){
+ response.addHeaderBlock(blocks.next());
+ }
+
+ blocks = info.operation.getResponse().getAttachmentBlocks();
+ while(blocks.hasNext()){
+ response.addAttachmentBlock(blocks.next());
+ }
+
+ List<MessagePart> outputParts = outputMessage.getParts();
+
+ // handle headers
+ int numOfOutMsgParts = outputParts.size();
+
+ if(isRequestResponse){
+ if(numOfOutMsgParts == 1){
+ MessagePart part = outputParts.get(0);
+ if(isOperationDocumentLiteral(styleAndUse)){
+ JAXBType type = getJAXBType(part.getDescriptor());
+ operation.setResponseBean(type);
+ }else if(isOperationRpcLiteral(styleAndUse)){
+ String operationName = info.bindingOperation.getName();
+ Block resBlock = null;
+ if (isRequestResponse && outputMessage != null) {
+ resBlock =
info.operation.getResponse().getBodyBlocksMap().get(new
QName(getResponseNamespaceURI(soapResponseBody),
+ operationName + "Response"));
+ }
+ RpcLitStructure resBean = (resBlock == null) ? null :
(RpcLitStructure)resBlock.getType();
+ List<RpcLitMember> members = resBean.getRpcLitMembers();
+
+ operation.setResponseBean(members.get(0));
+ }
+ }else{
+ //create response bean
+ String nspace = "";
+ QName responseBeanName = new
QName(nspace,getAsyncOperationName(info.operation) +"Response");
+ JAXBType responseBeanType = getJAXBType(responseBeanName);
+ operation.setResponseBean(responseBeanType);
+ }
+ }
+ QName respBeanName = new
QName(soapResponseBody.getNamespace(),getAsyncOperationName(info.operation)+"Response");
+ Block block = new Block(respBeanName, operation.getResponseBeanType());
+ JavaType respJavaType = operation.getResponseBeanJavaType();
+ JAXBType respType = new JAXBType(respBeanName, respJavaType);
+ Parameter respParam =
ModelerUtils.createParameter(info.operation.getName()+"Response", respType,
block);
+ respParam.setParameterIndex(-1);
+ response.addParameter(respParam);
+ operation.setProperty(WSDL_RESULT_PARAMETER, respParam.getName());
+
+
+ List<String> definitiveParameterList = new ArrayList<String>();
+ int parameterOrderPosition = 0;
+ for (String name: parameterList) {
+ Parameter inParameter = null;
+
+ inParameter = ModelerUtils.getParameter(name, inParameters);
+ if(inParameter == null){
+ if(extensions)
+ warn("wsdlmodeler.warning.ignoringOperation.partNotFound",
new Object[]{info.operation.getName().getLocalPart(), name});
+ else
+ fail("wsdlmodeler.error.partNotFound", new
Object[]{info.operation.getName().getLocalPart(), name});
+ return null;
+ }
+ request.addParameter(inParameter);
+ inParameter.setParameterIndex(parameterOrderPosition);
+ definitiveParameterList.add(name);
+ parameterOrderPosition++;
+ }
+
+ if (isRequestResponse) {
+ operation.setResponse(response);
+ }
+
+ // add callback handlerb Parameter to request
+ if(operation.getAsyncType().equals(AsyncOperationType.CALLBACK)){
+ JavaType cbJavaType = operation.getCallBackType();
+ JAXBType callbackType = new JAXBType(respBeanName, cbJavaType);
+ Parameter cbParam = ModelerUtils.createParameter("asyncHandler",
callbackType, block);
+ request.addParameter(cbParam);
+ }
+
+ operation.setRequest(request);
+
+ return operation;
+ }
+
+ protected boolean isAsync(org.jboss.com.sun.tools.ws.wsdl.document.PortType portType,
org.jboss.com.sun.tools.ws.wsdl.document.Operation wsdlOperation){
+ //First look into wsdl:operation
+ JAXWSBinding jaxwsCustomization = (JAXWSBinding)getExtensionOfType(wsdlOperation,
JAXWSBinding.class);
+ Boolean isAsync = (jaxwsCustomization !=
null)?jaxwsCustomization.isEnableAsyncMapping():null;
+
+ if(isAsync != null)
+ return isAsync;
+
+ // then into wsdl:portType
+ QName portTypeName = new QName(portType.getDefining().getTargetNamespaceURI(),
portType.getName());
+ if(portTypeName != null){
+ jaxwsCustomization = (JAXWSBinding)getExtensionOfType(portType,
JAXWSBinding.class);
+ isAsync = (jaxwsCustomization !=
null)?jaxwsCustomization.isEnableAsyncMapping():null;
+ if(isAsync != null)
+ return isAsync;
+ }
+
+ //then wsdl:definitions
+ jaxwsCustomization = (JAXWSBinding)getExtensionOfType(document.getDefinitions(),
JAXWSBinding.class);
+ isAsync = (jaxwsCustomization !=
null)?jaxwsCustomization.isEnableAsyncMapping():null;
+ if(isAsync != null)
+ return isAsync;
+ return false;
+ }
+
+ protected void handleLiteralSOAPHeaders(Request request, Response response, Iterator
headerParts, Set duplicateNames, List definitiveParameterList, boolean processRequest) {
+ QName headerName = null;
+ Block headerBlock = null;
+ JAXBType jaxbType = null;
+ int parameterOrderPosition = definitiveParameterList.size();
+ while(headerParts.hasNext()){
+ MessagePart part = (MessagePart)headerParts.next();
+ headerName = part.getDescriptor();
+ jaxbType = getJAXBType(headerName);
+ headerBlock = new Block(headerName, jaxbType);
+ Extensible ext;
+ if(processRequest){
+ ext = info.bindingOperation.getInput();
+ }else{
+ ext = info.bindingOperation.getOutput();
+ }
+ Message headerMessage = getHeaderMessage(part, ext);
+
+ if(processRequest){
+ request.addHeaderBlock(headerBlock);
+ }else{
+ response.addHeaderBlock(headerBlock);
+ }
+
+ Parameter parameter = ModelerUtils.createParameter(part.getName(), jaxbType,
headerBlock);
+ parameter.setParameterIndex(parameterOrderPosition);
+ setCustomizedParameterName(info.bindingOperation, headerMessage, part,
parameter, false);
+ if (processRequest && definitiveParameterList != null) {
+ request.addParameter(parameter);
+ definitiveParameterList.add(parameter.getName());
+ } else {
+ if (definitiveParameterList != null) {
+ for (Iterator iterInParams = definitiveParameterList.iterator();
iterInParams.hasNext();) {
+ String inParamName =
+ (String)iterInParams.next();
+ if (inParamName.equals(parameter.getName())) {
+ Parameter inParam = request.getParameterByName(inParamName);
+ parameter.setLinkedParameter(inParam);
+ inParam.setLinkedParameter(parameter);
+ //its in/out parameter, input and output parameter have the
same order position.
+ parameter.setParameterIndex(inParam.getParameterIndex());
+ }
+ }
+ if (!definitiveParameterList.contains(parameter.getName())) {
+ definitiveParameterList.add(parameter.getName());
+ }
+ }
+ response.addParameter(parameter);
+ }
+ parameterOrderPosition++;
+ }
+
+ }
+
+ protected void handleLiteralSOAPFault(Response response, Set duplicateNames){
+ for (Iterator iter = info.bindingOperation.faults(); iter.hasNext();){
+ BindingFault bindingFault = (BindingFault)iter.next();
+ org.jboss.com.sun.tools.ws.wsdl.document.Fault portTypeFault = null;
+ for(Iterator iter2 = info.portTypeOperation.faults(); iter2.hasNext();){
+ org.jboss.com.sun.tools.ws.wsdl.document.Fault aFault =
+ (org.jboss.com.sun.tools.ws.wsdl.document.Fault)iter2.next();
+ if(aFault.getName().equals(bindingFault.getName())){
+ if(portTypeFault != null){
+ // the WSDL document is invalid, a wsld:fault in a wsdl:operation
of a portType can be bound only once
+ throw new
ModelerException("wsdlmodeler.invalid.bindingFault.notUnique",
+ new Object[]{bindingFault.getName(),
info.bindingOperation.getName()});
+ }
+ portTypeFault = aFault;
+ }
+ }
+
+ // The WSDL document is invalid, the wsdl:fault in abstract operation is does
not have any binding
+ if(portTypeFault == null){
+ throw new
ModelerException("wsdlmodeler.invalid.bindingFault.notFound",
+ new Object[] {bindingFault.getName(),
info.bindingOperation.getName()});
+
+ }
+
+ // wsdl:fault message name is used to create the java exception name later
on
+ String faultName = getFaultClassName(portTypeFault);
+ Fault fault = new Fault(faultName);
+ setDocumentationIfPresent(fault, portTypeFault.getDocumentation());
+
+ //get the soapbind:fault from wsdl:fault in the binding
+ SOAPFault soapFault = (SOAPFault)getExtensionOfType(bindingFault,
SOAPFault.class);
+
+ // The WSDL document is invalid, can't have wsdl:fault without
soapbind:fault
+ if(soapFault == null){
+ throw new
ModelerException("wsdlmodeler.invalid.bindingFault.outputMissingSoapFault",
+ new Object[]{bindingFault.getName(),
info.bindingOperation.getName()});
+ }
+
+ //the soapbind:fault must have use="literal" or no use attribute,
in that case its assumed "literal"
+ if(!soapFault.isLiteral()){
+ if(extensions)
+ warn("wsdlmodeler.warning.ignoringFault.notLiteral",
+ new Object[]{bindingFault.getName(),
info.bindingOperation.getName()});
+ else
+ fail("wsdlmodeler.invalid.operation.fault.notLiteral",
+ new Object[]{bindingFault.getName(),
info.bindingOperation.getName()});
+ continue;
+ }
+
+ // the soapFault name must be present
+ if(soapFault.getName() == null){
+ warn("wsdlmodeler.invalid.bindingFault.noSoapFaultName",
+ new Object[]{bindingFault.getName(),
info.bindingOperation.getName()});
+ }else if (!soapFault.getName().equals(bindingFault.getName())) {
+ // the soapFault name must match bindingFault name
+ warn("wsdlmodeler.invalid.bindingFault.wrongSoapFaultName",
+ new Object[]{soapFault.getName(), bindingFault.getName(),
info.bindingOperation.getName()});
+ }else if(soapFault.getNamespace() != null){
+ // bug fix: 4852729
+ warn("wsdlmodeler.warning.r2716r2726",
+ new Object[] { "soapbind:fault", soapFault.getName()});
+ }
+
+ String faultNamespaceURI = soapFault.getNamespace();
+ if(faultNamespaceURI == null){
+ faultNamespaceURI = portTypeFault.getMessage().getNamespaceURI();
+ }
+
+ org.jboss.com.sun.tools.ws.wsdl.document.Message faultMessage =
portTypeFault.resolveMessage(info.document);
+ Iterator iter2 = faultMessage.parts();
+ if(!iter2.hasNext()){
+ // the WSDL document is invalid
+ throw new
ModelerException("wsdlmodeler.invalid.bindingFault.emptyMessage",
+ new Object[]{bindingFault.getName(), faultMessage.getName()});
+ }
+ MessagePart faultPart = (MessagePart)iter2.next();
+ QName faultQName = faultPart.getDescriptor();
+
+ // Don't include fault messages with non-unique soap:fault names
+ if (duplicateNames.contains(faultQName)) {
+ warn("wsdlmodeler.duplicate.fault.soap.name",
+ new Object[] {bindingFault.getName(),
info.portTypeOperation.getName(), faultPart.getName()});
+ continue;
+ }
+
+ if (iter2.hasNext()) {
+ // the WSDL document is invalid
+ throw new
ModelerException("wsdlmodeler.invalid.bindingFault.messageHasMoreThanOnePart",
+ new Object[]{bindingFault.getName(), faultMessage.getName()});
+ }
+
+ if (faultPart.getDescriptorKind() != SchemaKinds.XSD_ELEMENT) {
+ throw new
ModelerException("wsdlmodeler.invalid.message.partMustHaveElementDescriptor",
+ new Object[]{faultMessage.getName(), faultPart.getName()});
+ }
+
+ JAXBType jaxbType = getJAXBType(faultPart.getDescriptor());
+
+ fault.setElementName(faultPart.getDescriptor());
+
fault.setJavaMemberName(getEnvironment().getNames().getExceptionClassMemberName());
+
+ Block faultBlock = new Block(faultQName, jaxbType);
+ fault.setBlock(faultBlock);
+ createParentFault(fault);
+ createSubfaults(fault);
+ if(!response.getFaultBlocksMap().containsKey(faultBlock.getName()))
+ response.addFaultBlock(faultBlock);
+ info.operation.addFault(fault);
+ }
+ }
+
+ /**
+ * @param portTypeFault
+ * @return
+ */
+ private String getFaultClassName(org.jboss.com.sun.tools.ws.wsdl.document.Fault
portTypeFault) {
+ JAXWSBinding jaxwsBinding = (JAXWSBinding)getExtensionOfType(portTypeFault,
JAXWSBinding.class);
+ if(jaxwsBinding != null){
+ CustomName className = jaxwsBinding.getClassName();
+ if(className != null){
+ return className.getName();
+ }
+ }
+ return portTypeFault.getMessage().getLocalPart();
+ }
+
+ protected boolean setMessagePartsBinding(StyleAndUse styleAndUse){
+ SOAPBody inBody = getSOAPRequestBody();
+ Message inMessage = getInputMessage();
+ if(!setMessagePartsBinding(inBody, inMessage, styleAndUse, true))
+ return false;
+
+ if(isRequestResponse()){
+ SOAPBody outBody = getSOAPResponseBody();
+ Message outMessage = getOutputMessage();
+ if(!setMessagePartsBinding(outBody, outMessage, styleAndUse, false))
+ return false;
+ }
+ return true;
+ }
+
+ //returns false if the wsdl is invalid and operation should be ignored
+ protected boolean setMessagePartsBinding(SOAPBody body, Message message, StyleAndUse
styleAndUse, boolean isInput) {
+ List<MessagePart> parts = new ArrayList<MessagePart>();
+
+ //get Mime parts
+ List<MessagePart> mimeParts = null;
+ List<MessagePart> headerParts = null;
+ List<MessagePart> bodyParts = getBodyParts(body, message);
+
+ if(isInput){
+ headerParts = getHeaderPartsFromMessage(message, isInput);
+ mimeParts = getMimeContentParts(message, info.bindingOperation.getInput());
+ }else{
+ headerParts = getHeaderPartsFromMessage(message, isInput);
+ mimeParts = getMimeContentParts(message, info.bindingOperation.getOutput());
+ }
+
+ //As of now WSDL MIME binding is not supported, so throw the exception when such
binding is encounterd
+// if(mimeParts.size() > 0){
+// fail("wsdlmodeler.unsupportedBinding.mime", new Object[]{});
+// }
+
+ //if soap:body parts attribute not there, then all unbounded message parts will
+ // belong to the soap body
+ if(bodyParts == null){
+ bodyParts = new ArrayList<MessagePart>();
+ for(Iterator<MessagePart> iter = message.parts();iter.hasNext();) {
+ MessagePart mPart = iter.next();
+ //Its a safe assumption that the parts in the message not belonging to
header or mime will
+ // belong to the body?
+ if(mimeParts.contains(mPart) || headerParts.contains(mPart) ||
boundToFault(mPart.getName())){
+ //throw error that a part cant be bound multiple times, not ignoring
operation, if there
+ //is conflict it will fail latter
+ if(extensions)
+
warn("wsdlmodeler.warning.bindingOperation.multiplePartBinding",
+ new Object[]{info.bindingOperation.getName(),
mPart.getName()});
+ else
+
fail("wsdlmodeler.invalid.bindingOperation.multiplePartBinding",
+ new Object[]{info.bindingOperation.getName(),
mPart.getName()});
+ }
+ bodyParts.add(mPart);
+ }
+ }
+
+ //now build the final parts list with header, mime parts and body parts
+ for(Iterator iter = message.parts();iter.hasNext();) {
+ MessagePart mPart = (MessagePart)iter.next();
+ if(mimeParts.contains(mPart)) {
+ mPart.setBindingExtensibilityElementKind(MessagePart.WSDL_MIME_BINDING);
+ parts.add(mPart);
+ }else if(headerParts.contains(mPart)) {
+
mPart.setBindingExtensibilityElementKind(MessagePart.SOAP_HEADER_BINDING);
+ parts.add(mPart);
+ }else if(bodyParts.contains(mPart)) {
+ mPart.setBindingExtensibilityElementKind(MessagePart.SOAP_BODY_BINDING);
+ parts.add(mPart);
+ }else{
+ mPart.setBindingExtensibilityElementKind(MessagePart.PART_NOT_BOUNDED);
+ }
+ }
+
+ if(isOperationDocumentLiteral(styleAndUse) && bodyParts.size() > 1){
+ if(extensions)
+ warn("wsdlmodeler.warning.operation.MoreThanOnePartInMessage",
+ info.portTypeOperation.getName());
+ else
+ fail("wsdlmodeler.invalid.operation.MoreThanOnePartInMessage",
info.portTypeOperation.getName());
+ return false;
+ }
+ return true;
+ }
+
+ private boolean boundToFault(String partName){
+ for (Iterator iter = info.bindingOperation.faults(); iter.hasNext();){
+ BindingFault bindingFault = (BindingFault)iter.next();
+ if(partName.equals(bindingFault.getName()))
+ return true;
+ }
+ return false;
+ }
+
+ //get MessagePart(s) referenced by parts attribute of soap:body element
+ private List<MessagePart> getBodyParts(SOAPBody body, Message message){
+ String bodyParts = body.getParts();
+ if (bodyParts != null) {
+ List<MessagePart> partsList = new ArrayList<MessagePart>();
+ StringTokenizer in = new StringTokenizer(bodyParts.trim(), " ");
+ while (in.hasMoreTokens()) {
+ String part = in.nextToken();
+ MessagePart mPart = message.getPart(part);
+ if (null == mPart) {
+ throw new ModelerException(
+ "wsdlmodeler.error.partsNotFound",
+ new Object[] { part, message.getName()});
+ }
+ mPart.setBindingExtensibilityElementKind(MessagePart.SOAP_BODY_BINDING);
+ partsList.add(mPart);
+ }
+ return partsList;
+ }
+ return null;
+ }
+
+ private List<MessagePart> getHeaderPartsFromMessage(Message message, boolean
isInput){
+ List<MessagePart> headerParts = new ArrayList<MessagePart>();
+ Iterator<MessagePart> parts = message.parts();
+ List<MessagePart> headers = getHeaderParts(isInput);
+ while(parts.hasNext()){
+ MessagePart part = parts.next();
+ if(headers.contains(part)){
+ headerParts.add(part);
+ }
+ }
+ return headerParts;
+ }
+
+ private Message getHeaderMessage(MessagePart part, Extensible ext) {
+ Iterator<SOAPHeader> headers = getHeaderExtensions(ext).iterator();
+ while(headers.hasNext()){
+ SOAPHeader header = headers.next();
+ if (!header.isLiteral())
+ continue;
+ org.jboss.com.sun.tools.ws.wsdl.document.Message headerMessage =
findMessage(header.getMessage(), info);
+ if (headerMessage == null)
+ continue;
+
+ MessagePart headerPart = headerMessage.getPart(header.getPart());
+ if(headerPart == part)
+ return headerMessage;
+ }
+ return null;
+ }
+
+ private List<MessagePart> getHeaderPartsNotFromMessage(Message message, boolean
isInput){
+ List<MessagePart> headerParts = new ArrayList<MessagePart>();
+ List<MessagePart> parts = message.getParts();
+ Iterator<MessagePart> headers = getHeaderParts(isInput).iterator();
+ while(headers.hasNext()){
+ MessagePart part = headers.next();
+ if(!parts.contains(part)){
+ headerParts.add(part);
+ }
+ }
+ return headerParts;
+ }
+
+ private List<MessagePart> getHeaderParts(boolean isInput) {
+ Extensible ext;
+ if(isInput){
+ ext = info.bindingOperation.getInput();
+ }else{
+ ext = info.bindingOperation.getOutput();
+ }
+
+ List<MessagePart> parts = new ArrayList<MessagePart>();
+ Iterator<SOAPHeader> headers = getHeaderExtensions(ext).iterator();
+ while(headers.hasNext()){
+ SOAPHeader header = headers.next();
+ if (!header.isLiteral()){
+ fail("wsdlmodeler.invalid.header.notLiteral",
+ new Object[] {header.getPart(),
info.bindingOperation.getName()});
+ }
+
+ if (header.getNamespace() != null){
+ warn("wsdlmodeler.warning.r2716r2726",
+ new Object[]{"soapbind:header",
info.bindingOperation.getName()});
+ }
+ org.jboss.com.sun.tools.ws.wsdl.document.Message headerMessage =
findMessage(header.getMessage(), info);
+ if (headerMessage == null){
+ fail("wsdlmodeler.invalid.header.cant.resolve.message",
+ new Object[]{header.getMessage(),
info.bindingOperation.getName()});
+ }
+
+ MessagePart part = headerMessage.getPart(header.getPart());
+ if (part == null){
+ fail("wsdlmodeler.invalid.header.notFound",
+ new Object[]{header.getPart(),
info.bindingOperation.getName()});
+ }
+ if (part.getDescriptorKind() != SchemaKinds.XSD_ELEMENT) {
+
fail("wsdlmodeler.invalid.header.message.partMustHaveElementDescriptor",
+ new Object[]{part.getName(), info.bindingOperation.getName()});
+ }
+ part.setBindingExtensibilityElementKind(MessagePart.SOAP_HEADER_BINDING);
+ parts.add(part);
+ }
+ return parts;
+ }
+
+ private boolean isOperationDocumentLiteral(StyleAndUse styleAndUse){
+ return StyleAndUse.DOC_LITERAL == styleAndUse;
+ }
+
+ private boolean isOperationRpcLiteral(StyleAndUse styleAndUse){
+ return StyleAndUse.RPC_LITERAL == styleAndUse;
+ }
+
+ /**
+ * @param part
+ * @return Returns a JAXBType object
+ */
+ private JAXBType getJAXBType(MessagePart part){
+ JAXBType type=null;
+ QName name = part.getDescriptor();
+ if(part.getDescriptorKind().equals(SchemaKinds.XSD_ELEMENT)){
+ type = getJAXBType(name);
+ }else {
+ S2JJAXBModel jaxbModel =
getJAXBModelBuilder().getJAXBModel().getS2JJAXBModel();
+ TypeAndAnnotation typeAnno = jaxbModel.getJavaType(name);
+ if(typeAnno == null){
+ fail("wsdlmodeler.jaxb.javatype.notfound", new Object[]{name,
part.getName()});
+ }
+ JavaType javaType = new JavaSimpleType(new
JAXBTypeAndAnnotation(typeAnno));
+ type = new JAXBType(new QName("", part.getName()), javaType);
+ }
+ return type;
+ }
+
+ private List<Parameter> getDoclitParameters(Request req, Response res,
List<MessagePart> parameterList){
+ if(parameterList.size() == 0)
+ return new ArrayList<Parameter>();
+ List<Parameter> params = null;
+ Message inMsg = getInputMessage();
+ Message outMsg = getOutputMessage();
+ boolean unwrappable = isUnwrappable();
+ List<Parameter> outParams = null;
+ int pIndex = 0;
+ for(MessagePart part:parameterList){
+ QName reqBodyName = part.getDescriptor();
+ JAXBType jaxbType = getJAXBType(part);
+ Block block = new Block(reqBodyName, jaxbType);
+ if(unwrappable){
+ //So build body and header blocks and set to request and response
+ JAXBStructuredType jaxbStructType =
ModelerUtils.createJAXBStructureType(jaxbType);
+ block = new Block(reqBodyName, jaxbStructType);
+ if(ModelerUtils.isBoundToSOAPBody(part)){
+ if(part.isIN()){
+ req.addBodyBlock(block);
+ }else if(part.isOUT()){
+ res.addBodyBlock(block);
+ }else if(part.isINOUT()){
+ req.addBodyBlock(block);
+ res.addBodyBlock(block);
+ }
+ }else if(ModelerUtils.isUnbound(part)){
+ if(part.isIN())
+ req.addUnboundBlock(block);
+ else if(part.isOUT())
+ res.addUnboundBlock(block);
+ else if(part.isINOUT()){
+ req.addUnboundBlock(block);
+ res.addUnboundBlock(block);
+ }
+
+ }
+ if(part.isIN() || part.isINOUT()){
+ params = ModelerUtils.createUnwrappedParameters(jaxbStructType,
block);
+ int index = 0;
+ Mode mode = (part.isINOUT())?Mode.INOUT:Mode.IN;
+ for(Parameter param: params){
+ param.setParameterIndex(index++);
+ param.setMode(mode);
+ setCustomizedParameterName(info.portTypeOperation, inMsg, part,
param, unwrappable);
+ }
+ }else if(part.isOUT()){
+ outParams = ModelerUtils.createUnwrappedParameters(jaxbStructType,
block);
+ for(Parameter param: outParams){
+ param.setMode(Mode.OUT);
+ setCustomizedParameterName(info.portTypeOperation, outMsg, part,
param, unwrappable);
+ }
+ }
+ }else{
+ if(ModelerUtils.isBoundToSOAPBody(part)){
+ if(part.isIN()){
+ req.addBodyBlock(block);
+ }else if(part.isOUT()){
+ res.addBodyBlock(block);
+ }else if(part.isINOUT()){
+ req.addBodyBlock(block);
+ res.addBodyBlock(block);
+ }
+ }else if(ModelerUtils.isBoundToSOAPHeader(part)){
+ if(part.isIN()){
+ req.addHeaderBlock(block);
+ }else if(part.isOUT()){
+ res.addHeaderBlock(block);
+ }else if(part.isINOUT()){
+ req.addHeaderBlock(block);
+ res.addHeaderBlock(block);
+ }
+ }else if(ModelerUtils.isBoundToMimeContent(part)){
+ List<MIMEContent> mimeContents = null;
+
+ if(part.isIN()){
+ mimeContents = getMimeContents(info.bindingOperation.getInput(),
+ getInputMessage(), part.getName());
+ jaxbType = getAttachmentType(mimeContents, part);
+ block = new Block(jaxbType.getName(), jaxbType);
+ req.addAttachmentBlock(block);
+ }else if(part.isOUT()){
+ mimeContents =
getMimeContents(info.bindingOperation.getOutput(),
+ getOutputMessage(), part.getName());
+ jaxbType = getAttachmentType(mimeContents, part);
+ block = new Block(jaxbType.getName(), jaxbType);
+ res.addAttachmentBlock(block);
+ }else if(part.isINOUT()){
+ mimeContents = getMimeContents(info.bindingOperation.getInput(),
+ getInputMessage(), part.getName());
+ jaxbType = getAttachmentType(mimeContents, part);
+ block = new Block(jaxbType.getName(), jaxbType);
+ req.addAttachmentBlock(block);
+ res.addAttachmentBlock(block);
+
+ mimeContents =
getMimeContents(info.bindingOperation.getOutput(),
+ getOutputMessage(), part.getName());
+ JAXBType outJaxbType = getAttachmentType(mimeContents, part);
+
+ String inType = jaxbType.getJavaType().getType().getName();
+ String outType = outJaxbType.getJavaType().getType().getName();
+
+ TypeAndAnnotation inTa =
jaxbType.getJavaType().getType().getTypeAnn();
+ TypeAndAnnotation outTa =
outJaxbType.getJavaType().getType().getTypeAnn();
+ if((((inTa != null) && (outTa != null) &&
inTa.equals(outTa))) && !inType.equals(outType)){
+ String javaType = "javax.activation.DataHandler";
+
+ S2JJAXBModel jaxbModel =
getJAXBModelBuilder().getJAXBModel().getS2JJAXBModel();
+ JCodeModel cm = jaxbModel.generateCode(null,
+ new ConsoleErrorReporter(getEnvironment(),
false));
+ JType jt= null;
+ jt = cm.ref(javaType);
+ JAXBTypeAndAnnotation jaxbTa =
jaxbType.getJavaType().getType();
+ jaxbTa.setType(jt);
+ }
+ }
+ }else if(ModelerUtils.isUnbound(part)){
+ if(part.isIN()){
+ req.addUnboundBlock(block);
+ }else if(part.isOUT()){
+ res.addUnboundBlock(block);
+ }else if(part.isINOUT()){
+ req.addUnboundBlock(block);
+ res.addUnboundBlock(block);
+ }
+ }
+ if(params == null)
+ params = new ArrayList<Parameter>();
+ Parameter param = ModelerUtils.createParameter(part.getName(), jaxbType,
block);
+ param.setMode(part.getMode());
+ if(part.isReturn()){
+ param.setParameterIndex(-1);
+ }else{
+ param.setParameterIndex(pIndex++);
+ }
+
+ if(part.isIN())
+ setCustomizedParameterName(info.portTypeOperation, inMsg, part,
param, false);
+ else if(outMsg != null)
+ setCustomizedParameterName(info.portTypeOperation, outMsg, part,
param, false);
+
+ params.add(param);
+ }
+ }
+ if(unwrappable && (outParams != null)){
+ int index = params.size();
+ for(Parameter param:outParams){
+ if(param.getName().equals("return")){
+ param.setParameterIndex(-1);
+ }else{
+ Parameter inParam = ModelerUtils.getParameter(param.getName(),
params);
+ if((inParam != null) && inParam.isIN()){
+ QName inElementName = ((JAXBType)inParam.getType()).getName();
+ QName outElementName = ((JAXBType)param.getType()).getName();
+ String inJavaType = inParam.getTypeName();
+ String outJavaType = param.getTypeName();
+ TypeAndAnnotation inTa =
inParam.getType().getJavaType().getType().getTypeAnn();
+ TypeAndAnnotation outTa =
param.getType().getJavaType().getType().getTypeAnn();
+
if(inElementName.getLocalPart().equals(outElementName.getLocalPart()) &&
+ inJavaType.equals(outJavaType) &&
+ ((inTa == null || outTa == null)||
+ ((inTa != null) && (outTa != null) &&
inTa.equals(outTa)))) {
+ inParam.setMode(Mode.INOUT);
+ continue;
+ }
+ }else if(outParams.size() == 1){
+ param.setParameterIndex(-1);
+ }else{
+ param.setParameterIndex(index++);
+ }
+ }
+ params.add(param);
+ }
+ }
+ return params;
+ }
+
+ private List<Parameter> getRpcLitParameters(Request req, Response res, Block
reqBlock, Block resBlock, List<MessagePart> paramList){
+ List<Parameter> params = new ArrayList<Parameter>();
+ Message inMsg = getInputMessage();
+ Message outMsg = getOutputMessage();
+ S2JJAXBModel jaxbModel =
((RpcLitStructure)reqBlock.getType()).getJaxbModel().getS2JJAXBModel();
+ List<Parameter> inParams = ModelerUtils.createRpcLitParameters(inMsg,
reqBlock, jaxbModel);
+ List<Parameter> outParams = null;
+ if(outMsg != null)
+ outParams = ModelerUtils.createRpcLitParameters(outMsg, resBlock,
jaxbModel);
+
+ //create parameters for header and mime parts
+ int index = 0;
+ for(MessagePart part: paramList){
+ Parameter param = null;
+ if(ModelerUtils.isBoundToSOAPBody(part)){
+ if(part.isIN()){
+ param = ModelerUtils.getParameter(part.getName(), inParams);
+ }else if(outParams != null){
+ param = ModelerUtils.getParameter(part.getName(), outParams);
+ }
+ }else if(ModelerUtils.isBoundToSOAPHeader(part)){
+ QName headerName = part.getDescriptor();
+ JAXBType jaxbType = getJAXBType(headerName);
+ Block headerBlock = new Block(headerName, jaxbType);
+ param = ModelerUtils.createParameter(part.getName(), jaxbType,
headerBlock);
+ if(part.isIN()){
+ req.addHeaderBlock(headerBlock);
+ }else if(part.isOUT()){
+ res.addHeaderBlock(headerBlock);
+ }else if(part.isINOUT()){
+ req.addHeaderBlock(headerBlock);
+ res.addHeaderBlock(headerBlock);
+ }
+ }else if(ModelerUtils.isBoundToMimeContent(part)){
+ List<MIMEContent> mimeContents = null;
+ if(part.isIN() || part.isINOUT())
+ mimeContents = getMimeContents(info.bindingOperation.getInput(),
+ getInputMessage(), part.getName());
+ else
+ mimeContents = getMimeContents(info.bindingOperation.getOutput(),
+ getOutputMessage(), part.getName());
+
+ JAXBType type = getAttachmentType(mimeContents, part);
+ //create Parameters in request or response
+ //Block mimeBlock = new Block(new QName(part.getName()), type);
+ Block mimeBlock = new Block(type.getName(), type);
+ param = ModelerUtils.createParameter(part.getName(), type, mimeBlock);
+ if(part.isIN()){
+ req.addAttachmentBlock(mimeBlock);
+ }else if(part.isOUT()){
+ res.addAttachmentBlock(mimeBlock);
+ }else if(part.isINOUT()){
+ mimeContents = getMimeContents(info.bindingOperation.getOutput(),
+ getOutputMessage(), part.getName());
+ JAXBType outJaxbType = getAttachmentType(mimeContents, part);
+
+ String inType = type.getJavaType().getType().getName();
+ String outType = outJaxbType.getJavaType().getType().getName();
+ if(!inType.equals(outType)){
+ String javaType = "javax.activation.DataHandler";
+ JCodeModel cm = jaxbModel.generateCode(null,
+ new ConsoleErrorReporter(getEnvironment(), false));
+ JType jt= null;
+ jt = cm.ref(javaType);
+ JAXBTypeAndAnnotation jaxbTa = type.getJavaType().getType();
+ jaxbTa.setType(jt);
+ }
+ req.addAttachmentBlock(mimeBlock);
+ res.addAttachmentBlock(mimeBlock);
+ }
+ }else if(ModelerUtils.isUnbound(part)){
+ QName name = part.getDescriptor();
+ JAXBType type = getJAXBType(part);
+ Block unboundBlock = new Block(name, type);
+ if(part.isIN()){
+ req.addUnboundBlock(unboundBlock);
+ }else if(part.isOUT()){
+ res.addUnboundBlock(unboundBlock);
+ }else if(part.isINOUT()){
+ req.addUnboundBlock(unboundBlock);
+ res.addUnboundBlock(unboundBlock);
+ }
+ param = ModelerUtils.createParameter(part.getName(), type,
unboundBlock);
+ }
+ if(param != null){
+ if(part.isReturn()){
+ param.setParameterIndex(-1);
+ }else{
+ param.setParameterIndex(index++);
+ }
+ param.setMode(part.getMode());
+ params.add(param);
+ }
+ }
+ for(Parameter param : params){
+ if(param.isIN())
+ setCustomizedParameterName(info.portTypeOperation, inMsg,
inMsg.getPart(param.getName()), param, false);
+ else if(outMsg != null)
+ setCustomizedParameterName(info.portTypeOperation, outMsg,
outMsg.getPart(param.getName()), param, false);
+ }
+ return params;
+ }
+
+ private List<Parameter> getRequestParameters(Request request,
List<String> parameterList) {
+ Message inputMessage = getInputMessage();
+ //there is no input message, return zero parameters
+ if(inputMessage != null && !inputMessage.parts().hasNext())
+ return new ArrayList<Parameter>();
+
+ List<Parameter> inParameters = null;
+ QName reqBodyName = null;
+ Block reqBlock = null;
+ JAXBType jaxbReqType = null;
+ boolean unwrappable = isUnwrappable();
+ boolean doneSOAPBody = false;
+ //setup request parameters
+ for(String inParamName: parameterList){
+ MessagePart part = inputMessage.getPart(inParamName);
+ if(part == null)
+ continue;
+ reqBodyName = part.getDescriptor();
+ jaxbReqType = getJAXBType(part);
+ if(unwrappable){
+ //So build body and header blocks and set to request and response
+ JAXBStructuredType jaxbRequestType =
ModelerUtils.createJAXBStructureType(jaxbReqType);
+ reqBlock = new Block(reqBodyName, jaxbRequestType);
+ if(ModelerUtils.isBoundToSOAPBody(part)){
+ request.addBodyBlock(reqBlock);
+ }else if(ModelerUtils.isUnbound(part)){
+ request.addUnboundBlock(reqBlock);
+ }
+ inParameters = ModelerUtils.createUnwrappedParameters(jaxbRequestType,
reqBlock);
+ for(Parameter param: inParameters){
+ setCustomizedParameterName(info.portTypeOperation, inputMessage,
part, param, unwrappable);
+ }
+ }else{
+ reqBlock = new Block(reqBodyName, jaxbReqType);
+ if(ModelerUtils.isBoundToSOAPBody(part) && !doneSOAPBody){
+ doneSOAPBody = true;
+ request.addBodyBlock(reqBlock);
+ }else if(ModelerUtils.isBoundToSOAPHeader(part)){
+ request.addHeaderBlock(reqBlock);
+ }else if(ModelerUtils.isBoundToMimeContent(part)){
+ List<MIMEContent> mimeContents =
getMimeContents(info.bindingOperation.getInput(),
+ getInputMessage(), part.getName());
+ jaxbReqType = getAttachmentType(mimeContents, part);
+ //reqBlock = new Block(new QName(part.getName()), jaxbReqType);
+ reqBlock = new Block(jaxbReqType.getName(), jaxbReqType);
+ request.addAttachmentBlock(reqBlock);
+ }else if(ModelerUtils.isUnbound(part)){
+ request.addUnboundBlock(reqBlock);
+ }
+ if(inParameters == null)
+ inParameters = new ArrayList<Parameter>();
+ Parameter param = ModelerUtils.createParameter(part.getName(),
jaxbReqType, reqBlock);
+ setCustomizedParameterName(info.portTypeOperation, inputMessage, part,
param, false);
+ inParameters.add(param);
+ }
+ }
+ return inParameters;
+ }
+
+ /**
+ * @param part
+ * @param param
+ * @param wrapperStyle TODO
+ */
+ private void setCustomizedParameterName(Extensible extension, Message msg,
MessagePart part, Parameter param, boolean wrapperStyle) {
+ JAXWSBinding jaxwsBinding = (JAXWSBinding)getExtensionOfType(extension,
JAXWSBinding.class);
+ if(jaxwsBinding == null)
+ return;
+ String paramName = part.getName();
+ QName elementName = part.getDescriptor();
+ if(wrapperStyle)
+ elementName = param.getType().getName();
+ String customName = jaxwsBinding.getParameterName(msg.getName(), paramName,
elementName, wrapperStyle);
+ if(customName != null && !customName.equals("")){
+ param.setCustomName(customName);
+ }
+ }
+
+ /**
+ * @param name
+ * @return
+ */
+ private JAXBType getJAXBType(QName name) {
+ return jaxbModelBuilder.getJAXBType(name);
+ }
+
+ protected boolean isConflictingPortClassName(String name) {
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see WSDLModelerBase#getJAXBSchemaAnalyzerInstnace(WSDLModelInfo, Properties,
org.w3c.dom.Element)
+ */
+ protected JAXBModelBuilder getJAXBSchemaAnalyzerInstnace(WSDLModelInfo info,
+ Properties options,
+ ClassNameCollector
classNameCollector, List elements) {
+ return new JAXBModelBuilder(info, options, classNameCollector, elements);
+ }
+
+ /* (non-Javadoc)
+ * @see WSDLModelerBase#isUnwrappable()
+ */
+ protected boolean isUnwrappable() {
+ if(!getWrapperStyleCustomization())
+ return false;
+
+ org.jboss.com.sun.tools.ws.wsdl.document.Message inputMessage =
getInputMessage();
+ org.jboss.com.sun.tools.ws.wsdl.document.Message outputMessage =
getOutputMessage();
+
+ // Wrapper style if the operation's input and output messages each contain
+ // only a single part
+ if ((inputMessage != null && inputMessage.numParts() != 1)
+ || (outputMessage != null && outputMessage.numParts() != 1)) {
+ return false;
+ }
+
+ MessagePart inputPart = inputMessage != null
+ ? (MessagePart)inputMessage.parts().next() : null;
+ MessagePart outputPart = outputMessage != null
+ ? (MessagePart)outputMessage.parts().next() : null;
+ String operationName = info.portTypeOperation.getName();
+
+ // Wrapper style if the input message part refers to a global element declaration
whose localname
+ // is equal to the operation name
+ // Wrapper style if the output message part refers to a global element
declaration
+ if ((inputPart != null &&
!inputPart.getDescriptor().getLocalPart().equals(operationName)) ||
+ (outputPart != null && outputPart.getDescriptorKind() !=
SchemaKinds.XSD_ELEMENT))
+ return false;
+
+ //check to see if either input or output message part not bound to soapbing:body
+ //in that case the operation is not wrapper style
+ if(((inputPart != null) &&
(inputPart.getBindingExtensibilityElementKind() != MessagePart.SOAP_BODY_BINDING)) ||
+ ((outputPart != null)
&&(outputPart.getBindingExtensibilityElementKind() !=
MessagePart.SOAP_BODY_BINDING)))
+ return false;
+
+ // Wrapper style if the elements referred to by the input and output message
parts
+ // (henceforth referred to as wrapper elements) are both complex types defined
+ // using the xsd:sequence compositor
+ // Wrapper style if the wrapper elements only contain child elements, they must
not
+ // contain other structures such as xsd:choice, substitution groups1 or
attributes
+ //These checkins are done by jaxb, we just check if jaxb has wrapper children. If
there
+ // are then its wrapper style
+ //if(inputPart != null && outputPart != null){
+ if(inputPart != null){
+ boolean inputWrappable = false;
+ JAXBType inputType = getJAXBType(inputPart.getDescriptor());
+ if(inputType != null){
+ inputWrappable = inputType.isUnwrappable();
+ }
+ //if there are no output part (oneway), the operation can still be wrapper
style
+ if(outputPart == null){
+ return inputWrappable;
+ }
+ JAXBType outputType = getJAXBType(outputPart.getDescriptor());
+ if((inputType != null) && (outputType != null))
+ return inputType.isUnwrappable() && outputType.isUnwrappable();
+ }
+
+ return false;
+ }
+
+ /**
+ * @return
+ */
+ private boolean getWrapperStyleCustomization() {
+ //first we look into wsdl:portType/wsdl:operation
+ org.jboss.com.sun.tools.ws.wsdl.document.Operation portTypeOperation =
info.portTypeOperation;
+ JAXWSBinding jaxwsBinding = (JAXWSBinding)getExtensionOfType(portTypeOperation,
JAXWSBinding.class);
+ if(jaxwsBinding != null){
+ Boolean isWrappable = jaxwsBinding.isEnableWrapperStyle();
+ if(isWrappable != null)
+ return isWrappable;
+ }
+
+ //then into wsdl:portType
+ PortType portType =
info.port.resolveBinding(document).resolvePortType(document);
+ jaxwsBinding = (JAXWSBinding)getExtensionOfType(portType, JAXWSBinding.class);
+ if(jaxwsBinding != null){
+ Boolean isWrappable = jaxwsBinding.isEnableWrapperStyle();
+ if(isWrappable != null)
+ return isWrappable;
+ }
+
+ //then wsdl:definitions
+ jaxwsBinding = (JAXWSBinding)getExtensionOfType(document.getDefinitions(),
JAXWSBinding.class);
+ if(jaxwsBinding != null){
+ Boolean isWrappable = jaxwsBinding.isEnableWrapperStyle();
+ if(isWrappable != null)
+ return isWrappable;
+ }
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see WSDLModelerBase#isSingleInOutPart(Set, MessagePart)
+ */
+ protected boolean isSingleInOutPart(Set inputParameterNames,
+ MessagePart outputPart) {
+ // As of now, we dont have support for in/out in doc-lit. So return false.
+ SOAPOperation soapOperation =
+ (SOAPOperation) getExtensionOfType(info.bindingOperation,
+ SOAPOperation.class);
+ if((soapOperation != null) && (soapOperation.isDocument() ||
info.soapBinding.isDocument())) {
+ Iterator iter = getInputMessage().parts();
+ while(iter.hasNext()){
+ MessagePart part = (MessagePart)iter.next();
+ if(outputPart.getName().equals(part.getName()) &&
outputPart.getDescriptor().equals(part.getDescriptor()))
+ return true;
+ }
+ }else if(soapOperation != null && soapOperation.isRPC()||
info.soapBinding.isRPC()){
+ org.jboss.com.sun.tools.ws.wsdl.document.Message inputMessage =
getInputMessage();
+ if(inputParameterNames.contains(outputPart.getName())) {
+ if
(inputMessage.getPart(outputPart.getName()).getDescriptor().equals(outputPart.getDescriptor()))
{
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private List<Parameter> createRpcLitRequestParameters(Request request,
List<String> parameterList, Block block) {
+ Message message = getInputMessage();
+ S2JJAXBModel jaxbModel =
((RpcLitStructure)block.getType()).getJaxbModel().getS2JJAXBModel();
+ List<Parameter> parameters = ModelerUtils.createRpcLitParameters(message,
block, jaxbModel);
+
+ //create parameters for header and mime parts
+ for(String paramName: parameterList){
+ MessagePart part = message.getPart(paramName);
+ if(part == null)
+ continue;
+ if(ModelerUtils.isBoundToSOAPHeader(part)){
+ if(parameters == null)
+ parameters = new ArrayList<Parameter>();
+ QName headerName = part.getDescriptor();
+ JAXBType jaxbType = getJAXBType(headerName);
+ Block headerBlock = new Block(headerName, jaxbType);
+ request.addHeaderBlock(headerBlock);
+ Parameter param = ModelerUtils.createParameter(part.getName(), jaxbType,
headerBlock);
+ if(param != null){
+ parameters.add(param);
+ }
+ }else if(ModelerUtils.isBoundToMimeContent(part)){
+ if(parameters == null)
+ parameters = new ArrayList<Parameter>();
+ List<MIMEContent> mimeContents =
getMimeContents(info.bindingOperation.getInput(),
+ getInputMessage(), paramName);
+
+ JAXBType type = getAttachmentType(mimeContents, part);
+ //create Parameters in request or response
+ //Block mimeBlock = new Block(new QName(part.getName()), type);
+ Block mimeBlock = new Block(type.getName(), type);
+ request.addAttachmentBlock(mimeBlock);
+ Parameter param = ModelerUtils.createParameter(part.getName(), type,
mimeBlock);
+ if(param != null){
+ parameters.add(param);
+ }
+ }else if(ModelerUtils.isUnbound(part)){
+ if(parameters == null)
+ parameters = new ArrayList<Parameter>();
+ QName name = part.getDescriptor();
+ JAXBType type = getJAXBType(part);
+ Block unboundBlock = new Block(name, type);
+ request.addUnboundBlock(unboundBlock);
+ Parameter param = ModelerUtils.createParameter(part.getName(), type,
unboundBlock);
+ if(param != null){
+ parameters.add(param);
+ }
+ }
+ }
+ for(Parameter param : parameters){
+ setCustomizedParameterName(info.portTypeOperation, message,
message.getPart(param.getName()), param, false);
+ }
+ return parameters;
+ }
+
+ private String getJavaTypeForMimeType(String mimeType){
+ if(mimeType.equals("image/jpeg") ||
mimeType.equals("image/gif")){
+ return "java.awt.Image";
+ }else if(mimeType.equals("text/xml") ||
mimeType.equals("application/xml")){
+ return "javax.xml.transform.Source";
+ }
+ return "javax.activation.DataHandler";
+ }
+
+ /**
+ * @param mimeContents
+ * @return
+ */
+ private JAXBType getAttachmentType(List<MIMEContent> mimeContents, MessagePart
part) {
+ if(!enableMimeContent()){
+ return getJAXBType(part);
+ }
+ String javaType = null;
+ List<String> mimeTypes = getAlternateMimeTypes(mimeContents);
+ if(mimeTypes.size() > 1) {
+ javaType = "javax.activation.DataHandler";
+ }else{
+ javaType = getJavaTypeForMimeType(mimeTypes.get(0));
+ }
+
+ S2JJAXBModel jaxbModel = getJAXBModelBuilder().getJAXBModel().getS2JJAXBModel();
+ JCodeModel cm = jaxbModel.generateCode(null,
+ new ConsoleErrorReporter(getEnvironment(), false));
+ JType jt= null;
+ jt = cm.ref(javaType);
+ QName desc = part.getDescriptor();
+ TypeAndAnnotation typeAnno = null;
+
+ if (part.getDescriptorKind() == SchemaKinds.XSD_TYPE) {
+ typeAnno = jaxbModel.getJavaType(desc);
+ desc = new QName("", part.getName());
+ } else if (part.getDescriptorKind()== SchemaKinds.XSD_ELEMENT) {
+ typeAnno = getJAXBModelBuilder().getElementTypeAndAnn(desc);
+ for(Iterator mimeTypeIter = mimeTypes.iterator(); mimeTypeIter.hasNext();) {
+ String mimeType = (String)mimeTypeIter.next();
+ if((!mimeType.equals("text/xml") &&
+ !mimeType.equals("application/xml"))){
+ //According to AP 1.0,
+ //RZZZZ: In a DESCRIPTION, if a wsdl:part element refers to a
+ //global element declaration (via the element attribute of the
wsdl:part
+ //element) then the value of the type attribute of a mime:content
element
+ //that binds that part MUST be a content type suitable for carrying
an
+ //XML serialization.
+ //should we throw warning?
+ //type = MimeHelper.javaType.DATA_HANDLER_JAVATYPE;
+ warn("mimemodeler.elementPart.invalidElementMimeType",
+ new Object[] {
+ part.getName(), mimeType});
+ }
+ }
+ }
+ if(typeAnno == null){
+ fail("wsdlmodeler.jaxb.javatype.notfound", new Object[]{desc,
part.getName()});
+ }
+ return new JAXBType(desc, new JavaSimpleType(new JAXBTypeAndAnnotation(typeAnno,
jt)),
+ null, getJAXBModelBuilder().getJAXBModel());
+ }
+
+ protected void buildJAXBModel(WSDLDocument wsdlDocument, WSDLModelInfo modelInfo,
ClassNameCollector classNameCollector) {
+ JAXBModelBuilder jaxbModelBuilder = new JAXBModelBuilder(getWSDLModelInfo(),
_options, classNameCollector, parser.getSchemaElements());
+ //set the java package where wsdl artifacts will be generated
+ //if user provided package name using -p switch (or package property on wsimport
ant task)
+ //ignore the package customization in the wsdl and schema bidnings
+ if(getWSDLModelInfo().getDefaultJavaPackage() != null){
+
getWSDLModelInfo().setJavaPackageName(getWSDLModelInfo().getDefaultJavaPackage());
+
jaxbModelBuilder.getJAXBSchemaCompiler().forcePackageName(getWSDLModelInfo().getJavaPackageName());
+ }else{
+ String jaxwsPackage = getJavaPackage();
+ getWSDLModelInfo().setJavaPackageName(jaxwsPackage);
+ }
+
+ //create pseudo schema for async operations(if any) response bean
+ List<InputSource> schemas = PseudoSchemaBuilder.build(this, _modelInfo);
+ for(InputSource schema : schemas){
+ jaxbModelBuilder.getJAXBSchemaCompiler().parseSchema(schema);
+ }
+ jaxbModelBuilder.bind();
+ this.jaxbModelBuilder = jaxbModelBuilder;
+ }
+
+ protected String getJavaPackage(){
+ String jaxwsPackage = null;
+ JAXWSBinding jaxwsCustomization =
(JAXWSBinding)getExtensionOfType(document.getDefinitions(), JAXWSBinding.class);
+ if(jaxwsCustomization != null && jaxwsCustomization.getJaxwsPackage() !=
null){
+ jaxwsPackage = jaxwsCustomization.getJaxwsPackage().getName();
+ }
+ if(jaxwsPackage != null){
+ return jaxwsPackage;
+ }
+ String wsdlUri = document.getDefinitions().getTargetNamespaceURI();
+ return XJC.getDefaultPackageName(wsdlUri);
+
+ }
+
+ protected void createJavaInterfaceForProviderPort(Port port) {
+ String interfaceName = "javax.xml.ws.Provider";
+ JavaInterface intf = new JavaInterface(interfaceName);
+ port.setJavaInterface(intf);
+ }
+
+ protected void createJavaInterfaceForPort(Port port, boolean isProvider) {
+ if(isProvider){
+ createJavaInterfaceForProviderPort(port);
+ return;
+ }
+ String interfaceName = getJavaNameOfSEI(port);
+
+ if (isConflictingPortClassName(interfaceName)) {
+ interfaceName += "_PortType";
+ }
+
+ JavaInterface intf = new JavaInterface(interfaceName);
+ for (Operation operation : port.getOperations()) {
+ createJavaMethodForOperation(
+ port,
+ operation,
+ intf);
+
+ for(JavaParameter jParam : operation.getJavaMethod().getParametersList()){
+ Parameter param = jParam.getParameter();
+ if(param.getCustomName() != null)
+ jParam.setName(param.getCustomName());
+ }
+ }
+
+ port.setJavaInterface(intf);
+ }
+
+ protected String getServiceInterfaceName(QName serviceQName,
org.jboss.com.sun.tools.ws.wsdl.document.Service wsdlService) {
+ String serviceName = wsdlService.getName();
+ JAXWSBinding jaxwsCust = (JAXWSBinding)getExtensionOfType(wsdlService,
JAXWSBinding.class);
+ if(jaxwsCust != null && jaxwsCust.getClassName() != null){
+ CustomName name = jaxwsCust.getClassName();
+ if(name != null && !name.equals(""))
+ serviceName = name.getName();
+ }
+ String serviceInterface = "";
+ String javaPackageName = null;
+ if (_modelInfo.getJavaPackageName() != null
+ && !_modelInfo.getJavaPackageName().equals("")) {
+ javaPackageName = _modelInfo.getJavaPackageName();
+ }
+ if (javaPackageName != null) {
+ serviceInterface = javaPackageName + ".";
+ }
+ serviceInterface
+ += getEnvironment().getNames().validJavaClassName(serviceName);
+ return serviceInterface;
+ }
+
+ protected String getJavaNameOfSEI(Port port) {
+ QName portTypeName =
+ (QName)port.getProperty(
+ ModelProperties.PROPERTY_WSDL_PORT_TYPE_NAME);
+ PortType pt = (PortType)document.find(Kinds.PORT_TYPE, portTypeName);
+ JAXWSBinding jaxwsCust = (JAXWSBinding)getExtensionOfType(pt,
JAXWSBinding.class);
+ if(jaxwsCust != null && jaxwsCust.getClassName() != null){
+ CustomName name = jaxwsCust.getClassName();
+ if(name != null && !name.equals("")){
+ return makePackageQualified(
+ name.getName(),
+ portTypeName,
+ false);
+ }
+ }
+
+ String interfaceName = null;
+ if (portTypeName != null) {
+ // got portType information from WSDL, use it to name the interface
+ interfaceName =
+
makePackageQualified(JAXBRIContext.mangleNameToClassName(portTypeName.getLocalPart()),
+ portTypeName,
+ false);
+ } else {
+ // somehow we only got the port name, so we use that
+ interfaceName =
+ makePackageQualified(
+ JAXBRIContext.mangleNameToClassName(port.getName().getLocalPart()),
+ port.getName(),
+ false);
+ }
+ return interfaceName;
+ }
+
+ private void createJavaMethodForAsyncOperation(Port port, Operation operation,
+ JavaInterface intf){
+ String candidateName = getJavaNameForOperation(operation);
+ JavaMethod method = new JavaMethod(candidateName);
+ method.setThrowsRemoteException(false);
+ Request request = operation.getRequest();
+ Iterator requestBodyBlocks = request.getBodyBlocks();
+ Block requestBlock =
+ (requestBodyBlocks.hasNext()
+ ? (Block)request.getBodyBlocks().next()
+ : null);
+
+ Response response = operation.getResponse();
+ Iterator responseBodyBlocks = null;
+ Block responseBlock = null;
+ if (response != null) {
+ responseBodyBlocks = response.getBodyBlocks();
+ responseBlock =
+ responseBodyBlocks.hasNext()
+ ? (Block)response.getBodyBlocks().next()
+ : null;
+ }
+
+ // build a signature of the form "opName%arg1type%arg2type%...%argntype so
that we
+ // detect overloading conflicts in the generated java interface/classes
+ String signature = candidateName;
+ for (Iterator iter = request.getParameters(); iter.hasNext();) {
+ Parameter parameter = (Parameter)iter.next();
+
+ if (parameter.getJavaParameter() != null) {
+ throw new ModelerException(
+ "wsdlmodeler.invalidOperation",
+ operation.getName().getLocalPart());
+ }
+
+ JavaType parameterType = parameter.getType().getJavaType();
+ JavaParameter javaParameter =
+ new JavaParameter(
+ JAXBRIContext.mangleNameToVariableName(parameter.getName()),
+ parameterType,
+ parameter,
+ parameter.getLinkedParameter() != null);
+ if (javaParameter.isHolder()) {
+ javaParameter.setHolderName(javax.xml.ws.Holder.class.getName());
+ }
+ method.addParameter(javaParameter);
+ parameter.setJavaParameter(javaParameter);
+
+ signature += "%" + parameterType.getName();
+ }
+
+ if (response != null) {
+ String resultParameterName =
+ (String)operation.getProperty(WSDL_RESULT_PARAMETER);
+ Parameter resultParameter =
+ response.getParameterByName(resultParameterName);
+ JavaType returnType = resultParameter.getType().getJavaType();
+ method.setReturnType(returnType);
+
+ }
+ operation.setJavaMethod(method);
+ intf.addMethod(method);
+ }
+
+ /* (non-Javadoc)
+ * @see WSDLModelerBase#createJavaMethodForOperation(Port, Operation, JavaInterface,
Set, Set)
+ */
+ protected void createJavaMethodForOperation(Port port, Operation operation,
JavaInterface intf) {
+ if((operation instanceof AsyncOperation)){
+ createJavaMethodForAsyncOperation(port, operation, intf);
+ return;
+ }
+ String candidateName = getJavaNameForOperation(operation);
+ JavaMethod method = new JavaMethod(candidateName);
+ Request request = operation.getRequest();
+ Parameter returnParam = (Parameter)operation.getProperty(WSDL_RESULT_PARAMETER);
+ if(returnParam != null){
+ JavaType parameterType = returnParam.getType().getJavaType();
+ method.setReturnType(parameterType);
+ }else{
+ JavaType ret = new JavaSimpleTypeCreator().VOID_JAVATYPE;
+ method.setReturnType(ret);
+ }
+ List<Parameter> parameterOrder =
(List<Parameter>)operation.getProperty(WSDL_PARAMETER_ORDER);
+ for(Parameter param:parameterOrder){
+ JavaType parameterType = param.getType().getJavaType();
+ String name = (param.getCustomName() !=
null)?param.getCustomName():param.getName();
+ JavaParameter javaParameter =
+ new JavaParameter(
+ JAXBRIContext.mangleNameToVariableName(name),
+ parameterType,
+ param,
+ param.isINOUT()||param.isOUT());
+ if (javaParameter.isHolder()) {
+ javaParameter.setHolderName(javax.xml.ws.Holder.class.getName());
+ }
+ method.addParameter(javaParameter);
+ param.setJavaParameter(javaParameter);
+ }
+ operation.setJavaMethod(method);
+ intf.addMethod(method);
+
+ String opName =
JAXBRIContext.mangleNameToVariableName(operation.getName().getLocalPart());
+ for (Iterator iter = operation.getFaults();
+ iter != null && iter.hasNext();
+ ) {
+ Fault fault = (Fault)iter.next();
+ createJavaExceptionFromLiteralType(fault, port, opName);
+ }
+ JavaException javaException;
+ Fault fault;
+ for (Iterator iter = operation.getFaults(); iter.hasNext();) {
+ fault = (Fault)iter.next();
+ javaException = fault.getJavaException();
+ method.addException(javaException.getName());
+ }
+
+ }
+
+ protected boolean createJavaExceptionFromLiteralType(Fault fault,
org.jboss.com.sun.tools.ws.processor.model.Port port, String operationName) {
+ ProcessorEnvironment _env = getProcessorEnvironment();
+
+ JAXBType faultType = (JAXBType)fault.getBlock().getType();
+
+ String exceptionName =
+ makePackageQualified(
+ _env.getNames().validJavaClassName(fault.getName()),
+ port.getName());
+
+ // use fault namespace attribute
+ JAXBStructuredType jaxbStruct = new JAXBStructuredType(new QName(
+
fault.getBlock().getName().getNamespaceURI(),
+ fault.getName()));
+
+ QName memberName = fault.getElementName();
+ JAXBElementMember jaxbMember =
+ new JAXBElementMember(memberName, faultType);
+ //jaxbMember.setNillable(faultType.isNillable());
+
+ String javaMemberName = getLiteralJavaMemberName(fault);
+ JavaStructureMember javaMember = new JavaStructureMember(
+ javaMemberName,
+ faultType.getJavaType(),
+ jaxbMember);
+ jaxbMember.setJavaStructureMember(javaMember);
+ javaMember.setReadMethod(_env.getNames().getJavaMemberReadMethod(javaMember));
+ javaMember.setInherited(false);
+ jaxbMember.setJavaStructureMember(javaMember);
+ jaxbStruct.add(jaxbMember);
+
+ if (isConflictingExceptionClassName(exceptionName)) {
+ exceptionName += "_Exception";
+ }
+
+ JavaException existingJavaException =
(JavaException)_javaExceptions.get(exceptionName);
+ if (existingJavaException != null) {
+ if (existingJavaException.getName().equals(exceptionName)) {
+ if
(((JAXBType)existingJavaException.getOwner()).getName().equals(jaxbStruct.getName())
+ || ModelerUtils.isEquivalentLiteralStructures(jaxbStruct,
(JAXBStructuredType) existingJavaException.getOwner())) {
+ // we have mapped this fault already
+ if (faultType instanceof JAXBStructuredType) {
+ fault.getBlock().setType((JAXBType)
existingJavaException.getOwner());
+ }
+ fault.setJavaException(existingJavaException);
+ return false;
+ }
+ }
+ }
+
+ JavaException javaException = new JavaException(exceptionName, false,
jaxbStruct);
+ javaException.add(javaMember);
+ jaxbStruct.setJavaType(javaException);
+
+ _javaExceptions.put(javaException.getName(), javaException);
+
+ fault.setJavaException(javaException);
+ return true;
+ }
+
+ protected boolean isRequestResponse(){
+ return info.portTypeOperation.getStyle() == OperationStyle.REQUEST_RESPONSE;
+ }
+
+ protected java.util.List<String> getAsynParameterOrder(){
+ //for async operation ignore the parameterOrder
+ java.util.List<String> parameterList = new ArrayList<String>();
+ Message inputMessage = getInputMessage();
+ List<MessagePart> inputParts = inputMessage.getParts();
+ for(MessagePart part: inputParts){
+ parameterList.add(part.getName());
+ }
+ return parameterList;
+ }
+
+
+ protected List<MessagePart> getParameterOrder(){
+ List<MessagePart> params = new ArrayList<MessagePart>();
+ String parameterOrder = info.portTypeOperation.getParameterOrder();
+ java.util.List<String> parameterList = new ArrayList<String>();
+ boolean parameterOrderPresent = false;
+ if ((parameterOrder != null) &&
!(parameterOrder.trim().equals(""))) {
+ parameterList = XmlUtil.parseTokenList(parameterOrder);
+ parameterOrderPresent = true;
+ } else {
+ parameterList = new ArrayList<String>();
+ }
+ Message inputMessage = getInputMessage();
+ Message outputMessage = getOutputMessage();
+ List<MessagePart> outputParts = null;
+ List<MessagePart> inputParts = inputMessage.getParts();
+ //reset the mode and ret flag, as MEssagePArts aer shared across ports
+ for(MessagePart part:inputParts){
+ part.setMode(Mode.IN);
+ part.setReturn(false);
+ }
+ if(isRequestResponse()){
+ outputParts = outputMessage.getParts();
+ for(MessagePart part:outputParts){
+ part.setMode(Mode.OUT);
+ part.setReturn(false);
+ }
+ }
+
+ if(parameterOrderPresent){
+ boolean validParameterOrder = true;
+ Iterator<String> paramOrders = parameterList.iterator();
+ // If any part in the parameterOrder is not present in the request or
+ // response message, we completely ignore the parameterOrder hint
+ while(paramOrders.hasNext()){
+ String param = paramOrders.next();
+ boolean partFound = false;
+ for(MessagePart part : inputParts){
+ if(param.equals(part.getName())){
+ partFound = true;
+ break;
+ }
+ }
+ // if not found, check in output parts
+ if(!partFound){
+ for(MessagePart part : outputParts){
+ if(param.equals(part.getName())){
+ partFound = true;
+ break;
+ }
+ }
+ }
+ if(!partFound){
+ warn("wsdlmodeler.invalid.parameterorder.parameter",
+ new Object[] {param,
info.operation.getName().getLocalPart()});
+ validParameterOrder = false;
+ }
+ }
+
+ List<MessagePart> inputUnlistedParts = new
ArrayList<MessagePart>();
+ List<MessagePart> outputUnlistedParts = new
ArrayList<MessagePart>();
+
+ //gather input Parts
+ if(validParameterOrder){
+ for(String param:parameterList){
+ MessagePart part = inputMessage.getPart(param);
+ if(part != null){
+ params.add(part);
+ continue;
+ }
+ if(isRequestResponse()){
+ MessagePart outPart = outputMessage.getPart(param);
+ if(outPart != null){
+ params.add(outPart);
+ continue;
+ }
+ }
+ }
+
+ for(MessagePart part: inputParts){
+ if(!parameterList.contains(part.getName())) {
+ inputUnlistedParts.add(part);
+ }
+ }
+
+ if(isRequestResponse()){
+ // at most one output part should be unlisted
+ for(MessagePart part: outputParts){
+ if(!parameterList.contains(part.getName())) {
+ MessagePart inPart = inputMessage.getPart(part.getName());
+ //dont add inout as unlisted part
+ if((inPart != null) &&
inPart.getDescriptor().equals(part.getDescriptor())){
+ inPart.setMode(Mode.INOUT);
+ }else{
+ outputUnlistedParts.add(part);
+ }
+ }else{
+ //param list may contain it, check if its INOUT
+ MessagePart inPart = inputMessage.getPart(part.getName());
+ //dont add inout as unlisted part
+ if((inPart != null) &&
inPart.getDescriptor().equals(part.getDescriptor())){
+ inPart.setMode(Mode.INOUT);
+ }else if(!params.contains(part)){
+ params.add(part);
+ }
+ }
+ }
+ if(outputUnlistedParts.size() == 1){
+ MessagePart resultPart = outputUnlistedParts.get(0);
+ resultPart.setReturn(true);
+ params.add(resultPart);
+ outputUnlistedParts.clear();
+ }
+ }
+
+ //add the input and output unlisted parts
+ for(MessagePart part : inputUnlistedParts){
+ params.add(part);
+ }
+
+ for(MessagePart part : outputUnlistedParts){
+ params.add(part);
+ }
+ return params;
+
+ }
+ //parameterOrder attribute is not valid, we ignore it
+ warn("wsdlmodeler.invalid.parameterOrder.invalidParameterOrder",
+ new Object[] {info.operation.getName().getLocalPart()});
+ parameterOrderPresent = false;
+ parameterList.clear();
+ }
+
+ List<MessagePart> outParts = new ArrayList<MessagePart>();
+
+ //construct input parameter list with the same order as in input message
+ for(MessagePart part: inputParts){
+ params.add(part);
+ }
+
+ if(isRequestResponse()){
+ for(MessagePart part:outputParts){
+ MessagePart inPart = inputMessage.getPart(part.getName());
+ if(inPart != null && part.getDescriptorKind() ==
inPart.getDescriptorKind() &&
+ part.getDescriptor().equals(inPart.getDescriptor())){
+ inPart.setMode(Mode.INOUT);
+ continue;
+ }
+ outParts.add(part);
+ }
+
+ //append the out parts to the parameterList
+ for(MessagePart part : outParts){
+ if(outParts.size() == 1)
+ part.setReturn(true);
+ params.add(part);
+ }
+ }
+ return params;
+ }
+
+ /**
+ *
+ * @param port
+ * @param suffix
+ * @return the Java ClassName for a port
+ */
+ protected String getClassName(Port port, String suffix) {
+ String name = "";
+ String javaPackageName = "";
+ if (_modelInfo.getJavaPackageName() != null
+ && !_modelInfo.getJavaPackageName().equals("")) {
+ javaPackageName = _modelInfo.getJavaPackageName();
+ }
+ String prefix =
getEnvironment().getNames().validJavaClassName(port.getName().getLocalPart());
+ name = javaPackageName+"."+prefix+suffix;
+ return name;
+ }
+
+ protected boolean isConflictingServiceClassName(String name) {
+ if(conflictsWithSEIClass(name) || conflictsWithJAXBClass(name)
||conflictsWithExceptionClass(name)){
+ return true;
+ }
+ return false;
+ }
+
+ private boolean conflictsWithSEIClass(String name){
+ Set<String> seiNames = classNameCollector.getSeiClassNames();
+ if(seiNames != null && seiNames.contains(name))
+ return true;
+ return false;
+ }
+
+ private boolean conflictsWithJAXBClass(String name){
+ Set<String> jaxbNames = classNameCollector.getJaxbGeneratedClassNames();
+ if(jaxbNames != null && jaxbNames.contains(name))
+ return true;
+ return false;
+ }
+
+ private boolean conflictsWithExceptionClass(String name){
+ Set<String> exceptionNames = classNameCollector.getExceptionClassNames();
+ if(exceptionNames != null && exceptionNames.contains(name))
+ return true;
+ return false;
+ }
+
+ protected boolean isConflictingExceptionClassName(String name) {
+ if(conflictsWithSEIClass(name) || conflictsWithJAXBClass(name)){
+ return true;
+ }
+ return false;
+ }
+
+ protected JAXBModelBuilder getJAXBModelBuilder() {
+ return jaxbModelBuilder;
+ }
+
+ protected boolean validateWSDLBindingStyle(Binding binding) {
+ boolean mixedStyle = false;
+ SOAPBinding soapBinding =
+ (SOAPBinding)getExtensionOfType(binding, SOAPBinding.class);
+
+ //dont process the binding
+ if(soapBinding == null)
+ soapBinding =
+ (SOAPBinding)getExtensionOfType(binding, SOAP12Binding.class);
+ if(soapBinding == null)
+ return false;
+
+ //if soapbind:binding has no style attribute, the default is DOCUMENT
+ if(soapBinding.getStyle() == null)
+ soapBinding.setStyle(SOAPStyle.DOCUMENT);
+
+ SOAPStyle opStyle = soapBinding.getStyle();
+ for (Iterator iter = binding.operations(); iter.hasNext();) {
+ BindingOperation bindingOperation =
+ (BindingOperation)iter.next();
+ SOAPOperation soapOperation =
+ (SOAPOperation) getExtensionOfType(bindingOperation,
+ SOAPOperation.class);
+ if(soapOperation != null){
+ SOAPStyle currOpStyle = (soapOperation.getStyle() !=
null)?soapOperation.getStyle():soapBinding.getStyle();
+ //dont check for the first operation
+ if(!currOpStyle.equals(opStyle))
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * @param port
+ */
+ private void applyWrapperStyleCustomization(Port port, PortType portType) {
+ JAXWSBinding jaxwsBinding = (JAXWSBinding)getExtensionOfType(portType,
JAXWSBinding.class);
+ Boolean wrapperStyle = (jaxwsBinding !=
null)?jaxwsBinding.isEnableWrapperStyle():null;
+ if(wrapperStyle != null){
+ port.setWrapped(wrapperStyle);
+ }
+ }
+
+ protected static void setDocumentationIfPresent(
+ ModelObject obj,
+ Documentation documentation) {
+ if (documentation != null && documentation.getContent() != null) {
+ obj.setJavaDoc(documentation.getContent());
+ }
+ }
+
+ protected String getJavaNameForOperation(Operation operation) {
+ String name = operation.getJavaMethodName();
+ if(getEnvironment().getNames().isJavaReservedWord(name)){
+ name = "_"+name;
+ }
+ return name;
+ }
+
+ protected void fail(String key, String arg){
+ throw new ModelerException(key, arg);
+ }
+ protected void fail(String key, Object[] args){
+ throw new ModelerException(key, args);
+ }
+}
\ No newline at end of file
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/wsdl/WSDLModeler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/wsdl/WSDLModelerBase.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/wsdl/WSDLModelerBase.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/wsdl/WSDLModelerBase.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,1084 @@
+
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.modeler.wsdl;
+
+
+import org.jboss.com.sun.tools.ws.processor.config.WSDLModelInfo;
+import org.jboss.com.sun.tools.ws.processor.generator.Names;
+import org.jboss.com.sun.tools.ws.processor.model.AbstractType;
+import org.jboss.com.sun.tools.ws.processor.model.Block;
+import org.jboss.com.sun.tools.ws.processor.model.Fault;
+import org.jboss.com.sun.tools.ws.processor.model.Model;
+import org.jboss.com.sun.tools.ws.processor.model.ModelObject;
+import org.jboss.com.sun.tools.ws.processor.model.ModelProperties;
+import org.jboss.com.sun.tools.ws.processor.model.Operation;
+import org.jboss.com.sun.tools.ws.processor.model.Parameter;
+import org.jboss.com.sun.tools.ws.processor.model.Port;
+import org.jboss.com.sun.tools.ws.processor.modeler.JavaSimpleTypeCreator;
+import org.jboss.com.sun.tools.ws.processor.modeler.Modeler;
+import org.jboss.com.sun.tools.ws.processor.modeler.ModelerException;
+import org.jboss.com.sun.tools.ws.processor.util.ProcessorEnvironment;
+import org.jboss.com.sun.tools.ws.wsdl.document.Binding;
+import org.jboss.com.sun.tools.ws.wsdl.document.BindingFault;
+import org.jboss.com.sun.tools.ws.wsdl.document.BindingOperation;
+import org.jboss.com.sun.tools.ws.wsdl.document.Documentation;
+import org.jboss.com.sun.tools.ws.wsdl.document.Kinds;
+import org.jboss.com.sun.tools.ws.wsdl.document.Message;
+import org.jboss.com.sun.tools.ws.wsdl.document.MessagePart;
+import org.jboss.com.sun.tools.ws.wsdl.document.OperationStyle;
+import org.jboss.com.sun.tools.ws.wsdl.document.WSDLDocument;
+import org.jboss.com.sun.tools.ws.wsdl.document.jaxws.JAXWSBinding;
+import org.jboss.com.sun.tools.ws.wsdl.document.mime.MIMEContent;
+import org.jboss.com.sun.tools.ws.wsdl.document.mime.MIMEMultipartRelated;
+import org.jboss.com.sun.tools.ws.wsdl.document.mime.MIMEPart;
+import org.jboss.com.sun.tools.ws.wsdl.document.schema.SchemaKinds;
+import org.jboss.com.sun.tools.ws.wsdl.document.soap.SOAPBinding;
+import org.jboss.com.sun.tools.ws.wsdl.document.soap.SOAPBody;
+import org.jboss.com.sun.tools.ws.wsdl.document.soap.SOAPFault;
+import org.jboss.com.sun.tools.ws.wsdl.document.soap.SOAPHeader;
+import org.jboss.com.sun.tools.ws.wsdl.document.soap.SOAPOperation;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extensible;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extension;
+import org.jboss.com.sun.tools.ws.wsdl.framework.GloballyKnown;
+import org.jboss.com.sun.tools.ws.wsdl.framework.NoSuchEntityException;
+import org.jboss.com.sun.tools.ws.wsdl.parser.Constants;
+import org.jboss.com.sun.tools.ws.wsdl.parser.Util;
+import org.jboss.com.sun.tools.ws.wsdl.parser.WSDLParser;
+import org.jboss.com.sun.xml.ws.util.localization.Localizable;
+import org.jboss.com.sun.xml.ws.util.localization.LocalizableMessageFactory;
+import org.jboss.com.sun.xml.ws.util.xml.XmlUtil;
+import org.w3c.dom.Element;
+
+import javax.xml.namespace.QName;
+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.Properties;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+/**
+ *
+ * @author WS Development Team
+ *
+ * Base class for WSDL->Model classes.
+ */
+public abstract class WSDLModelerBase implements Modeler {
+ public WSDLModelerBase(WSDLModelInfo modelInfo, Properties options) {
+ //init();
+ _modelInfo = modelInfo;
+ _options = options;
+ _messageFactory =
+ new
LocalizableMessageFactory("org.jboss.com.sun.tools.ws.resources.modeler");
+ _conflictingClassNames = null;
+ _env = (ProcessorEnvironment)modelInfo.getParent().getEnvironment();
+ hSet = null;
+ reqResNames = new HashSet();
+ }
+
+
+ protected WSDLParser createWSDLParser(){
+ return new WSDLParser(_modelInfo);
+ }
+
+ /**
+ * Builds model from WSDL document. Model contains abstraction which is used by the
+ * generators to generate the stub/tie/serializers etc. code.
+ *
+ * @see Modeler#buildModel()
+ */
+ public Model buildModel() {
+ return null;
+ }
+
+ protected WSDLModelInfo getWSDLModelInfo(){
+ return _modelInfo;
+ }
+
+ protected Documentation getDocumentationFor(Element e) {
+ String s = XmlUtil.getTextForNode(e);
+ if (s == null) {
+ return null;
+ } else {
+ return new Documentation(s);
+ }
+ }
+
+ protected void checkNotWsdlElement(Element e) {
+ // possible extensibility element -- must live outside the WSDL namespace
+ if (e.getNamespaceURI().equals(Constants.NS_WSDL))
+ Util.fail("parsing.invalidWsdlElement", e.getTagName());
+ }
+
+ /**
+ * @param port
+ * @param wsdlPort
+ */
+ protected void applyPortMethodCustomization(Port port,
org.jboss.com.sun.tools.ws.wsdl.document.Port wsdlPort) {
+ if(isProvider(wsdlPort))
+ return;
+ JAXWSBinding jaxwsBinding = (JAXWSBinding)getExtensionOfType(wsdlPort,
JAXWSBinding.class);
+
+ String portMethodName = (jaxwsBinding != null)?((jaxwsBinding.getMethodName() !=
null)?jaxwsBinding.getMethodName().getName():null):null;
+ if(portMethodName != null){
+ port.setPortGetter(portMethodName);
+ }else{
+ portMethodName = Names.getPortName(port);
+ portMethodName =
getEnvironment().getNames().validJavaClassName(portMethodName);
+ port.setPortGetter("get"+portMethodName);
+ }
+
+ }
+
+ protected boolean isProvider(org.jboss.com.sun.tools.ws.wsdl.document.Port
wsdlPort){
+ JAXWSBinding portCustomization = (JAXWSBinding)getExtensionOfType(wsdlPort,
JAXWSBinding.class);
+ Boolean isProvider = (portCustomization !=
null)?portCustomization.isProvider():null;
+ if(isProvider != null){
+ return isProvider;
+ }
+
+ JAXWSBinding jaxwsGlobalCustomization =
(JAXWSBinding)getExtensionOfType(document.getDefinitions(), JAXWSBinding.class);
+ isProvider = (jaxwsGlobalCustomization !=
null)?jaxwsGlobalCustomization.isProvider():null;
+ if(isProvider != null)
+ return isProvider;
+ return false;
+ }
+
+ protected void createParentFault(Fault fault) {
+ AbstractType faultType = fault.getBlock().getType();
+ AbstractType parentType = null;
+
+
+ if (parentType == null) {
+ return;
+ }
+
+ if (fault.getParentFault() != null) {
+ return;
+ }
+ Fault parentFault =
+ new Fault(((AbstractType)parentType).getName().getLocalPart());
+ /* this is what it really should be but for interop with JAXRPC 1.0.1 we are not
doing
+ * this at this time.
+ *
+ * TODO - we should double-check this; the above statement might not be true
anymore.
+ */
+ QName faultQName =
+ new QName(
+ fault.getBlock().getName().getNamespaceURI(),
+ parentFault.getName());
+ Block block = new Block(faultQName);
+ block.setType((AbstractType)parentType);
+ parentFault.setBlock(block);
+ parentFault.addSubfault(fault);
+ createParentFault(parentFault);
+ }
+
+ protected void createSubfaults(Fault fault) {
+ AbstractType faultType = fault.getBlock().getType();
+ Iterator subtypes = null;
+ if (subtypes != null) {
+ AbstractType subtype;
+ while (subtypes.hasNext()) {
+ subtype = (AbstractType)subtypes.next();
+ Fault subFault = new Fault(subtype.getName().getLocalPart());
+ /* this is what it really is but for interop with JAXRPC 1.0.1 we are not
doing
+ * this at this time
+ *
+ * TODO - we should double-check this; the above statement might not be
true anymore.
+ */
+ QName faultQName =
+ new QName(
+ fault.getBlock().getName().getNamespaceURI(),
+ subFault.getName());
+ Block block = new Block(faultQName);
+ block.setType(subtype);
+ subFault.setBlock(block);
+ fault.addSubfault(subFault);
+ createSubfaults(subFault);
+ }
+ }
+ }
+
+ protected SOAPBody getSOAPRequestBody() {
+ SOAPBody requestBody =
+ (SOAPBody)getAnyExtensionOfType(info.bindingOperation.getInput(),
+ SOAPBody.class);
+ if (requestBody == null) {
+ // the WSDL document is invalid
+ throw new ModelerException(
+ "wsdlmodeler.invalid.bindingOperation.inputMissingSoapBody",
+ new Object[] { info.bindingOperation.getName()});
+ }
+ return requestBody;
+ }
+
+ protected boolean isRequestMimeMultipart() {
+ for (Iterator iter = info.bindingOperation.getInput().extensions();
iter.hasNext();) {
+ Extension extension = (Extension)iter.next();
+ if (extension.getClass().equals(MIMEMultipartRelated.class)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected boolean isResponseMimeMultipart() {
+ for (Iterator iter = info.bindingOperation.getOutput().extensions();
iter.hasNext();) {
+ Extension extension = (Extension)iter.next();
+ if (extension.getClass().equals(MIMEMultipartRelated.class)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+
+
+ protected SOAPBody getSOAPResponseBody() {
+ SOAPBody responseBody =
+ (SOAPBody)getAnyExtensionOfType(info.bindingOperation.getOutput(),
+ SOAPBody.class);
+ if (responseBody == null) {
+ // the WSDL document is invalid
+ throw new ModelerException(
+ "wsdlmodeler.invalid.bindingOperation.outputMissingSoapBody",
+ new Object[] { info.bindingOperation.getName()});
+ }
+ return responseBody;
+ }
+
+ protected org.jboss.com.sun.tools.ws.wsdl.document.Message getOutputMessage() {
+ if (info.portTypeOperation.getOutput() == null)
+ return null;
+ return info.portTypeOperation.getOutput().resolveMessage(info.document);
+ }
+
+ protected org.jboss.com.sun.tools.ws.wsdl.document.Message getInputMessage() {
+ return info.portTypeOperation.getInput().resolveMessage(info.document);
+ }
+
+ /**
+ * @param body request or response body, represents soap:body
+ * @param message Input or output message, equivalent to wsdl:message
+ * @return iterator over MessagePart
+ */
+ protected List getMessageParts(
+ SOAPBody body,
+ org.jboss.com.sun.tools.ws.wsdl.document.Message message, boolean isInput) {
+ String bodyParts = body.getParts();
+ ArrayList partsList = new ArrayList();
+ List parts = new ArrayList();
+
+ //get Mime parts
+ List mimeParts = null;
+ if(isInput)
+ mimeParts = getMimeContentParts(message, info.bindingOperation.getInput());
+ else
+ mimeParts = getMimeContentParts(message, info.bindingOperation.getOutput());
+
+ if (bodyParts != null) {
+ StringTokenizer in = new StringTokenizer(bodyParts.trim(), " ");
+ while (in.hasMoreTokens()) {
+ String part = in.nextToken();
+ MessagePart mPart = (MessagePart)message.getPart(part);
+ if (null == mPart) {
+ throw new ModelerException(
+ "wsdlmodeler.error.partsNotFound",
+ new Object[] { part, message.getName()});
+ }
+ mPart.setBindingExtensibilityElementKind(MessagePart.SOAP_BODY_BINDING);
+ partsList.add(mPart);
+ }
+ } else {
+ for(Iterator iter = message.parts();iter.hasNext();) {
+ MessagePart mPart = (MessagePart)iter.next();
+ if(!mimeParts.contains(mPart))
+
mPart.setBindingExtensibilityElementKind(MessagePart.SOAP_BODY_BINDING);
+ partsList.add(mPart);
+ }
+ }
+
+ for(Iterator iter = message.parts();iter.hasNext();) {
+ MessagePart mPart = (MessagePart)iter.next();
+ if(mimeParts.contains(mPart)) {
+ mPart.setBindingExtensibilityElementKind(MessagePart.WSDL_MIME_BINDING);
+ parts.add(mPart);
+ }else if(partsList.contains(mPart)) {
+ mPart.setBindingExtensibilityElementKind(MessagePart.SOAP_BODY_BINDING);
+ parts.add(mPart);
+ }
+ }
+
+ return parts;
+ }
+
+ /**
+ * @param message
+ * @return MessageParts referenced by the mime:content
+ */
+ protected List getMimeContentParts(Message message, Extensible ext) {
+ ArrayList mimeContentParts = new ArrayList();
+ String mimeContentPartName = null;
+ Iterator mimeParts = getMimeParts(ext);
+
+ while(mimeParts.hasNext()) {
+ MessagePart part = getMimeContentPart(message, (MIMEPart)mimeParts.next());
+ if(part != null)
+ mimeContentParts.add(part);
+ }
+ return mimeContentParts;
+ }
+
+ /**
+ * @param mimeParts
+ */
+ protected boolean validateMimeParts(Iterator mimeParts) {
+ boolean gotRootPart = false;
+ List mimeContents = new ArrayList();
+ while(mimeParts.hasNext()) {
+ MIMEPart mPart = (MIMEPart)mimeParts.next();
+ Iterator extns = mPart.extensions();
+ while(extns.hasNext()){
+ Object obj = extns.next();
+ if(obj instanceof SOAPBody){
+ if(gotRootPart) {
+ //bug fix: 5024020
+
warn("mimemodeler.invalidMimePart.moreThanOneSOAPBody",
+ new Object[] {info.operation.getName().getLocalPart()});
+ return false;
+ }
+ gotRootPart = true;
+ }else if (obj instanceof MIMEContent) {
+ mimeContents.add((MIMEContent)obj);
+ }
+ }
+ if(!validateMimeContentPartNames(mimeContents.iterator()))
+ return false;
+ if(mPart.getName() != null) {
+ //bug fix: 5024018
+ warn("mimemodeler.invalidMimePart.nameNotAllowed",
+ info.portTypeOperation.getName());
+ }
+ }
+ return true;
+
+ }
+
+ private MessagePart getMimeContentPart(Message message, MIMEPart part) {
+ String mimeContentPartName = null;
+ Iterator mimeContents = getMimeContents(part).iterator();
+ if(mimeContents.hasNext()) {
+ mimeContentPartName = ((MIMEContent)mimeContents.next()).getPart();
+ MessagePart mPart = (MessagePart)message.getPart(mimeContentPartName);
+ //RXXXX mime:content MUST have part attribute
+ if(null == mPart) {
+ throw new ModelerException("wsdlmodeler.error.partsNotFound",
+ new Object[] {mimeContentPartName, message.getName()});
+ }
+ mPart.setBindingExtensibilityElementKind(MessagePart.WSDL_MIME_BINDING);
+ return mPart;
+ }
+ return null;
+ }
+
+ //List of mimeTypes
+ protected List<String> getAlternateMimeTypes(List<MIMEContent>
mimeContents) {
+ List<String> mimeTypes = new ArrayList<String>();
+ //validateMimeContentPartNames(mimeContents.iterator());
+// String mimeType = null;
+ for(MIMEContent mimeContent:mimeContents){
+ String mimeType = getMimeContentType(mimeContent);
+ if(!mimeTypes.contains(mimeType))
+ mimeTypes.add(mimeType);
+ }
+ return mimeTypes;
+ }
+
+ /**
+ * @param iterator
+ */
+ private boolean validateMimeContentPartNames(Iterator mimeContents) {
+ //validate mime:content(s) in the mime:part as per R2909
+ while(mimeContents.hasNext()){
+ String mimeContnetPart = null;
+ if(mimeContnetPart == null) {
+ mimeContnetPart =
getMimeContentPartName((MIMEContent)mimeContents.next());
+ if(mimeContnetPart == null) {
+
warn("mimemodeler.invalidMimeContent.missingPartAttribute",
+ new Object[] {info.operation.getName().getLocalPart()});
+ return false;
+ }
+ }else {
+ String newMimeContnetPart =
getMimeContentPartName((MIMEContent)mimeContents.next());
+ if(newMimeContnetPart == null) {
+
warn("mimemodeler.invalidMimeContent.missingPartAttribute",
+ new Object[] {info.operation.getName().getLocalPart()});
+ return false;
+ }else if(!newMimeContnetPart.equals(mimeContnetPart)) {
+ //throw new
ModelerException("mimemodeler.invalidMimeContent.differentPart");
+ warn("mimemodeler.invalidMimeContent.differentPart");
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ protected Iterator<MIMEPart> getMimeParts(Extensible ext) {
+ MIMEMultipartRelated multiPartRelated =
+ (MIMEMultipartRelated) getAnyExtensionOfType(ext,
+ MIMEMultipartRelated.class);
+ if(multiPartRelated == null) {
+ List<MIMEPart> parts = new ArrayList<MIMEPart>();
+ return parts.iterator();
+ }
+ return multiPartRelated.getParts();
+ }
+
+ //returns MIMEContents
+ protected List<MIMEContent> getMimeContents(MIMEPart part) {
+ List<MIMEContent> mimeContents = new ArrayList<MIMEContent>();
+ Iterator parts = part.extensions();
+ while(parts.hasNext()) {
+ Extension mimeContent = (Extension) parts.next();
+ if (mimeContent instanceof MIMEContent) {
+ mimeContents.add((MIMEContent)mimeContent);
+ }
+ }
+ //validateMimeContentPartNames(mimeContents.iterator());
+ return mimeContents;
+ }
+
+ private String getMimeContentPartName(MIMEContent mimeContent){
+ /*String partName = mimeContent.getPart();
+ if(partName == null){
+ throw new
ModelerException("mimemodeler.invalidMimeContent.missingPartAttribute",
+ new Object[] {info.operation.getName().getLocalPart()});
+ }
+ return partName;*/
+ return mimeContent.getPart();
+ }
+
+ private String getMimeContentType(MIMEContent mimeContent){
+ String mimeType = mimeContent.getType();
+ if(mimeType == null){
+ throw new
ModelerException("mimemodeler.invalidMimeContent.missingTypeAttribute",
+ new Object[] {info.operation.getName().getLocalPart()});
+ }
+ return mimeType;
+ }
+
+ /**
+ * For Document/Lit the wsdl:part should only have element attribute and
+ * for RPC/Lit or RPC/Encoded the wsdl:part should only have type attribute
+ * inside wsdl:message.
+ */
+ protected boolean isStyleAndPartMatch(
+ SOAPOperation soapOperation,
+ MessagePart part) {
+
+ // style attribute on soap:operation takes precedence over the
+ // style attribute on soap:binding
+
+ if ((soapOperation != null) && (soapOperation.getStyle() != null)) {
+ if ((soapOperation.isDocument()
+ && (part.getDescriptorKind() != SchemaKinds.XSD_ELEMENT))
+ || (soapOperation.isRPC()
+ && (part.getDescriptorKind() != SchemaKinds.XSD_TYPE))) {
+ return false;
+ }
+ } else {
+ if ((info.soapBinding.isDocument()
+ && (part.getDescriptorKind() != SchemaKinds.XSD_ELEMENT))
+ || (info.soapBinding.isRPC()
+ && (part.getDescriptorKind() != SchemaKinds.XSD_TYPE))) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+
+
+ protected String getRequestNamespaceURI(SOAPBody body) {
+ String namespaceURI = body.getNamespace();
+ if (namespaceURI == null) {
+ // the WSDL document is invalid
+ // at least, that's my interpretation of section 3.5 of the WSDL 1.1
spec!
+ throw new ModelerException(
+
"wsdlmodeler.invalid.bindingOperation.inputSoapBody.missingNamespace",
+ new Object[] { info.bindingOperation.getName()});
+ }
+ return namespaceURI;
+ }
+
+ protected String getResponseNamespaceURI(SOAPBody body) {
+ String namespaceURI = body.getNamespace();
+ if (namespaceURI == null) {
+ // the WSDL document is invalid
+ // at least, that's my interpretation of section 3.5 of the WSDL 1.1
spec!
+ throw new ModelerException(
+
"wsdlmodeler.invalid.bindingOperation.outputSoapBody.missingNamespace",
+ new Object[] { info.bindingOperation.getName()});
+ }
+ return namespaceURI;
+ }
+
+ /**
+ * @return List of SOAPHeader extensions
+ */
+ protected List<SOAPHeader> getHeaderExtensions(Extensible extensible) {
+ List<SOAPHeader> headerList = new ArrayList<SOAPHeader>();
+ Iterator bindingIter = extensible.extensions();
+ while (bindingIter.hasNext()) {
+ Extension extension = (Extension) bindingIter.next();
+ if (extension.getClass().equals(MIMEMultipartRelated.class)) {
+ for (Iterator parts = ((MIMEMultipartRelated) extension).getParts();
+ parts.hasNext();) {
+ Extension part = (Extension) parts.next();
+ if (part.getClass().equals(MIMEPart.class)) {
+ boolean isRootPart = isRootPart((MIMEPart)part);
+ Iterator iter = ((MIMEPart)part).extensions();
+ while(iter.hasNext()) {
+ Object obj = iter.next();
+ if(obj instanceof SOAPHeader){
+ //bug fix: 5024015
+ if(!isRootPart) {
+ warn(
+
"mimemodeler.warning.IgnoringinvalidHeaderPart.notDeclaredInRootPart",
+ new Object[] {
+ info.bindingOperation.getName()});
+ return new ArrayList<SOAPHeader>();
+ }
+ headerList.add((SOAPHeader)obj);
+ }
+ }
+ }
+
+ }
+ }else if(extension instanceof SOAPHeader) {
+ headerList.add((SOAPHeader)extension);
+ }
+ }
+ return headerList;
+ }
+
+ /**
+ * @param part
+ * @return true if part is the Root part
+ */
+ private boolean isRootPart(MIMEPart part) {
+ Iterator iter = part.extensions();
+ while(iter.hasNext()){
+ if(iter.next() instanceof SOAPBody)
+ return true;
+ }
+ return false;
+ }
+
+ protected Set getDuplicateFaultNames() {
+ // look for fault messages with the same soap:fault name
+ Set faultNames = new HashSet();
+ Set duplicateNames = new HashSet();
+ for (Iterator iter = info.bindingOperation.faults(); iter.hasNext();) {
+ BindingFault bindingFault = (BindingFault)iter.next();
+ org.jboss.com.sun.tools.ws.wsdl.document.Fault portTypeFault = null;
+ for (Iterator iter2 = info.portTypeOperation.faults();
+ iter2.hasNext();
+ ) {
+ org.jboss.com.sun.tools.ws.wsdl.document.Fault aFault =
+ (org.jboss.com.sun.tools.ws.wsdl.document.Fault)iter2.next();
+
+ if (aFault.getName().equals(bindingFault.getName())) {
+ if (portTypeFault != null) {
+ // the WSDL document is invalid
+ throw new ModelerException(
+ "wsdlmodeler.invalid.bindingFault.notUnique",
+ new Object[] {
+ bindingFault.getName(),
+ info.bindingOperation.getName()});
+ } else {
+ portTypeFault = aFault;
+ }
+ }
+ }
+ if (portTypeFault == null) {
+ // the WSDL document is invalid
+ throw new ModelerException(
+ "wsdlmodeler.invalid.bindingFault.notFound",
+ new Object[] {
+ bindingFault.getName(),
+ info.bindingOperation.getName()});
+
+ }
+ SOAPFault soapFault =
+ (SOAPFault)getExtensionOfType(bindingFault, SOAPFault.class);
+ if (soapFault == null) {
+ // the WSDL document is invalid
+ throw new ModelerException(
+ "wsdlmodeler.invalid.bindingFault.outputMissingSoapFault",
+ new Object[] {
+ bindingFault.getName(),
+ info.bindingOperation.getName()});
+ }
+
+ org.jboss.com.sun.tools.ws.wsdl.document.Message faultMessage =
+ portTypeFault.resolveMessage(info.document);
+ Iterator iter2 = faultMessage.parts();
+ if (!iter2.hasNext()) {
+ // the WSDL document is invalid
+ throw new ModelerException(
+ "wsdlmodeler.invalid.bindingFault.emptyMessage",
+ new Object[] {
+ bindingFault.getName(),
+ faultMessage.getName()});
+ }
+ // bug fix: 4852729
+ if (useWSIBasicProfile && (soapFault.getNamespace() != null)) {
+ warn(
+ "wsdlmodeler.warning.r2716r2726",
+ new Object[] { "soapbind:fault", soapFault.getName()});
+ }
+ String faultNamespaceURI = soapFault.getNamespace();
+ if (faultNamespaceURI == null) {
+ faultNamespaceURI =
+ portTypeFault.getMessage().getNamespaceURI();
+ }
+ String faultName = faultMessage.getName();
+ QName faultQName = new QName(faultNamespaceURI, faultName);
+ if (faultNames.contains(faultQName)) {
+ duplicateNames.add(faultQName);
+ } else {
+ faultNames.add(faultQName);
+ }
+ }
+ return duplicateNames;
+ }
+
+
+ /**
+ * @param operation
+ * @return true if operation has valid body parts
+ */
+ protected boolean validateBodyParts(BindingOperation operation) {
+ boolean isRequestResponse =
+ info.portTypeOperation.getStyle()
+ == OperationStyle.REQUEST_RESPONSE;
+ List inputParts = getMessageParts(getSOAPRequestBody(), getInputMessage(),
true);
+ if(!validateStyleAndPart(operation, inputParts))
+ return false;
+
+ if(isRequestResponse){
+ List outputParts = getMessageParts(getSOAPResponseBody(), getOutputMessage(),
false);
+ if(!validateStyleAndPart(operation, outputParts))
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * @param operation
+ * @return true if operation has valid style and part
+ */
+ private boolean validateStyleAndPart(BindingOperation operation, List parts) {
+ SOAPOperation soapOperation =
+ (SOAPOperation) getExtensionOfType(operation, SOAPOperation.class);
+ for(Iterator iter = parts.iterator(); iter.hasNext();){
+ MessagePart part = (MessagePart)iter.next();
+ if(part.getBindingExtensibilityElementKind() ==
MessagePart.SOAP_BODY_BINDING){
+ if(!isStyleAndPartMatch(soapOperation, part))
+ return false;
+ }
+ }
+ return true;
+ }
+
+ protected String getLiteralJavaMemberName(Fault fault) {
+ String javaMemberName;
+
+ QName memberName = fault.getElementName();
+ javaMemberName = fault.getJavaMemberName();
+ if (javaMemberName == null)
+ javaMemberName = memberName.getLocalPart();
+ return javaMemberName;
+ }
+
+ /**
+ * @param ext
+ * @param message
+ * @param name
+ * @return List of MimeContents from ext
+ */
+ protected List<MIMEContent> getMimeContents(Extensible ext, Message message,
String name) {
+ Iterator mimeParts = getMimeParts(ext);
+ while(mimeParts.hasNext()){
+ MIMEPart mimePart = (MIMEPart)mimeParts.next();
+ List<MIMEContent> mimeContents = getMimeContents(mimePart);
+ for(MIMEContent mimeContent:mimeContents){
+ if(mimeContent.getPart().equals(name))
+ return mimeContents;
+ }
+ }
+ return null;
+ }
+
+ protected ProcessorEnvironment getEnvironment() {
+ return _env;
+ }
+
+ protected void warn(Localizable msg) {
+ getEnvironment().warn(msg);
+ }
+
+ protected void warn(String key) {
+ getEnvironment().warn(_messageFactory.getMessage(key));
+ }
+
+ protected void warn(String key, String arg) {
+ getEnvironment().warn(_messageFactory.getMessage(key, arg));
+ }
+
+ protected void error(String key, String arg) {
+ getEnvironment().error(_messageFactory.getMessage(key, arg));
+ }
+
+ protected void warn(String key, Object[] args) {
+ getEnvironment().warn(_messageFactory.getMessage(key, args));
+ }
+
+ protected void info(String key) {
+ getEnvironment().info(_messageFactory.getMessage(key));
+ }
+
+ protected void info(String key, String arg) {
+ getEnvironment().info(_messageFactory.getMessage(key, arg));
+ }
+
+ protected String makePackageQualified(String s, QName name) {
+ return makePackageQualified(s, name, true);
+ }
+
+ protected String makePackageQualified(
+ String s,
+ QName name,
+ boolean useNamespaceMapping) {
+ String javaPackageName = null;
+ if (useNamespaceMapping) {
+ javaPackageName = getJavaPackageName(name);
+ }
+ if (javaPackageName != null) {
+ return javaPackageName + "." + s;
+ } else if (
+ _modelInfo.getJavaPackageName() != null
+ && !_modelInfo.getJavaPackageName().equals("")) {
+ return _modelInfo.getJavaPackageName() + "." + s;
+ } else {
+ return s;
+ }
+ }
+
+ protected QName makePackageQualified(QName name) {
+ return makePackageQualified(name, true);
+ }
+
+ protected QName makePackageQualified(
+ QName name,
+ boolean useNamespaceMapping) {
+ return new QName(
+ name.getNamespaceURI(),
+ makePackageQualified(name.getLocalPart(), name));
+ }
+
+ protected String makeNameUniqueInSet(String candidateName, Set names) {
+ String baseName = candidateName;
+ String name = baseName;
+ for (int i = 2; names.contains(name); ++i) {
+ name = baseName + Integer.toString(i);
+ }
+ return name;
+ }
+
+ protected String getUniqueName(
+ org.jboss.com.sun.tools.ws.wsdl.document.Operation operation,
+ boolean hasOverloadedOperations) {
+ if (hasOverloadedOperations) {
+ return operation.getUniqueKey().replace(' ', '_');
+ } else {
+ return operation.getName();
+ }
+ }
+
+ protected String getUniqueParameterName(
+ Operation operation,
+ String baseName) {
+ Set names = new HashSet();
+ for (Iterator iter = operation.getRequest().getParameters();
+ iter.hasNext();
+ ) {
+ Parameter p = (Parameter)iter.next();
+ names.add(p.getName());
+ }
+ for (Iterator iter = operation.getResponse().getParameters();
+ iter.hasNext();
+ ) {
+ Parameter p = (Parameter)iter.next();
+ names.add(p.getName());
+ }
+ String candidateName = baseName;
+ while (names.contains(candidateName)) {
+ candidateName += "_prime";
+ }
+ return candidateName;
+ }
+
+ protected String getNonQualifiedNameFor(QName name) {
+ return _env.getNames().validJavaClassName(name.getLocalPart());
+ }
+
+ protected static void setDocumentationIfPresent(
+ ModelObject obj,
+ Documentation documentation) {
+ if (documentation != null && documentation.getContent() != null) {
+ obj.setProperty(WSDL_DOCUMENTATION, documentation.getContent());
+ }
+ }
+
+ protected static QName getQNameOf(GloballyKnown entity) {
+ return new QName(
+ entity.getDefining().getTargetNamespaceURI(),
+ entity.getName());
+ }
+
+ protected static Extension getExtensionOfType(
+ Extensible extensible,
+ Class type) {
+ for (Iterator iter = extensible.extensions(); iter.hasNext();) {
+ Extension extension = (Extension)iter.next();
+ if (extension.getClass().equals(type)) {
+ return extension;
+ }
+ }
+
+ return null;
+ }
+
+ protected Extension getAnyExtensionOfType(
+ Extensible extensible,
+ Class type) {
+ if(extensible == null)
+ return null;
+ for (Iterator iter = extensible.extensions(); iter.hasNext();) {
+ Extension extension = (Extension)iter.next();
+ if(extension.getClass().equals(type)) {
+ return extension;
+ }else if (extension.getClass().equals(MIMEMultipartRelated.class) &&
+ (type.equals(SOAPBody.class) || type.equals(MIMEContent.class)
+ || type.equals(MIMEPart.class))) {
+ for (Iterator parts =
+ ((MIMEMultipartRelated) extension).getParts();
+ parts.hasNext();
+ ) {
+ Extension part = (Extension) parts.next();
+ if (part.getClass().equals(MIMEPart.class)) {
+ MIMEPart mPart = (MIMEPart)part;
+ //bug fix: 5024001
+ Extension extn = getExtensionOfType((Extensible) part, type);
+ if(extn != null)
+ return extn;
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
+ // bug fix: 4857100
+ protected static org.jboss.com.sun.tools.ws.wsdl.document.Message findMessage(
+ QName messageName,
+ ProcessSOAPOperationInfo info) {
+ org.jboss.com.sun.tools.ws.wsdl.document.Message message = null;
+ try {
+ message =
+ (org.jboss.com.sun.tools.ws.wsdl.document.Message)info.document.find(
+ Kinds.MESSAGE,
+ messageName);
+ } catch (NoSuchEntityException e) {
+ }
+ return message;
+ }
+
+ protected static boolean tokenListContains(
+ String tokenList,
+ String target) {
+ if (tokenList == null) {
+ return false;
+ }
+
+ StringTokenizer tokenizer = new StringTokenizer(tokenList, " ");
+ while (tokenizer.hasMoreTokens()) {
+ String s = tokenizer.nextToken();
+ if (target.equals(s)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected String getUniqueClassName(String className) {
+ int cnt = 2;
+ String uniqueName = className;
+ while (reqResNames.contains(uniqueName.toLowerCase())) {
+ uniqueName = className + cnt;
+ cnt++;
+ }
+ reqResNames.add(uniqueName.toLowerCase());
+ return uniqueName;
+ }
+
+ private String getJavaPackageName(QName name) {
+ String packageName = null;
+/* if (_modelInfo.getNamespaceMappingRegistry() != null) {
+ NamespaceMappingInfo i =
+ _modelInfo
+ .getNamespaceMappingRegistry()
+ .getNamespaceMappingInfo(
+ name);
+ if (i != null)
+ return i.getJavaPackageName();
+ }*/
+ return packageName;
+ }
+
+ protected boolean isConflictingClassName(String name) {
+ if (_conflictingClassNames == null) {
+ return false;
+ }
+
+ return _conflictingClassNames.contains(name);
+ }
+
+ protected boolean isConflictingServiceClassName(String name) {
+ return isConflictingClassName(name);
+ }
+
+ protected boolean isConflictingStubClassName(String name) {
+ return isConflictingClassName(name);
+ }
+
+ protected boolean isConflictingTieClassName(String name) {
+ return isConflictingClassName(name);
+ }
+
+ protected boolean isConflictingPortClassName(String name) {
+ return isConflictingClassName(name);
+ }
+
+ protected boolean isConflictingExceptionClassName(String name) {
+ return isConflictingClassName(name);
+ }
+
+ protected static final String OPERATION_HAS_VOID_RETURN_TYPE =
+
"org.jboss.com.sun.xml.ws.processor.modeler.wsdl.operationHasVoidReturnType";
+ private static final String WSDL_DOCUMENTATION =
+ "org.jboss.com.sun.xml.ws.processor.modeler.wsdl.documentation";
+ protected static final String WSDL_PARAMETER_ORDER =
+ "org.jboss.com.sun.xml.ws.processor.modeler.wsdl.parameterOrder";
+ public static final String WSDL_RESULT_PARAMETER =
+ "org.jboss.com.sun.xml.ws.processor.modeler.wsdl.resultParameter";
+ public static final String MESSAGE_HAS_MIME_MULTIPART_RELATED_BINDING =
+
"org.jboss.com.sun.xml.ws.processor.modeler.wsdl.mimeMultipartRelatedBinding";
+
+
+ public ProcessorEnvironment getProcessorEnvironment(){
+ return _env;
+ }
+ protected ProcessSOAPOperationInfo info;
+
+ protected WSDLModelInfo _modelInfo;
+ protected Properties _options;
+ protected LocalizableMessageFactory _messageFactory;
+ private Set _conflictingClassNames;
+ protected Map _javaExceptions;
+ protected Map _faultTypeToStructureMap;
+ private ProcessorEnvironment _env;
+ protected JavaSimpleTypeCreator _javaTypes;
+ protected Map<QName, Port> _bindingNameToPortMap;
+ protected boolean useWSIBasicProfile = true;
+
+ private Set reqResNames;
+ public class ProcessSOAPOperationInfo {
+
+ public ProcessSOAPOperationInfo(
+ Port modelPort,
+ org.jboss.com.sun.tools.ws.wsdl.document.Port port,
+ org.jboss.com.sun.tools.ws.wsdl.document.Operation portTypeOperation,
+ BindingOperation bindingOperation,
+ SOAPBinding soapBinding,
+ WSDLDocument document,
+ boolean hasOverloadedOperations,
+ Map headers) {
+ this.modelPort = modelPort;
+ this.port = port;
+ this.portTypeOperation = portTypeOperation;
+ this.bindingOperation = bindingOperation;
+ this.soapBinding = soapBinding;
+ this.document = document;
+ this.hasOverloadedOperations = hasOverloadedOperations;
+ this.headers = headers;
+ }
+
+ public Port modelPort;
+ public org.jboss.com.sun.tools.ws.wsdl.document.Port port;
+ public org.jboss.com.sun.tools.ws.wsdl.document.Operation portTypeOperation;
+ public BindingOperation bindingOperation;
+ public SOAPBinding soapBinding;
+ public WSDLDocument document;
+ public boolean hasOverloadedOperations;
+ public Map headers;
+
+ // additional data
+ public Operation operation;
+ public String uniqueOperationName;
+ }
+
+ public static class WSDLExceptionInfo {
+ public String exceptionType;
+ public QName wsdlMessage;
+ public String wsdlMessagePartName;
+ public HashMap constructorOrder; // mapping of element name to
+ // constructor order (of type Integer)
+ };
+
+
+ protected WSDLParser parser;
+ protected WSDLDocument document;
+ protected HashSet hSet;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/modeler/wsdl/WSDLModelerBase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/util/ClassNameCollector.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/util/ClassNameCollector.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/util/ClassNameCollector.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,269 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.util;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.processor.model.AbstractType;
+import org.jboss.com.sun.tools.ws.processor.model.Block;
+import org.jboss.com.sun.tools.ws.processor.model.ExtendedModelVisitor;
+import org.jboss.com.sun.tools.ws.processor.model.Fault;
+import org.jboss.com.sun.tools.ws.processor.model.Model;
+import org.jboss.com.sun.tools.ws.processor.model.ModelProperties;
+import org.jboss.com.sun.tools.ws.processor.model.Parameter;
+import org.jboss.com.sun.tools.ws.processor.model.Port;
+import org.jboss.com.sun.tools.ws.processor.model.Service;
+import org.jboss.com.sun.tools.ws.processor.model.java.JavaInterface;
+import org.jboss.com.sun.tools.ws.processor.model.jaxb.JAXBType;
+import org.jboss.com.sun.tools.ws.processor.model.jaxb.JAXBTypeVisitor;
+import org.jboss.com.sun.tools.ws.processor.model.jaxb.RpcLitStructure;
+import org.jboss.com.sun.xml.ws.util.VersionUtil;
+
+
+/**
+ * This class writes out a Model as an XML document.
+ *
+ * @author WS Development Team
+ */
+public class ClassNameCollector extends ExtendedModelVisitor
+ implements JAXBTypeVisitor {
+
+ public ClassNameCollector() {
+ }
+
+ public void process(Model model) {
+ try {
+ _allClassNames = new HashSet();
+ _exceptions = new HashSet();
+ _wsdlBindingNames = new HashSet();
+ _conflictingClassNames = new HashSet();
+ _seiClassNames = new HashSet<String>();
+ _jaxbGeneratedClassNames = new HashSet<String>();
+ _exceptionClassNames = new HashSet<String>();
+ _portTypeNames = new HashSet<QName>();
+ visit(model);
+ } catch (Exception e) {
+ e.printStackTrace();
+ // fail silently
+ } finally {
+ _allClassNames = null;
+ _exceptions = null;
+ }
+ }
+
+ public Set getConflictingClassNames() {
+ return _conflictingClassNames;
+ }
+
+ protected void postVisit(Model model) throws Exception {
+ for (Iterator iter = model.getExtraTypes(); iter.hasNext();) {
+ visitType((AbstractType)iter.next());
+ }
+ }
+
+ protected void preVisit(Service service) throws Exception {
+ registerClassName(
+ ((JavaInterface)service.getJavaInterface()).getName());
+ registerClassName(
+ ((JavaInterface)service.getJavaInterface()).getImpl());
+ }
+
+ protected void processPort11x(Port port){
+ QName wsdlBindingName = (QName) port.getProperty(
+ ModelProperties.PROPERTY_WSDL_BINDING_NAME);
+ if (!_wsdlBindingNames.contains(wsdlBindingName)) {
+
+ // multiple ports can share a binding without causing a conflict
+ registerClassName(port.getJavaInterface().getName());
+ }
+ registerClassName((String) port.getProperty(
+ ModelProperties.PROPERTY_STUB_CLASS_NAME));
+ registerClassName((String) port.getProperty(
+ ModelProperties.PROPERTY_TIE_CLASS_NAME));
+ }
+
+ protected void preVisit(Port port) throws Exception {
+ QName portTypeName =
(QName)port.getProperty(ModelProperties.PROPERTY_WSDL_PORT_TYPE_NAME);
+ if(_portTypeNames.contains(portTypeName))
+ return;
+
+ //in 2.0, stub/tie class are binding agnostic so they should be per port, that is
multiple
+ // bindings can share the same port
+
+ addSEIClassName(port.getJavaInterface().getName());
+ }
+
+ private void addSEIClassName(String s) {
+ _seiClassNames.add(s);
+ registerClassName(s);
+ }
+
+ protected void postVisit(Port port) throws Exception {
+ QName wsdlBindingName = (QName) port.getProperty(
+ ModelProperties.PROPERTY_WSDL_BINDING_NAME);
+ if (!_wsdlBindingNames.contains(wsdlBindingName)) {
+ _wsdlBindingNames.add(wsdlBindingName);
+ }
+
+ QName portTypeName =
(QName)port.getProperty(ModelProperties.PROPERTY_WSDL_PORT_TYPE_NAME);
+ if(!_portTypeNames.contains(portTypeName)){
+ _portTypeNames.add(portTypeName);
+ }
+ }
+
+ protected boolean shouldVisit(Port port) {
+ QName wsdlBindingName = (QName) port.getProperty(
+ ModelProperties.PROPERTY_WSDL_BINDING_NAME);
+ return !_wsdlBindingNames.contains(wsdlBindingName);
+ }
+
+ protected void preVisit(Fault fault) throws Exception {
+ if (!_exceptions.contains(fault.getJavaException())) {
+
+ /* the same exception can be used in several faults, but that
+ * doesn't mean that there is a conflict
+ */
+ _exceptions.add(fault.getJavaException());
+ addExceptionClassName(fault.getJavaException().getName());
+
+ if (fault.getParentFault() != null) {
+ preVisit(fault.getParentFault());
+ }
+ for (Iterator iter = fault.getSubfaults();
+ iter != null && iter.hasNext();) {
+
+ Fault subfault = (Fault) iter.next();
+ preVisit(subfault);
+ }
+ }
+ }
+
+ private void addExceptionClassName(String name) {
+ if(_allClassNames.contains(name))
+ _exceptionClassNames.add(name);
+ registerClassName(name);
+ //To change body of created methods use File | Settings | File Templates.
+ }
+
+ protected void visitBodyBlock(Block block) throws Exception {
+ visitBlock(block);
+ }
+
+ protected void visitHeaderBlock(Block block) throws Exception {
+ visitBlock(block);
+ }
+
+ protected void visitFaultBlock(Block block) throws Exception {
+ }
+
+ protected void visitBlock(Block block) throws Exception {
+ visitType(block.getType());
+ }
+
+ protected void visit(Parameter parameter) throws Exception {
+ visitType(parameter.getType());
+ }
+
+ private void visitType(AbstractType type) throws Exception {
+ if (type != null) {
+ if (type instanceof JAXBType)
+ visitType((JAXBType)type);
+ else if (type instanceof RpcLitStructure)
+ visitType((RpcLitStructure)type);
+ }
+ }
+
+
+ private void visitType(JAXBType type) throws Exception {
+ type.accept(this);
+ }
+
+ private void visitType(RpcLitStructure type) throws Exception {
+ type.accept(this);
+ }
+ private void registerClassName(String name) {
+ if (name == null || name.equals("")) {
+ return;
+ }
+ if (_allClassNames.contains(name)) {
+ _conflictingClassNames.add(name);
+ } else {
+ _allClassNames.add(name);
+ }
+ }
+
+ public Set<String> getSeiClassNames() {
+ return _seiClassNames;
+ }
+
+ private Set<String> _seiClassNames;
+
+ public Set<String> getJaxbGeneratedClassNames() {
+ return _jaxbGeneratedClassNames;
+ }
+
+ private Set<String> _jaxbGeneratedClassNames;
+
+
+ public Set<String> getExceptionClassNames() {
+ return _exceptionClassNames;
+ }
+
+ private Set<String> _exceptionClassNames;
+ boolean doneVisitingJAXBModel = false;
+ public void visit(JAXBType type) throws Exception {
+ if(!doneVisitingJAXBModel){
+ Set<String> classNames = type.getJaxbModel().getGeneratedClassNames();
+ for(String className : classNames){
+ addJAXBGeneratedClassName(className);
+ }
+ doneVisitingJAXBModel = true;
+ }
+ }
+
+ public void visit(RpcLitStructure type) throws Exception {
+ if(!doneVisitingJAXBModel){
+ Set<String> classNames = type.getJaxbModel().getGeneratedClassNames();
+ for(String className : classNames){
+ addJAXBGeneratedClassName(className);
+ }
+ doneVisitingJAXBModel = true;
+ }
+ }
+
+
+ private void addJAXBGeneratedClassName(String name) {
+ _jaxbGeneratedClassNames.add(name);
+ registerClassName(name);
+ }
+
+ private Set _allClassNames;
+ private Set _exceptions;
+ private Set _wsdlBindingNames;
+ private Set _conflictingClassNames;
+ private Set<QName> _portTypeNames;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/util/ClassNameCollector.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/util/ClientProcessorEnvironment.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/util/ClientProcessorEnvironment.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/util/ClientProcessorEnvironment.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,222 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.util;
+
+import java.io.File;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.jboss.com.sun.tools.ws.processor.ProcessorNotificationListener;
+import org.jboss.com.sun.tools.ws.processor.generator.Names;
+import org.jboss.com.sun.tools.ws.util.JAXWSClassFactory;
+import org.jboss.com.sun.xml.ws.util.localization.Localizable;
+
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class ClientProcessorEnvironment extends ProcessorEnvironmentBase
+ implements ProcessorEnvironment {
+
+ /**
+ * The stream where error message are printed.
+ */
+ private OutputStream out;
+
+ /**
+ * A printwriter created lazily in case there are exceptions to report.
+ */
+ private PrintStream outprintstream;
+
+ /**
+ * listener for error/warning/info notifications
+ */
+ private ProcessorNotificationListener listener;
+
+ /**
+ * The classpath to use
+ */
+ private String classPath;
+
+ /**
+ * list of generated source files created in this environment and
+ * its type
+ */
+ private List generatedFiles = new ArrayList();
+
+ /**
+ * The number of errors and warnings
+ */
+ private int nwarnings;
+ private int nerrors;
+
+ /**
+ * flags
+ */
+ private int flags;
+
+ private Names names;
+
+ /**
+ * Create a ClientProcessorEnvironment with the given class path,
+ * stream for messages and ProcessorNotificationListener.
+ */
+ public ClientProcessorEnvironment(
+ OutputStream out,
+ String classPath,
+ ProcessorNotificationListener listener) {
+
+ this.out = out;
+ this.classPath = classPath;
+ this.listener = listener;
+ flags = 0;
+
+ //bug fix:4904604
+ names = JAXWSClassFactory.newInstance().createNames();
+ }
+
+ /**
+ * Set the environment flags
+ */
+ public void setFlags(int flags) {
+ this.flags = flags;
+ }
+
+ /**
+ * Get the environment flags
+ */
+ public int getFlags() {
+ return flags;
+ }
+
+ /**
+ * Get the ClassPath.
+ */
+ public String getClassPath() {
+ return classPath;
+ }
+
+ /**
+ * Is verbose turned on
+ */
+ public boolean verbose() {
+ return (flags & F_VERBOSE) != 0;
+ }
+
+ /**
+ * Remember info on generated source file generated so that it
+ * can be removed later, if appropriate.
+ */
+ public void addGeneratedFile(GeneratedFileInfo file) {
+ generatedFiles.add(file);
+ }
+
+ /**
+ * Return all the generated files and its types.
+ */
+ public Iterator getGeneratedFiles() {
+ return generatedFiles.iterator();
+ }
+
+ /**
+ * Delete all the generated source files made during the execution
+ * of this environment (those that have been registered with the
+ * "addGeneratedFile" method).
+ */
+ public void deleteGeneratedFiles() {
+ synchronized (generatedFiles) {
+ Iterator iter = generatedFiles.iterator();
+ while (iter.hasNext()) {
+ File file = ((GeneratedFileInfo)iter.next()).getFile();
+ if (file.getName().endsWith(".java")) {
+ file.delete();
+ }
+ }
+ generatedFiles.clear();
+ }
+ }
+
+ /**
+ * Release resources, if any.
+ */
+ public void shutdown() {
+ listener = null;
+ generatedFiles = null;
+ }
+
+ public void error(Localizable msg) {
+ if (listener != null) {
+ listener.onError(msg);
+ }
+ nerrors++;
+ }
+
+ public void warn(Localizable msg) {
+ if (warnings()) {
+ nwarnings++;
+ if (listener != null) {
+ listener.onWarning(msg);
+ }
+ }
+ }
+
+ public void info(Localizable msg) {
+ if (listener != null) {
+ listener.onInfo(msg);
+ }
+ }
+
+ public void printStackTrace(Throwable t) {
+ if (outprintstream == null) {
+ outprintstream = new PrintStream(out);
+ }
+ t.printStackTrace(outprintstream);
+ }
+
+ public Names getNames() {
+ return names;
+ }
+
+ public int getErrorCount() {
+ return nerrors;
+ }
+
+ public int getWarningCount() {
+ return nwarnings;
+ }
+
+ private boolean warnings() {
+ return (flags & F_WARNINGS) != 0;
+ }
+
+ //bug fix:4904604
+ //to called in compileTool after env is
+ public void setNames(Names names) {
+ this.names = names;
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/util/ClientProcessorEnvironment.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/util/DirectoryUtil.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/util/DirectoryUtil.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/util/DirectoryUtil.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,102 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.util;
+
+import java.io.File;
+
+import org.jboss.com.sun.tools.ws.processor.generator.GeneratorException;
+import org.jboss.com.sun.tools.ws.util.ClassNameInfo;
+
+
+/**
+ * Util provides static utility methods used by other wscompile classes.
+ *
+ * @author WS Development Team
+ */
+public class DirectoryUtil {
+
+ public static File getOutputDirectoryFor(String theClass,
+ File rootDir, ProcessorEnvironment env) throws GeneratorException {
+
+ File outputDir = null;
+ String qualifiedClassName = theClass;
+ String packagePath = null;
+ String packageName = ClassNameInfo.getQualifier(qualifiedClassName);
+ if (packageName != null && packageName.length() > 0) {
+ packagePath = packageName.replace('.', File.separatorChar);
+ }
+
+ // Do we have a root directory?
+ if (rootDir != null) {
+
+ // Yes, do we have a package name?
+ if (packagePath != null) {
+
+ // Yes, so use it as the root. Open the directory...
+ outputDir = new File(rootDir, packagePath);
+
+ // Make sure the directory exists...
+ ensureDirectory(outputDir,env);
+ } else {
+
+ // Default package, so use root as output dir...
+ outputDir = rootDir;
+ }
+ } else {
+
+ // No root directory. Get the current working directory...
+ String workingDirPath = System.getProperty("user.dir");
+ File workingDir = new File(workingDirPath);
+
+ // Do we have a package name?
+ if (packagePath == null) {
+
+ // No, so use working directory...
+ outputDir = workingDir;
+ } else {
+
+ // Yes, so use working directory as the root...
+ outputDir = new File(workingDir, packagePath);
+
+ // Make sure the directory exists...
+ ensureDirectory(outputDir,env);
+ }
+ }
+
+ // Finally, return the directory...
+ return outputDir;
+ }
+
+ private static void ensureDirectory(File dir, ProcessorEnvironment env)
+ throws GeneratorException {
+
+ if (!dir.exists()) {
+ dir.mkdirs();
+ if (!dir.exists()) {
+ throw new GeneratorException("generator.cannot.create.dir",
+ dir.getAbsolutePath());
+ }
+ }
+ }
+}
+
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/util/DirectoryUtil.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/util/GeneratedFileInfo.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/util/GeneratedFileInfo.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/util/GeneratedFileInfo.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,79 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.util;
+
+import java.io.File;
+
+/**
+ * A container to hold info on the files that get
+ * generated.
+ *
+ * @author WS Development Team
+ */
+public class GeneratedFileInfo {
+
+ /**
+ * local variables
+ */
+ private File file = null;
+ private String type = null;
+
+ /* constructor */
+ public GeneratedFileInfo() {}
+
+ /**
+ * Adds the file object to the container
+ *
+ * @param file instance of the file to be added
+ */
+ public void setFile( File file ) {
+ this.file = file;
+ }
+
+ /**
+ * Adds the type of file it is the container
+ *
+ * @param type string which specifices the type
+ */
+ public void setType( String type ) {
+ this.type = type;
+ }
+
+ /**
+ * Gets the file that got added
+ *
+ * @return File that got added
+ */
+ public File getFile() {
+ return( file );
+ }
+
+ /**
+ * Get the file type that got added
+ *
+ * @return File type of datatype String
+ */
+ public String getType() {
+ return ( type );
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/util/GeneratedFileInfo.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/util/IndentingWriter.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/util/IndentingWriter.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/util/IndentingWriter.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,328 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.util;
+
+import java.io.BufferedWriter;
+import java.io.IOException;
+import java.io.Writer;
+
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetEncoder;
+import java.text.MessageFormat;
+
+import org.jboss.com.sun.tools.ws.processor.generator.GeneratorException;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class IndentingWriter extends BufferedWriter {
+
+ private boolean beginningOfLine = true;
+ private int currentIndent = 0;
+ private int indentStep = 4;
+
+ public IndentingWriter(Writer out) {
+ super(out);
+ }
+
+ public IndentingWriter(Writer out,int step) {
+ this(out);
+
+ if (indentStep < 0) {
+ throw new IllegalArgumentException("negative indent step");
+ }
+ indentStep = step;
+ }
+
+ public void write(int c) throws IOException {
+ checkWrite();
+ super.write(c);
+ }
+
+ public void write(char[] cbuf, int off, int len) throws IOException {
+ if (len > 0) {
+ checkWrite();
+ }
+ super.write(cbuf, off, len);
+ }
+
+ public void write(String s, int off, int len) throws IOException {
+ if (len > 0) {
+ checkWrite();
+ }
+ super.write(s, off, len);
+ }
+
+ public void newLine() throws IOException {
+ super.newLine();
+ beginningOfLine = true;
+ }
+
+ protected void checkWrite() throws IOException {
+ if (beginningOfLine) {
+ beginningOfLine = false;
+ int i = currentIndent;
+ while (i > 0) {
+ super.write(' ');
+ -- i;
+ }
+ }
+ }
+
+ protected void indentIn() {
+ currentIndent += indentStep;
+ }
+
+ protected void indentOut() {
+ currentIndent -= indentStep;
+ if (currentIndent < 0) {
+ currentIndent = 0;
+ }
+ }
+
+ public void pI() {
+ indentIn();
+ }
+
+ public void pO() {
+ indentOut();
+ }
+
+ public void pI(int levels) {
+ for (int i = 0; i < levels; ++i) {
+ indentIn();
+ }
+ }
+
+ public void pO(int levels) {
+ for (int i = 0; i < levels; ++i) {
+ indentOut();
+ }
+ }
+
+ public void p(String s) throws IOException {
+ /*
+ int tabCount = 0;
+ for (int i = 0; i < s.length(); ++i) {
+ if (s.charAt(i) == '\t') {
+ ++tabCount;
+ indentIn();
+ }
+ }
+
+ String printStr = s.substring(tabCount);
+ */
+ boolean canEncode = true;
+
+ //bug fix: 4839636
+ try{
+ if(!canEncode(s)) {
+ canEncode = false;
+ }
+ } catch (Throwable t) {
+
+ // there was some exception, what should we do?
+ // lets ignore it for now and proceed with the code generation!
+ }
+
+ if(!canEncode) {
+ throw new GeneratorException(
+ "generator.indentingwriter.charset.cantencode", s);
+ }
+ write(s);
+/*
+ while (tabCount-- > 0) {
+ indentOut();
+ }
+ */
+ }
+
+ /**
+ * Check if encode can handle the chars in this string.
+ *
+ */
+ protected boolean canEncode(String s) {
+ final CharsetEncoder encoder =
+ Charset.forName(System.getProperty("file.encoding")).newEncoder();
+ char[] chars = s.toCharArray();
+ for (int i=0; i<chars.length; i++) {
+ if(!encoder.canEncode(chars[i])) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public void p(String s1, String s2) throws IOException {
+ p(s1);
+ p(s2);
+ }
+
+ public void p(String s1, String s2, String s3) throws IOException {
+ p(s1);
+ p(s2);
+ p(s3);
+ }
+
+ public void p(String s1, String s2, String s3, String s4) throws IOException {
+ p(s1);
+ p(s2);
+ p(s3);
+ p(s4);
+ }
+
+ public void p(String s1, String s2, String s3, String s4, String s5) throws
IOException {
+ p(s1);
+ p(s2);
+ p(s3);
+ p(s4);
+ p(s5);
+ }
+
+ public void pln() throws IOException {
+ newLine();
+ }
+
+ public void pln(String s) throws IOException {
+ p(s);
+ pln();
+ }
+
+ public void pln(String s1, String s2) throws IOException {
+ p(s1, s2);
+ pln();
+ }
+
+ public void pln(String s1, String s2, String s3) throws IOException {
+ p(s1, s2, s3);
+ pln();
+ }
+
+ public void pln(String s1, String s2, String s3, String s4) throws IOException {
+ p(s1, s2, s3, s4);
+ pln();
+ }
+
+ public void pln(String s1, String s2, String s3, String s4, String s5) throws
IOException {
+ p(s1, s2, s3, s4, s5);
+ pln();
+ }
+
+ public void plnI(String s) throws IOException {
+ p(s);
+ pln();
+ pI();
+ }
+
+ public void pO(String s) throws IOException {
+ pO();
+ p(s);
+ }
+
+ public void pOln(String s) throws IOException {
+ pO(s);
+ pln();
+ }
+
+ public void pOlnI(String s) throws IOException {
+ pO(s);
+ pln();
+ pI();
+ }
+
+ public void p(Object o) throws IOException {
+ write(o.toString());
+ }
+
+ public void pln(Object o) throws IOException {
+ p(o.toString());
+ pln();
+ }
+
+ public void plnI(Object o) throws IOException {
+ p(o.toString());
+ pln();
+ pI();
+ }
+
+ public void pO(Object o) throws IOException {
+ pO();
+ p(o.toString());
+ }
+
+ public void pOln(Object o) throws IOException {
+ pO(o.toString());
+ pln();
+ }
+
+ public void pOlnI(Object o) throws IOException {
+ pO(o.toString());
+ pln();
+ pI();
+ }
+
+ public void pM(String s) throws IOException {
+ int i = 0;
+ while (i < s.length()) {
+ int j = s.indexOf('\n', i);
+ if (j == -1) {
+ p(s.substring(i));
+ break;
+ } else {
+ pln(s.substring(i, j));
+ i = j + 1;
+ }
+ }
+ }
+
+ public void pMln(String s) throws IOException {
+ pM(s);
+ pln();
+ }
+
+ public void pMlnI(String s) throws IOException {
+ pM(s);
+ pln();
+ pI();
+ }
+
+ public void pMO(String s) throws IOException {
+ pO();
+ pM(s);
+ }
+
+ public void pMOln(String s) throws IOException {
+ pMO(s);
+ pln();
+ }
+
+ public void pF(String pattern, Object[] arguments) throws IOException {
+ pM(MessageFormat.format(pattern, arguments));
+ }
+
+ public void pFln(String pattern, Object[] arguments) throws IOException {
+ pF(pattern, arguments);
+ pln();
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/util/IndentingWriter.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/util/ProcessorEnvironment.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/util/ProcessorEnvironment.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/util/ProcessorEnvironment.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,106 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.util;
+
+import java.net.URLClassLoader;
+import java.util.Iterator;
+
+import org.jboss.com.sun.tools.ws.processor.generator.Names;
+import org.jboss.com.sun.xml.ws.util.localization.Localizable;
+
+
+import com.sun.mirror.apt.Filer;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public interface ProcessorEnvironment {
+
+ /*
+ * Flags
+ */
+ int F_VERBOSE = 1 << 0;
+ int F_WARNINGS = 1 << 1;
+
+ /**
+ * Set the environment flags
+ */
+ public void setFlags(int flags);
+
+ /**
+ * Get the environment flags
+ */
+ public int getFlags();
+
+ /**
+ * Get the ClassPath.
+ */
+ public String getClassPath();
+
+ /**
+ * Is verbose turned on
+ */
+ public boolean verbose();
+
+ /**
+ * Remember a generated file and its type so that it
+ * can be removed later, if appropriate.
+ */
+ public void addGeneratedFile(GeneratedFileInfo file);
+
+ public Filer getFiler();
+ public void setFiler(Filer filer);
+
+ /**
+ * Delete all the generated files made during the execution of this
+ * environment (those that have been registered with the
"addGeneratedFile"
+ * method)
+ */
+ public void deleteGeneratedFiles();
+
+ /**
+ * Get a URLClassLoader from using the classpath
+ */
+ public URLClassLoader getClassLoader();
+
+ public Iterator getGeneratedFiles();
+
+ /**
+ * Release resources, if any.
+ */
+ public void shutdown();
+
+ public void error(Localizable msg);
+
+ public void warn(Localizable msg);
+
+ public void info(Localizable msg);
+
+ public void printStackTrace(Throwable t);
+
+ public Names getNames();
+
+ public int getErrorCount();
+ public int getWarningCount();
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/util/ProcessorEnvironment.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/util/ProcessorEnvironmentBase.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/util/ProcessorEnvironmentBase.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/util/ProcessorEnvironmentBase.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,116 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.processor.util;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.StringTokenizer;
+import com.sun.mirror.apt.Filer;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public abstract class ProcessorEnvironmentBase implements ProcessorEnvironment {
+
+ protected URLClassLoader classLoader = null;
+ protected Filer filer = null;
+
+ /**
+ * Get a URLClassLoader from using the classpath
+ */
+ public URLClassLoader getClassLoader() {
+ if (classLoader == null) {
+ classLoader =
+ new URLClassLoader(pathToURLs(getClassPath()),
+ this.getClass().getClassLoader());
+ }
+ return classLoader;
+ }
+
+ /**
+ * Utility method for converting a search path string to an array
+ * of directory and JAR file URLs.
+ *
+ * @param path the search path string
+ * @return the resulting array of directory and JAR file URLs
+ */
+ public static URL[] pathToURLs(String path) {
+ StringTokenizer st = new StringTokenizer(path, File.pathSeparator);
+ URL[] urls = new URL[st.countTokens()];
+ int count = 0;
+ while (st.hasMoreTokens()) {
+ URL url = fileToURL(new File(st.nextToken()));
+ if (url != null) {
+ urls[count++] = url;
+ }
+ }
+ if (urls.length != count) {
+ URL[] tmp = new URL[count];
+ System.arraycopy(urls, 0, tmp, 0, count);
+ urls = tmp;
+ }
+ return urls;
+ }
+
+ /**
+ * Returns the directory or JAR file URL corresponding to the specified
+ * local file name.
+ *
+ * @param file the File object
+ * @return the resulting directory or JAR file URL, or null if unknown
+ */
+ public static URL fileToURL(File file) {
+ String name;
+ try {
+ name = file.getCanonicalPath();
+ } catch (IOException e) {
+ name = file.getAbsolutePath();
+ }
+ name = name.replace(File.separatorChar, '/');
+ if (!name.startsWith("/")) {
+ name = "/" + name;
+ }
+
+ // If the file does not exist, then assume that it's a directory
+ if (!file.isFile()) {
+ name = name + "/";
+ }
+ try {
+ return new URL("file", "", name);
+ } catch (MalformedURLException e) {
+ throw new IllegalArgumentException("file");
+ }
+ }
+
+ public Filer getFiler() {
+ return filer;
+ }
+
+ public void setFiler(Filer filer) {
+ this.filer = filer;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/processor/util/ProcessorEnvironmentBase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/resources/configuration.properties
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/resources/configuration.properties
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/resources/configuration.properties 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,7 @@
+#
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+#
+
+configuration.invalidElement=invalid element \"{2}\" in file \"{0}\"
(line {1})
+configuration.notBindingFile=Ignoring: binding file "\"{0}\". It is not a
jaxws or a jaxb binding file.
\ No newline at end of file
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/resources/generator.properties
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/resources/generator.properties
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/resources/generator.properties 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,15 @@
+#
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+#
+
+# Generator
+generator.nestedGeneratorError=generator error: {0}
+generator.cant.write=can''t write file: {0}
+generator.cannot.create.dir=can''t create directory: {0}
+generator.internal.error.should.not.happen=internal error (should not happen): {0}
+
+
+#IndentingWriter
+generator.indentingwriter.charset.cantencode=WSDL has some characters which native java
encoder can''t encode: \"{0}\"
+
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/resources/javacompiler.properties
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/resources/javacompiler.properties
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/resources/javacompiler.properties 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,11 @@
+#
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+#
+
+#
+# Generic Messages
+#
+javacompiler.classpath.error={0} is not available in the classpath.
+javacompiler.nosuchmethod.error=There is no such method {0} available.
+javacompiler.error=error : {0}.
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/resources/model.properties
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/resources/model.properties
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/resources/model.properties 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,69 @@
+#
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+#
+
+
+model.nestedModelError=model error: {0}
+model.duplicate.porttype=duplicate PortType added to model: {0}
+model.duplicate.operation=duplicate Operation added to model: {0}
+model.duplicate.faultmessage=duplicate fault message added to model: {0}
+model.duplicate.part=duplicate part added to model: {0}
+model.duplicate.property=duplicate property added to model: {0}
+model.duplicate.service=duplicate service added to model: {0}
+model.invalid.message.type=invalid message type: {0}
+model.invalid.processorActionVersion=invalid ProcessorActionVersion: {0}
+
+model.schema.notImplemented=unsupported XML Schema feature ({0})
+model.schema.circularity=circularity detected in schema: \"{0}\"
+
+model.schema.unsupportedType=unsupported type ({0}): \"{1}\" (namespace: {2})
+model.schema.unsupportedType.anonymous=unsupported anonymous type ({0})
+model.schema.invalidLiteralInEnumeration=invalid literal \"{0}\" in enumeration
\"{1}\" (namespace: {2})
+model.schema.invalidLiteralInEnumeration.anonymous=invalid literal \"{0}\" in
anonymous enumeration
+
+model.schema.notImplemented.generatingSOAPElement=unsupported XML Schema feature:
\"{0}\" in component {1}, mapping it to javax.xml.soap.SOAPElement
+
+//replacement for Uxxx codes
+model.schema.unsupportedSchemaType=unsupported schema type: \"{0}\"
+model.schema.invalidSimpleType=invalid simpleType: \"{0}\"
+model.schema.invalidSimpleType.noJavaType=no java mapping for simpleType:
\"{0}\"
+model.schema.simpleTypeWithFacets=facet \"{0}\" not supported on simple type:
\"{0}\"
+model.schema.unionNotSupported=simpleType: \"{0}\" derivation by xsd:union not
supported
+model.schema.listNotSupported=simpleType: \"{0}\" derivation by xsd:list not
supported
+model.schema.invalidSimpleType.invalidItemType=in simpleType: \"{0}\", itemType
\"{1}\" can not be derived by list
+model.schema.invalidSimpleType.noItemLiteralType=in simpleType: \"{0}\",
xsd:list itemType \"{1}\" is invalid
+model.schema.invalidSimpleType.noNamespaceURI=invalid simpleType: \"{0}\", had
null namespaceURI
+model.schema.encoderNotFound=no encoder found for simpleType: \"{0}\"
+model.schema.invalidWildcard.allCompositor=xsd:all compositor not supported for the
wildcard in schema type: \"{0}\"
+
+model.uniqueness=uniqueness constraint violation
+model.uniqueness.javastructuretype=uniqueness constraint violation, duplicate member
\"{0}\" added to JavaStructureType \"{1}\"
+model.parent.type.already.set=parent of type \"{0}\" already set to
\"{1}\", new value = \"{2}\"
+model.parent.fault.already.set=parent of fault \"{0}\" already set to
\"{1}\", new value = \"{2}\"
+model.exporter.unsupportedClass=model exporter: unsupported class: {0}
+model.importer.nonModel=not a valid model document
+model.importer.syntaxError=syntax error in model document (line {0})
+model.importer.invalidVersion=invalid version \"{1}\" in model document (line
{0})
+model.importer.invalidMinorMinorOrPatchVersion=model version \"{1}\" newer than
runtime version \"{2}\" (line {0}): need to upgrade to a newer runtime
+model.importer.invalidClass=invalid class name \"{1}\" in model document (line
{0})
+model.importer.invalidId=invalid id \"{1}\ in model document (line {0})
+model.importer.invalidLiteral=invalid literal value in model document (line {0})
+model.importer.invalidProperty=invalid property in model document (line {0}
+model.arraywrapper.only.one.member=LiteralArrayWrapper may only have one element member.
+model.arraywrapper.member.already.set=LiteralArrayWrapper element member already set.
+model.arraywrapper.no.parent=LiteralArrayWrapper cannot have a parent type
+model.arraywrapper.no.subtypes=LiteralArrayWrapper cannot have subtypes
+model.arraywrapper.no.content.member=LiteralArrayWrapper cannot have a content member
+model.complexType.simpleContent.reservedName=invalid attribute name: "_value"
in complexType: \"{0}\", _value is JAXWS reserved name, this name is generated
in the generated javabean class to hold content value in the generated javabean class for
complexType/simpleContent.
+
+//JAXWS 2.0
+model.schema.elementNotFound=Element \"{0}\" not found.
+model.schema.jaxbException.message="{0}"
+model.saxparser.exception:{0}\n{1}
+
+ConsoleErrorReporter.UnknownLocation = \
+ unknown location
+
+ConsoleErrorReporter.LineXOfY = \
+ \ \ line {0} of {1}
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/resources/modeler.properties
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/resources/modeler.properties
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/resources/modeler.properties 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,192 @@
+#
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+#
+
+# general
+modeler.nestedModelError=modeler error: {0}
+
+
+# WSDLModeler
+wsdlmodeler.multipleOutputParameters=multiple \"out\" parameters in operation:
{0}
+wsdlmodeler.invalidOperation=invalid operation: {0}
+wsdlmodeler.invalidState.modelingOperation=invalid state while modeling operation: {0}
+wsdlmodeler.resultIsInOutParameter=result is \"inout\" parameter in operation:
{0}
+wsdlmodeler.invalid.parameterorder.parameter=\"{0}\" specified in the
parameterOrder attribute of operation \"{1}\" is not a valid part of the
message.
+wsdlmodeler.invalid.parameterOrder.tooManyUnmentionedParts=more than one part left out in
the parameterOrder attribute of operation \"{0}\"
+wsdlmodeler.invalid.parameterOrder.invalidParameterOrder=parameterOrder attribute on
operation \"{0}\" is invalid, ignoring parameterOrder hint
+wsdlmodeler.invalid.parameter.differentTypes=parameter \"{0}\" of operation
\"{1}\" appears with different types in the input and output messages
+wsdlmodeler.invalid.bindingOperation.notInPortType=in binding \"{1}\",
operation \"{0}\" does not appear in the corresponding port type
+wsdlmodeler.invalid.bindingOperation.inputMissingSoapBody=input message of binding
operation \"{0}\" does not have a SOAP body extension
+wsdlmodeler.invalid.bindingOperation.outputMissingSoapBody=output message of binding
operation \"{0}\" does not have a SOAP body extension
+wsdlmodeler.invalid.bindingOperation.missingInputName=binding operation \"{0}\"
must specify a name for its input message
+wsdlmodeler.invalid.bindingOperation.missingOutputName=binding operation
\"{0}\" must specify a name for its output message
+wsdlmodeler.invalid.bindingOperation.multipleMatchingOperations=in binding
\"{1}\", operation \"{0}\" does not reference a unique operation in
the corresponding port type
+wsdlmodeler.invalid.bindingOperation.notFound=in binding \"{1}\", operation
\"{0}\" does not match any operation in the corresponding port type
+wsdlmodeler.invalid.bindingOperation.inputSoapBody.missingNamespace=input message of
binding operation \"{0}\" must specify a value for the \"namespace\"
attribute
+wsdlmodeler.invalid.bindingOperation.outputSoapBody.missingNamespace=output message of
binding operation \"{0}\" must specify a value for the \"namespace\"
attribute
+wsdlmodeler.invalid.bindingOperation.inputHeader.missingNamespace=input header
\"{1}\" of binding operation \"{0}\" must specify a value for the
\"namespace\" attribute
+wsdlmodeler.invalid.bindingOperation.outputHeader.missingNamespace=output header
\"{1}\" of binding operation \"{0}\" must specify a value for the
\"namespace\" attribute
+wsdlmodeler.invalid.bindingFault.notUnique=fault \"{0}\" in operation
\"{1}\" matches more than one fault in the corresponding port type operation
+wsdlmodeler.invalid.bindingFault.notFound=fault \"{0}\" in operation
\"{1}\" does not match any fault in the corresponding port type operation
+wsdlmodeler.invalid.bindingFault.outputMissingSoapFault=fault \"{0}\" in
operation \"{1}\" does not have a SOAP fault extension
+wsdlmodeler.invalid.bindingFault.missingName=fault \"{0}\" in operation
\"{1}\" must specify a value for the \"name\" attribute
+wsdlmodeler.invalid.bindingFault.missingNamespace=fault \"{0}\" in operation
\"{1}\" must specify a value for the \"namespace\" attribute
+wsdlmodeler.invalid.bindingFault.emptyMessage=fault \"{0}\" refers to message
\"{1}\", but the message has no parts
+wsdlmodeler.invalid.bindingFault.messageHasMoreThanOnePart=fault \"{0}\" refers
to message \"{1}\", but the message has more than one parts
+wsdlmodeler.invalid.message.partMustHaveTypeDescriptor=in message \"{0}\", part
\"{1}\" must specify a \"type\" attribute
+wsdlmodeler.invalid.message.partMustHaveElementDescriptor=in message \"{0}\",
part \"{1}\" must specify a \"element\" attribute
+wsdlmodeler.invalid=invalid WSDL document
+wsdlmodeler.unsolvableNamingConflicts=the following naming conflicts occurred: {0}
+#
+wsdlmodeler.warning.ignoringUnrecognizedSchemaExtension=ignoring schema element
(unsupported version): {0}
+wsdlmodeler.warning.searchSchema.unrecognizedTypes=encountered {0} unrecognized type(s)
+wsdlmodeler.warning.noServiceDefinitionsFound=WSDL document does not define any services
+wsdlmodeler.warning.noPortsInService=Service \"{0}\" does not contain any
usable ports
+wsdlmodeler.warning.noOperationsInPort=Port \"{0}\" does not contain any usable
operations
+wsdlmodeler.warning.ignoringNonSOAPPort=ignoring port \"{0}\": not a SOAP port
+wsdlmodeler.warning.ignoringNonSOAPPort.noAddress=ignoring port \"{0}\": no
SOAP address specified
+wsdlmodeler.warning.ignoringSOAPBinding.nonHTTPTransport:ignoring SOAP port
\"{0}\": unrecognized transport
+
+#BP1.1 R2705
+wsdlmodeler.warning.ignoringSOAPBinding.mixedStyle=ignoring SOAP port \"{0}\",
its not WS-I BP 1.1 compliant: the wsdl binding has mixed style, it must be rpc-literal or
document-literal operation!
+wsdlmodeler.warning.port.SOAPBinding.mixedStyle=not a WS-I BP1.1 compliant SOAP port
\"{0}\": the wsdl binding has mixed style, it must be rpc-literal or
document-literal operation!
+
+wsdlmodeler.warning.ignoringOperation.notSupportedStyle=ignoring operation
\"{0}\": not request-response or one-way
+wsdlmodeler.invalid.operation.notSupportedStyle=Invalid WSDL, wsdl:operation
\"{0}\" in wsdl:portType \"{1}\": not request-response or one-way
+wsdlmodeler.warning.ignoringOperation.notEncoded=ignoring RPC-style operation
\"{0}\": parameters are not encoded
+wsdlmodeler.warning.ignoringOperation.cannotHandleBodyPartsAttribute=ignoring operation
\"{0}\": cannot handle \"parts\" attribute of \"soap:body\"
element
+
+wsdlmodeler.warning.ignoringOperation.cannotHandleTypeMessagePart=ignoring operation
\"{0}\": message part does not refer to a schema element declaration
+wsdlmodeler.invalid.doclitoperation=Invalid wsdl:operation \"{0}\": its a
document-literal operation, message part must refer to a schema element declaration
+
+wsdlmodeler.warning.ignoringOperation.cannotHandleElementMessagePart=ignoring operation
\"{0}\": message part does not refer to a schema type declaration
+wsdlmodeler.invalid.rpclitoperation=Invalid wsdl:operation \"{0}\": its a
rpc-literal operation, message part must refer to a schema type declaration
+
+
+wsdlmodeler.warning.ignoringOperation.cannotHandleDocumentStyle=ignoring operation
\"{0}\": cannot handle document-style operations
+wsdlmodeler.warning.bindingOperation.multiplePartBinding=Check the abstract operation
\"{0}\" binding, part \"{1}\" has multiple binding. Will try to
generated artiffacts anyway...
+wsdlmodeler.invalid.bindingOperation.multiplePartBinding=abstract operation
\"{0}\" binding, part \"{1}\" has multiple binding.
+wsdlmodeler.warning.ignoringFaults=ignoring faults declared by operation
\"{0}\"
+wsdlmodeler.warning.ignoringFault.notEncoded=ignoring literal fault \"{0}\" of
binding operation \"{1}\"
+wsdlmodeler.warning.ignoringFault.notLiteral=ignoring encoded fault \"{0}\" of
binding operation \"{1}\"
+wsdlmodeler.invalid.operation.fault.notLiteral=ignoring encoded fault \"{0}\"
in literal binding operation \"{1}\"
+wsdlmodeler.warning.ignoringHeader=ignoring header \"{0}\" of binding operation
\"{1}\"
+wsdlmodeler.warning.ignoringHeader.partFromBody=header part: \"{0}\" already
bound by soapbind:body, illegal to bind the part twice
+wsdlmodeler.warning.ignoringHeader.notLiteral=ignoring header \"{0}\" of
binding operation \"{1}\": not literal
+wsdlmodeler.invalid.header.notLiteral=Invalid header \"{0}\" of binding
operation \"{1}\": not literal
+wsdlmodeler.warning.ignoringHeader.notFound=ignoring header \"{0}\" of binding
operation \"{1}\": not found
+wsdlmodeler.invalid.header.notFound=header \"{0}\" of binding operation
\"{1}\": not found
+wsdlmodeler.warning.ignoringHeader.cant.resolve.message=ignoring header \"{0}\"
of binding operation \"{1}\": cannot resolve message
+wsdlmodeler.invalid.header.cant.resolve.message=header \"{0}\" of binding
operation \"{1}\": cannot resolve message
+
+wsdlmodeler.warning.ignoringFault.cant.resolve.message=ignoring fault \"{0}\"
of binding operation \"{1}\": cannot resolve message
+wsdlmodeler.invalid.fault.cant.resolve.message=fault message \"{0}\" in binding
operation \"{1}\" could not be resolved
+
+wsdlmodeler.warning.ignoringHeader.notEncoded=ignoring header \"{0}\" of
binding operation \"{1}\": not SOAP-encoded
+wsdlmodeler.warning.ignoringHeader.inconsistentDefinition=ignoring header
\"{0}\" of operation \"{1}\": part not found
+#
+wsdlmodeler.warning.ignoringOperation.notLiteral=ignoring document-style operation
\"{0}\": parameters are not literal
+wsdlmodeler.warning.ignoringOperation.cannotHandleMoreThanOnePartInInputMessage=ignoring
operation \"{0}\": more than one part in input message
+wsdlmodeler.warning.ignoringOperation.cannotHandleEmptyInputMessage=ignoring operation
\"{0}\": input message is empty
+wsdlmodeler.warning.ignoringOperation.cannotHandleMoreThanOnePartInOutputMessage=ignoring
operation \"{0}\": more than one part in output message
+wsdlmodeler.warning.operation.MoreThanOnePartInMessage=Ingoring operation
\"{0}\": more than one part bound to body
+wsdlmodeler.invalid.operation.MoreThanOnePartInMessage=operation \"{0}\": more
than one part bound to body
+wsdlmodeler.warning.ignoringOperation.cannotHandleEmptyOutputMessage=ignoring operation
\"{0}\": output message is empty
+wsdlmodeler.warning.ignoringOperation.conflictStyleInWSIMode=ignoring operation
\"{0}\": binding style and operation style are conflicting
+wsdlmodeler.warning.ignoringOperation.partNotFound=ignoring operation \"{0}\":
part \"{1}\" not found
+wsdlmodeler.error.partNotFound=part \"{1}\" of operation \"{0}\"
could not be resolved!
+wsdlmodeler.warning.ignoringFault.documentOperation=ignoring fault \"{0}\" of
document-style operation \"{1}\"
+wsdlmodler.warning.operation.use=The WSDL used has operations with literal and encoded
use. -f:searchschema is not supported for this scenario.
+#wsdlmodeler.invalid.bindingFault.wrongSoapFaultName=The name of the SOAP fault extension
does not match the name of the \"{0}\" fault in operation \"{1}\"
+wsdlmodeler.invalid.bindingFault.wrongSoapFaultName=name of soap:fault \"{0}\"
doesn''t match the name of wsdl:fault \"{1}\" in operation
\"{2}\"
+#wsdlmodeler.invalid.bindingFault.noSoapFaultName=The name of the SOAP fault extension is
missing from the fault \"{0}\" in operation \"{1}\"
+wsdlmodeler.invalid.bindingFault.noSoapFaultName=soap:fault name not specified,
wsdl:fault \"{0}\" in operation \"{1}\"
+
+wsdlmodeler.duplicate.fault.part.name=ignoring fault \"{0}\" of operation
\"{1}\", part name \"{2}\" is not unique
+wsdlmodeler.duplicate.fault.soap.name=ignoring fault \"{0}\" of operation
\"{1}\", soap:fault name \"{2}\" is not unique
+
+wsdlmodeler.warning.ignoringHeaderFault.notFound=ignoring header fault \"{0}\",
cannot find part \"{1}\" in binding \"{2}\"
+wsdlmodeler.headerfault.part.notFound=part \"{1}\" not found for the header
fault \"{0}\", in binding \"{2}\"
+
+wsdlmodeler.warning.ignoringHeaderFault.notLiteral=ignoring header fault
part=\"{0}\" message=\"{1}\" of operation {2}, use attribute MUST be
\"literal\"
+
+wsdlmodeler.warning.ignoringHeaderFault.noElementAttribute=ignoring header fault
part=\"{0}\" message=\"{1}\" of operation {2}
+
+wsdlmodeler.invalid.headerfault.notLiteral=Invalid headerfault \"{0}\" of
binding operation \"{1}\": not literal
+wsdlmodeler.invalid.headerfault.message.partMustHaveElementDescriptor=Invalid headerfault
\"{0}\" for header {1} in operation {2}: part must specify a
\"element\" attribute
+wsdlmodeler.invalid.header.message.partMustHaveElementDescriptor=Invalid header
\"{0}\" in operation {1}: part must specify a \"element\" attribute
+
+
+#wsi warnings
+wsdlmodeler.warning.nonconforming.wsdl.import=Non conforming WS-I WSDL used for
wsdl:import
+wsdlmodeler.warning.nonconforming.wsdl.types=Non conforming WS-I WSDL used for
wsdl:types
+wsdlmodeler.warning.nonconforming.wsdl.use=Processing WS-I non conforming operation
\"{0}\" with RPC-Style and SOAP-encoded
+
+# optional parts
+wsdlmodeler.error.partsNotFound=parts \"{0}\" not found in the message
\"{1}\", wrong WSDL
+
+# soap 1.2
+wsdlmodeler.warning.port.SOAPBinding12=SOAP port \"{0}\": uses a non-standard
SOAP 1.2 binding.
+wsdlmodeler.warning.ignoringSOAPBinding12=Ignoring SOAP port \"{0}\": it uses
non-standard SOAP 1.2 binding.\nYou must specify the \"-extension\" option to
use this binding.
+
+#WSI-BP1.0 Warning/Errors
+wsdlmodeler.warning.r2716=R2716 WSI-BasicProfile ver. 1.0, namespace attribute not
allowed in doc/lit for {0}: \"{1}\"
+wsdlmodeler.warning.r2716r2726=R2716/R2726 WSI-BasicProfile ver. 1.0, namespace attribute
not allowed in doc/lit or rpc/lit for {0}: \"{1}\"
+
+#WSI-BP 1.1 Warning/Errors
+//R2911
+mimemodeler.invalidMimePart.moreThanOneSOAPBody=Ignoring operation \"{0}\". The
Multipart/Related structure has invalid root part: more than one soap:body parts found
+
+//R2906
+mimemodeler.warning.IgnoringinvalidHeaderPart.notDeclaredInRootPart=Headers not in root
mime:part with soap:body, ignoring headers in operation \"{0}\"
+
+//R2909
+mimemodeler.invalidMimeContent.differentPart=Ignoring the mime:part. Invalid mime:part,
the mime:content has different part attribute.
+
+mimemodeler.invalidMimeContent.invalidSchemaType=Ignoring the mime:part. mime part: {0}
can not be mapped to schema type: {1}
+
+//Rxxxx A mime:content in a DESCRIPTION MUST refer to a wsdl:part element defined using
the type attribute.
+mimemodeler.invalidMimeContent.mesagePartElementKind=wsdl:part element referenced by
mime:content part attribute: {0} must be defined using type attribute!
+
+//RXXXX RYYYY: In a description, a mime:content element MUST include the part attribute.
+mimemodeler.invalidMimeContent.missingPartAttribute=Ignoring operation \"{0}\",
missing part attribute in mime:content. part attribute must be present in mime:content
declaration.
+
+mimemodeler.invalidMimeContent.missingTypeAttribute=Missing type attribute in
mime:content in operation \"{0}\". part attribute must be present in
mime:content declaration.
+
+//unknown schematype
+mimemodeler.invalidMimeContent.unknownSchemaType=Unknown schema type: {1} for
mime:content part: {0}
+mimemodeler.invalidMimeContent.errorLoadingJavaClass=Couldn't find class
\"{0}\" for mime type \"{1}\"
+
+//missing wsdl:part referenced by the mime:content
+wsdlmodeler.warning.ignoringMimePart.notFound=ignoring mime:part, cannot find part
\"{0}\" referenced by the mime:content in the wsdl:operation \"{1}\"
+
+mimemodeler.elementPart.invalidElementMimeType=The mime:content part refers to wsdl:part
\"{0}\", defined using element attribute. Please make sure the mime type:
\"{1}\" is appropriate to serialize XML.
+
+//R2708 The mime:part element in a DESCRIPTION MUST NOT have a name attribute.
+mimemodeler.invalidMimePart.nameNotAllowed=name attribute on wsdl:part in Operation
\"{0}\" is ignored. Its not allowed as per WS-I AP 1.0.
+
+
+wsdlmodeler20.rpcenc.not.supported=rpc/encoded wsdl's are not supported in JAXWS 2.0.
+wsdlmodeler.warning.ignoringOperation.notNCName=Ignoring operation \"{0}\", it
has illegal character ''{1}'' in its name. Its rpc-literal operation -
jaxws won't be able to serialize it!
+
+wsdlmodeler.warning.ignoringOperation.javaReservedWordNotAllowed.nonWrapperStyle=Ignoring
operation \"{0}\", can''t generate java method. Parameter: part
"{2}\" in wsdl:message \"{1}\", is a java keyword. Use customization
to change the parameter name or change the wsdl:part name.
+wsdlmodeler.invalid.operation.javaReservedWordNotAllowed.nonWrapperStyle=Invalid
operation \"{0}\", can''t generate java method. Parameter: part
"{2}\" in wsdl:message \"{1}\", is a java keyword. Use customization
to change the parameter name or change the wsdl:part name.
+
+wsdlmodeler.warning.ignoringOperation.javaReservedWordNotAllowed.wrapperStyle=Ignoring
operation \"{0}\", can''t generate java method parameter. Local name of
the wrapper child \"{1}\" in the global element \"{2}\" is a java
keyword. Use customization to change the parameter name.
+wsdlmodeler.invalid.operation.javaReservedWordNotAllowed.wrapperStyle=Invalid operation
\"{0}\", can''t generate java method parameter. Local name of the
wrapper child \"{1}\" in the global element \"{2}\" is a java keyword.
Use customization to change the parameter name.
+
+wsdlmodeler.warning.ignoringOperation.javaReservedWordNotAllowed.customName=Ignoring
operation \"{0}\", can''t generate java method. Parameter,customized
name \"{1}\" is a java keyword.
+wsdlmodeler.invalid.operation.javaReservedWordNotAllowed.customName=Invalid operation
\"{0}\", can''t generate java method. Parameter,customized name
\"{1}\" is a java keyword.
+
+wsdlmodeler.warning.ignoringOperation.javaReservedWordNotAllowed.operationName=Ignoring
operation \"{0}\", it''s java reserved word, can''t generate
java method. Use customization to change the operation name.
+wsdlmodeler.invalid.operation.javaReservedWordNotAllowed.operationName=Invalid operation
\"{0}\", it''s java reserved word, can''t generate java method.
Use customization to change the operation name.
+
+wsdlmodeler.warning.ignoringOperation.javaReservedWordNotAllowed.customizedOperationName=Ignoring
operation \"{0}\", can''t generate java method ,customized name
\"{1}\" of the wsdl:operation is a java keyword.
+wsdlmodeler.invalid.operation.javaReservedWordNotAllowed.customizedOperationName=Invalid
operation \"{0}\", can''t generate java method ,customized name
\"{1}\" of the wsdl:operation is a java keyword.
+
+wsdlmodeler.jaxb.javatype.notfound=Schema descriptor {0} in message part {1} could not be
bound to Java!
+wsdlmodeler.unsupportedBinding.mime=WSDL MIME binding is not currently supported!
+
+wsdlmodeler.nonUnique.body=Non unique body parts! In a port, operations must have unique
operation signaure on the wire for successful dispatch. In port {0}, Operations
\"{1}\" and \"{2}\" have the same request body block {3}
+wsdlmodeler.rpclit.unkownschematype=XML type \"{0}\" could not be resolved, XML
to JAVA binding failed! Please check the wsdl:part \"{1}\" in the wsdl:message
\"{2}\".
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/resources/processor.properties
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/resources/processor.properties
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/resources/processor.properties 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,5 @@
+#
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+#
+processor.missing.model=model is missing
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/resources/util.properties
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/resources/util.properties
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/resources/util.properties 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,7 @@
+#
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+#
+holder.valuefield.not.found=Could not find the field in the Holder that contains the
Holder''s value: {0}
+null.namespace.found=Encountered error in wsdl. Check namespace of element <{0}>
+sax2dom.notsupported.createelement=SAX2DOMEx.DomImplDoesntSupportCreateElementNs: {0}
\ No newline at end of file
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/resources/webserviceap.properties
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/resources/webserviceap.properties
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/resources/webserviceap.properties 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,131 @@
+#
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+#
+
+webserviceap.nestedModelError=modeler error: {0}
+webserviceap.fileNotFound=error: file not found: {0}
+webserviceap.error=error: {0}
+webserviceap.warning=warning: {0}
+webserviceap.info=info: {0}
+webserviceap.compilationFailed=compilation failed, errors should have been reported
+webserviceap.succeeded: Success
+
+webserviceap.method.not.annotated=The method {0} on class {1} is not annotated.
+webserviceap.rpc.encoded.not.supported=The {0} class has a rpc/encoded SOAPBinding.
Rpc/encoded SOAPBindings are not supported in JAXWS 2.0.
+webserviceap.model.already.exists=model already exists
+webserviceap.endpointinterface.on.interface=Service endpointpoint interface\: {0} has
cannot have a WebService.endpointInterface annotation\: {1}
+webserviceap.java.typeNotFound=The type: {0} was not found in the mapping
+webserviceap.endpointinterfaces.do.not.match=The endpoint interface {0} does not match
the interface {1}.
+
+webserviceap.could.not.find.typedecl=Could not get TypeDeclaration for:\ {0} in apt
round:\ {1}
+
+webserviceap.no.webservice.endpoint.found=A web service endpoint could not be found
+
+webserviceap.endpointinterface.has.no.webservice.annotation=The endpoint interface {0}
must have a WebService annotation
+
+webserviceap.oneway.operation.cannot.have.return.type=The method {1} of class {0} is
annotated @Oneway but has a return type.
+
+webserviceap.oneway.operation.cannot.have.holders=The method {1} of class {0} is
annotated @Oneway but contains inout or out paramerters (javax.xml.ws.Holder)
+
+webserviceap.oneway.operation.cannot.declare.exceptions=The method {1} of class {0} is
annotated @Oneway but declares the exception {2}
+
+webserviceap.cannot.combine.handlerchain.soapmessagehandlers=You cannot specify both
HanlderChain and SOAPMessageHandlers annotations
+
+webserviceap.invalid.handlerchain.file.nohandler-config=The handlerchain file {0} is
invalid, it does not contain a handler-config element
+
+webserviceap.could.not.find.handlerchain=Could not find the handlerchain {0} in the
handler file {1}
+
+webserviceap.handlerclass.notspecified=A handler in the HandlerChain file\: {0} does not
specify a handler-class
+
+webserviceap.init_param.format.error=a <init-param> element must have exactly 1
<param-name> and 1 <param-value>
+
+webserviceap.document.literal.bare.method.return.not.unique=Document literal bare methods
must have a unique result name return type combination. Class {0} method\: {1}, result
name\: {2} return type\: {3}
+
+webserviceap.document.literal.bare.method.not.unique=Document literal bare methods must
have unique parameter names. Class\: {0} method\: {1} parameter name\: {2}
+
+webserviceap.document.literal.bare.cannot.have.more.than.one.out=Document literal bare
methods must have a return value or one out parameter. Class\: {0} Method\: {1}
+
+webserviceap.document.literal.bare.must.have.only.one.in.parameter=Document literal bare
methods must have no more than 1 non-header in parameter. Class\: {0} method\: {1} number
of non-header parameters\: {2}
+
+webserviceap.document.literal.bare.must.have.one.in.or.out=Document literal bare methods
must have at least one of: a return, an in parameter or an out parameter. Class\: {0}
Method\: {1}
+
+webserviceap.holder.parameters.must.not.be.in.only=javax.xml.ws.Holder parameters must
not be annotated with the WebParam.Mode.IN property. Class\: {0} method\: {1} parameter\:
{2}
+
+webserviceap.document.bare.holder.parameters.must.not.be.inout=javax.xml.ws.Holder
parameters in document bare operations must be WebParam.Mode.INOUT; Class\: {0} method\:
{1} parameter\: {2}
+
+webserviceap.endpointinterface.class.not.found=The endpointInterface class {0} could not
be found
+
+webserviceap.sei.cannot.contain.constant.values=An service endpoint interface cannot
contain constant declaration\: Interface\: {0} field\: {1}.
+
+webserviceap.method.return.type.cannot.implement.remote=Method return types cannot
implement java.rmi.Remote. Class\: {0} method\: {1} return type\: {2}
+
+webserviceap.method.parameter.types.cannot.implement.remote=Method parameter types cannot
implement java.rmi.Remote. Class\: {0} method\: {1} parameter\: {2} type\: {3}
+
+webserviceap.operation.name.not.unique=Operation names must be unique. Class\: {0}
method\: {1} operation name\: {2}
+
+webserviceap.method.request.wrapper.bean.name.not.unique=Request wrapper bean names must
be unique and must not clash with other generated classes. Class\: {0} method {1}
+
+webserviceap.method.response.wrapper.bean.name.not.unique=Response wrapper bean names
must be unique and must not clash with other generated classes. Class\: {0} method {1}
+
+webserviceap.method.exception.bean.name.not.unique=Exception bean names must be unique
and must not clash with other generated classes. Class\: {0} exception {1}
+
+webserviceap.rpc.literal.parameters.must.have.webparam=All rpc literal parameters must
have a WebParam annotation. Class\: {0} method\: {1} parameter {2}
+
+webserviceap.rpc.literal.webparams.must.specify.name=All rpc literal WebParams must
specify a name. Class\: {0} method {1} paramter {2}
+
+webserviceap.rpc.literal.must.not.be.bare=RPC literal SOAPBindings must have
parameterStyle WRAPPPED. Class\: {0}.
+
+webserviceap.header.parameters.must.have.webparam.name=All WebParam annotations on header
parameters must specify a name. Class\: {0} method {1} paramter {2}
+
+webserviceap.failed.to.find.handlerchain.file=Cannot find HandlerChain file. class\: {0},
file:\ {1}
+
+webserviceap.failed.to.parse.handlerchain.file=Failed to parse HandlerChain file. Class\:
{0}, file\: {1}
+
+webserviceap.class.not.found=Class Not Found: {0}
+
+webserviceap.rpc.soapbinding.not.allowed.on.method=SOAPBinding.Style.RPC binding
annotations are not allowed on methods. Class\: {0} Method\: {1}
+
+webserviceap.mixed.binding.style=Class\: {0} contains mixed bindings.
SOAPBinding.Style.RPC and SOAPBinding.Style.DOCUMENT cannot be mixed.
+
+webserviceap.endpointinteface.plus.annotation=The @{0} annotation cannot be used in with
@javax.jws.WebService.endpointInterface element.
+
+webserviceap.endpointinteface.plus.element=The @javax.jws.WebService.{0} element cannot
be used in with @javax.jws.WebService.endpointInterface element.
+
+webserviceap.non.in.parameters.must.be.holder=Class:\ {0}, method: {1}, parameter: {2} is
not WebParam.Mode.IN and is not of type javax.xml.ws.Holder.
+
+webserviceap.invalid.sei.annotation.element=The @javax.jws.WebService.{0} element cannot
be specified on a service endpoint interface. Class\: {1}
+
+webserviceap.invalid.sei.annotation=The @{0} annotation cannot be used on a service
endpoint interface. Class\: {1}
+
+webserviceap.invalid.webmethod.element.with.exclude=The @javax.jws.WebMethod.{0} element
cannot be specified with the @javax.jws.WebMethod.exclude element. Class\: {1} method\:
{0}
+
+webserviceap.doc.bare.no.out=Document/literal bare methods with no return type or
OUT/INOUT parameters must be annotated as @Oneway. Class\: {0}, method: {1}
+webserviceap.doc.bare.return.and.out=Document/literal bare methods cannot have a return
type and out parameters. Class\: {0}, method: {1}
+webserviceap.oneway.and.out=@Oneway methods cannot have out parameters. Class\: {0}
method {1}
+
+webserviceap.webservice.class.not.public=Classes annotated with @javax.jws.WebService
must be public. Class\: {0}
+
+webserviceap.webservice.class.is.final=Classes annotated with @javax.jws.WebService must
not be final. Class\: {0}
+
+webserviceap.webservice.class.is.abstract=Classes annotated with @javax.jws.WebService
must not be abstract. Class\: {0}
+
+webserviceap.webservice.class.is.innerclass.not.static=Inner classes annotated with
@javax.jws.WebService must be static. Class\: {0}
+
+webserviceap.webservice.method.is.abstract=Classes annotated with @javax.jws.WebService
must not have abstract methods. Class\: {0} Method: {1}
+
+webserviceap.doc.bare.return.and.out=Document literal bare methods must not have a return
value and an OUT/INOUT parameter. Class\: {0} Method\: {1}
+
+webserviceap.webservice.no.default.constructor=Classes annotated with
@javax.jws.WebService must have a public default constructor. Class\: {0}
+
+webserviceap.oneway.and.not.one.in=Document literal bare methods annotated with
@javax.jws.Oneway must have one non-header IN parameter. Class\: {0} Method\: {1}
+
+webserviceap.doc.bare.no.return.and.no.out=Document literal bare methods that do not have
a return value must have a single OUT/INOUT parameter. Class\: {0} Method\: {1}
+
+webserviceap.doc.bare.and.no.one.in=Document literal bare methods must have one
non-header, IN/INOUT parameter. Class\: {0} Method\: {1}
+
+webserviceap.method.not.implemented=Methods in an endpointInterface must be implemented
in the implementation class. Interface Class\:{0} Implementation Class\:{1} Method\: {2}
+
+webserviceap.no.package.class.must.have.targetnamespace=(a)javax.jws.Webservice annotated
classes that do not belong to a package must have the
@javax.jws.Webservice.targetNamespace element. Class\: {0}
+
+webserviceap.webservice.and.webserviceprovider=Classes cannot be annotated with both
@javax.jws.WebService and @javax.xml.ws.WebServiceProvider. Class\: {0}
\ No newline at end of file
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/resources/wscompile.properties
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/resources/wscompile.properties
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/resources/wscompile.properties 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,102 @@
+#
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+#
+
+wsimport.usage=Usage: {0} [options] <WSDL_URI>\n\n\
+Use "wsimport -help" for a detailed description of options.
+
+wsimport.help=\nUsage: {0} [options] <WSDL_URI>\n\n\
+\where [options] include:\n\
+\ -b <path> specify external jaxws or jaxb binding files\n\
+\ (Each <file> must have its own -b)\n\
+\ -catalog <file> specify catalog file to resolve external entity
references\n\
+\ supports TR9401, XCatalog, and OASIS XML Catalog format.\n\
+\ -d <directory> specify where to place generated output files\n\
+\ -extension allow vendor extensions - functionality not specified\n\
+\ by the specification. Use of extensions may\n\
+\ result in applications that are not portable or\n\
+\ may not interoperate with other implementations\n\
+\ -help display help\n\
+\ -httpproxy:<host>:<port> specify a HTTP proxy server (port defaults to
8080)\n\
+\ -keep keep generated files\n\
+\ -p <pkg> specifies the target package\n\
+\ -s <directory> specify where to place generated source files\n\
+\ -verbose output messages about what the compiler is doing\n\
+\ -version print version information\n\
+\ -wsdllocation <location> @WebService.wsdlLocation and
@WebServiceClient.wsdlLocation value
+
+wsimport.usage.examples=\n\
+\Examples:\n\
+\ wsimport stock.wsdl -b stock.xml -b stock.xjb\n\
+\ wsimport -d generated
http://example.org/stock?wsdl\n\
+
+
+wsgen.usage=Usage: {0} [options] <SEI>\n\n\
+Use "wsgen -help" for a detailed description of options.
+
+wsgen.help=\nUsage: {0} [options] <SEI>\n\n\
+\where [options] include:\n\
+\ -classpath <path> specify where to find input class files\n\
+\ -cp <path> same as -classpath <path>\n\
+\ -d <directory> specify where to place generated output files\n\
+\ -extension allow vendor extensions - functionality not specified\n\
+\ by the specification. Use of extensions may\n\
+\ result in applications that are not portable or\n\
+\ may not interoperate with other implementations\n\
+\ -help display help\n\
+\ -keep keep generated files\n\
+\ -r <directory> resource destination directory, specify where to\n\
+\ place resouce files such as WSDLs\n\
+\ -s <directory> specify where to place generated source files\n\
+\ -verbose output messages about what the compiler is doing\n\
+\ -version print version information\n\
+\ -wsdl[:protocol] generate a WSDL file. The protocol is optional.\n\
+\ Valid protocols are soap1.1 and Xsoap1.2, the default\n\
+\ is soap1.1. Xsoap1.2 is not standard and can only be\n\
+\ used in conjunction with the -extension option\n\
+\ -servicename <name> specify the Service name to use in the generated
WSDL\n\
+\ Used in conjunction with the -wsdl option.\n\
+\ -portname <name> specify the Port name to use in the generated
WSDL\n\
+\ Used in conjunction with the -wsdl option.
+
+wsgen.usage.examples=\n\
+\Examples:\n\
+\ wsgen -cp . example.Stock\n\
+\ wsgen -cp . example.Stock -wsdl -servicename
'{http://mynamespace}MyService'\n\
+
+
+
+#
+# Generic Messages
+#
+wscompile.invalidOption={0} is an invalid option or argument
+wscompile.error=error: {0}
+wscompile.warning=warning: {0}
+wscompile.info=info: {0}
+wscompile.duplicateOption=duplicate option: {0}
+wscompile.noSuchDirectory=directory not found: {0}
+wscompile.missingOptionArgument=option \"{0}\" requires an argument
+wscompile.compilationFailed=compilation failed, errors should have been reported
+wscompile.classmodelinfo.expected=Expected a ClassModelInfo but got a {0}.
+
+wsimport.missingFile=Missing WSDL_URI
+
+wsgen.invalid.protocol=\"{0}\" is not a supported protocol. Supported
protocols include: {1}.
+wsgen.invalid.transport=\"{0}\" is not a supported transport. Supported
transport include: {1}.
+wsgen.class.not.found=Class not found: \"{0}\"
+wsgen.could.not.create.file="Could not create file: "\{0}\"
+wsgen.missingFile=Missing SEI
+wsgen.soap12.without.extension=The optional protocol \"Xsoap1.2\" must be used
in conjunction with the \"-extension\" option.
+wsgen.wsdl.arg.no.genwsdl=The \"{0}\" option can only be in conjunction with
the "-wsdl" option.
+wsgen.servicename.missing.namespace=The service name \"{0}\" is missing a
namespace.
+wsgen.servicename.missing.localname=The service name \"{0}\" is missing a
localname.
+wsgen.portname.missing.namespace=The port name \"{0}\" is missing a namespace.
+wsgen.portname.missing.localname=The port name \"{0}\" is missing a localname.
+wsgen.class.must.be.implementation.class=The class \"{0}\" is not an endpoint
implementation class.
+wsgen.cannot.gen.wsdl.for.non.soap.binding=The -wsdl option cannot be used with non-SOAP
bindings. Class \"{0}\" binding: \"{1}\".
+wsgen.cannot.gen.wsdl.for.soap12.binding=The -wsdl option cannot be used with SOAP1.2
bindings.\n\
+Try using \"-wsdl:Xsoap1.2 -extension\".\n\
+Class \"{0}\" binding: \"{1}\".
+wsgen.cannot.gen.wsdl.for.xsoap12.binding.wo.extention=The -wsdl option cannot be used
with the SOAP1.2 extension binding without the \"-extension\" option.\n\
+Class \"{0}\" binding: \"{1}\".
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/resources/wsdl.properties
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/resources/wsdl.properties
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/resources/wsdl.properties 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,80 @@
+#
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+#
+parsing.wsdlNotDefaultNamespace=default namespace must be \"{0}\"
+parsing.onlyOneOfElementOrTypeRequired=only one of the \"element\" or
\"type\" attributes is allowed in part \"{0}\"
+parsing.elementOrTypeRequired=warning: part {0} is ignored, either the
\"element\" or the \"type\" attribute is required in part
\"{0}\"
+parsing.invalidElement=invalid element: \"{0}\" (in namespace
\"{1}\")
+parsing.invalidAttributeValue=invalid value \"{1}\" for attribute
\"{0}\"
+parsing.invalidExtensionElement=invalid extension element: \"{0}\" (in
namespace \"{1}\")
+parsing.invalidWsdlElement=invalid WSDL element: \"{0}\"
+parsing.requiredExtensibilityElement=unknown required extensibility element
\"{0}\" (in namespace \"{1}\")
+parsing.tooManyElements=too many \"{0}\" elements under \"{1}\"
element \"{2}\"
+parsing.invalidOperationStyle=operation \"{0}\" has an invalid style
+parsing.onlyOneTypesAllowed=only one "types" element allowed in
"{0}"
+parsing.onlyOneDocumentationAllowed=only one "documentation" element allowed in
"{0}"
+parsing.incorrectRootElement=expected root element \"{2}\" (in namespace
\"{3}\"), found element \"{0}\" (in namespace \"{1}\")
+parsing.unknownImportedDocumentType=imported document is of unknown type: {0}
+parsing.unknownNamespacePrefix=undeclared namespace prefix: \"{0}\"
+parsing.invalidURI=invalid URI: {0}
+parsing.ioExceptionWithSystemId=failed to parse document at \"{0}\": {1}
+parsing.ioException=parsing failed: {0}
+parsing.saxExceptionWithSystemId=invalid WSDL file! failed to parse document at
\"{0}\": {1}
+parsing.saxException=invalid WSDL file! parsing failed: {0}
+parsing.parserConfigException=invalid WSDL file! parsing failed: {0}
+parsing.factoryConfigException=invalid WSDL file! parsing failed: {0}
+
+#
+parsing.missingRequiredAttribute=missing required attribute \"{1}\" of element
\"{0}\"
+parsing.invalidTag=expected element \"{1}\", found \"{0}\"
+parsing.invalidTagNS=expected element \"{2}\" (in namespace \"{3}\"),
found element \"{0}\" (in namespace \"{1}\")
+parsing.nonWhitespaceTextFound=found unexpected non whitespace text: \"{0}\"
+parsing.elementExpected=unexpected non-element found
+#
+entity.duplicate=duplicate entity: \"{0}\"
+entity.duplicateWithType=duplicate \"{0}\" entity: \"{1}\"
+entity.notFoundByQName=invalid entity name: \"{0}\" (in namespace:
\"{1}\")
+entity.notFoundByID=invalid entity id: \"{0}\"
+#
+validation.missingRequiredAttribute=missing required attribute \"{0}\" of
element \"{1}\"
+validation.missingRequiredProperty=missing required property \"{0}\" of element
\"{1}\"
+validation.missingRequiredSubEntity=missing required sub-entity \"{0}\" of
element \"{1}\"
+validation.invalidElement=invalid element: \"{0}\"
+validation.invalidComplexTypeInElement=invalid element: \"{1}\", has named
complexType: \"{0}\"
+validation.invalidSimpleTypeInElement=invalid element: \"{1}\", has named
simpleType: \"{0}\"
+validation.duplicatedElement=duplicated element: \"{0}\"
+validation.duplicateName=duplicated part name: \"{0}\"
+validation.invalidSubEntity=invalid sub-element \"{0}\" of element
\"{1}\"
+validation.invalidAttribute=invalid attribute \"{0}\" of element
\"{1}\"
+validation.invalidAttributeValue=invalid value \"{1}\" for attribute
\"{0}\"
+validation.invalidRange=invalid range found (min: {0}, max: {1})
+validation.exclusiveAttributes=exclusive attributes: \"{0}\",
\"{1}\"
+validation.incorrectTargetNamespace=target namespace is incorrect (expected: {1}, found:
{0})
+validation.unsupportedSchemaFeature=unsupported XML Schema feature: \"{0}\"
+validation.shouldNotHappen=internal error ("{0}")
+validation.invalidToken=invalid token \"{0}\"
+validation.notSimpleType=not a simple type: \"{0}\"
+validation.ambiguousName=ambiguous operation name: \"{0}\"
+validation.invalidPrefix=undeclared namespace prefix: \"{0}\"
+
+#wsi compliant WSDL warnings
+warning.wsi.r2001=Not a WSI-BP compliant WSDL (R2001, R2002). wsdl:import must only
import WSDL document. Its trying to import: \"{0}\"
+warning.wsi.r2002=Not a WSI-BP compliant WSDL (R2002). wsdl:import must not be used to
import XML Schema embedded in the WSDL document. Expected wsdl namesapce: {0}, found: {1}
+warning.wsi.r2003=Not a WSI-BP compliant WSDL (R2003). xsd:import must only be used
inside xsd:schema element.
+warning.wsi.r2004=Not a WSI-BP compliant WSDL (R2001, R2004). xsd:import must not import
XML Schema definition emmbedded inline within WSDLDocument.
+
+#Internalizer
+internalizer.targetNotAnElement= \
+ Target node is not an element
+internalizer.targetNotFound= \
+ No target found for the wsdlLocation: {0}
+internalizer.XPathEvaluationError = \
+ XPath error: {0}
+internalizer.XPathEvaluatesToNoTarget = \
+ XPath evaluation of "{0}" results in empty target node
+internalizer.XPathEvaulatesToTooManyTargets = \
+ XPath evaluation of "{0}" results in too many ({1}) target nodes
+internalizer.XPathEvaluatesToNonElement = \
+ XPath evaluation of "{0}" needs to result in an element.
+invalid.customization.namespace=Ignoring customization: \"{0}\", it has no
namespace. It must belong to the customization namespace.
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/spi/WSToolsObjectFactory.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/spi/WSToolsObjectFactory.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/spi/WSToolsObjectFactory.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,65 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.spi;
+
+import java.io.OutputStream;
+
+import org.jboss.com.sun.tools.ws.util.WSToolsObjectFactoryImpl;
+
+
+/**
+ * Singleton abstract factory used to produce JAX-WS tools related objects.
+ *
+ * @author JAX-WS Development Team
+ */
+public abstract class WSToolsObjectFactory {
+
+ private static WSToolsObjectFactory factory;
+
+ /**
+ * Obtain an instance of a factory. Don't worry about synchronization(at the
+ * most, one more factory is created).
+ */
+ public static WSToolsObjectFactory newInstance() {
+ if (factory == null) {
+ factory = new WSToolsObjectFactoryImpl();
+ }
+ return factory;
+ }
+
+ /**
+ * Invokes wsimport on the wsdl URL argument, and generates the necessary
+ * portable artifacts like SEI, Service, Bean classes etc.
+ *
+ * @return true if there is no error, otherwise false
+ */
+ public abstract boolean wsimport(OutputStream logStream, String[] args);
+
+ /**
+ * Invokes wsgen on the endpoint implementation, and generates the necessary
+ * artifacts like wrapper, exception bean classes etc.
+ *
+ * @return true if there is no error, otherwise false
+ */
+ public abstract boolean wsgen(OutputStream logStream, String[] args);
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/spi/WSToolsObjectFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/spi/package-info.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/spi/package-info.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/spi/package-info.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,29 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+/**
+ *
+ * <P>This document describes the SPI for the JAX-WS 2.0 tools.
+ * The WSToolsObjectFactory is used to create instances of WsGen
+ * and WsImport that other applications can use.
+*/
+package org.jboss.com.sun.tools.ws.spi;
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/spi/package-info.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/ClassNameInfo.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/ClassNameInfo.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/ClassNameInfo.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,70 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.util;
+
+/**
+ * @author WS Development Team
+ */
+
+public final class ClassNameInfo {
+
+ public static String getName(String className) {
+ String qual = getQualifier(className);
+ int len = className.length();
+ int closingBracket = className.indexOf('>');
+ if(closingBracket > 0)
+ len = closingBracket;
+ return qual != null
+ ? className.substring(qual.length() + 1, len)
+ : className;
+ }
+
+
+ /**
+ *
+ *
+ * @param className Generic class, such as java.util.List<java.lang.String>
+ * @return the generic class, such as java.util.List
+ */
+ public static String getGenericClass(String className) {
+ int index = className.indexOf('<');
+ if(index < 0)
+ return className;
+ return (index > 0)?className.substring(0, index):className;
+ }
+
+
+ public static String getQualifier(String className) {
+ int idot = className.indexOf(' ');
+ if (idot <= 0)
+ idot = className.length();
+ else
+ idot -= 1; // back up over previous dot
+ int index = className.lastIndexOf('.', idot - 1);
+ return (index < 0) ? null : className.substring(0, index);
+ }
+
+ public static String replaceInnerClassSym(String name) {
+ return name.replace('$', '_');
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/ClassNameInfo.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/ForkEntityResolver.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/ForkEntityResolver.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/ForkEntityResolver.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,51 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.util;
+
+import java.io.IOException;
+
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/**
+ * {@link EntityResolver} that delegates to two {@link EntityResolver}s.
+ *
+ * @author WS Development Team
+ */
+public class ForkEntityResolver implements EntityResolver {
+ private final EntityResolver lhs;
+ private final EntityResolver rhs;
+
+ public ForkEntityResolver(EntityResolver lhs, EntityResolver rhs) {
+ this.lhs = lhs;
+ this.rhs = rhs;
+ }
+
+ public InputSource resolveEntity(String publicId, String systemId) throws
SAXException, IOException {
+ InputSource is = lhs.resolveEntity(publicId, systemId);
+ if(is!=null)
+ return is;
+ return rhs.resolveEntity(systemId,systemId);
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/ForkEntityResolver.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/JAXWSClassFactory.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/JAXWSClassFactory.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/JAXWSClassFactory.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,103 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.util;
+
+import java.util.Properties;
+
+import org.jboss.com.sun.tools.ws.processor.config.WSDLModelInfo;
+import org.jboss.com.sun.tools.ws.processor.generator.Names;
+import org.jboss.com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler;
+import org.jboss.com.sun.tools.ws.processor.modeler.wsdl.WSDLModelerBase;
+import org.jboss.com.sun.tools.ws.wsdl.framework.AbstractDocument;
+import org.jboss.com.sun.xml.ws.util.VersionUtil;
+
+
+/**
+ * Singleton factory class to instantiate concrete classes based on the jaxws version
+ * to be used to generate the code.
+ *
+ * @author WS Development Team
+ */
+public class JAXWSClassFactory {
+ private static final JAXWSClassFactory factory = new JAXWSClassFactory();
+
+ private static String classVersion = VersionUtil.JAXWS_VERSION_DEFAULT;
+
+ private JAXWSClassFactory() {
+ }
+
+ /**
+ * Get the factory instance for the default version.
+ * @return JAXWSClassFactory instance
+ */
+ public static JAXWSClassFactory newInstance() {
+ return factory;
+ }
+
+ /**
+ * Sets the version to a static classVersion
+ * @param version
+ */
+ public void setSourceVersion(String version) {
+ if (version == null)
+ version = VersionUtil.JAXWS_VERSION_DEFAULT;
+
+ if (!VersionUtil.isValidVersion(version)) {
+ // TODO: throw exception
+ } else
+ classVersion = version;
+ }
+
+ /**
+ * Returns the WSDLModeler for specific target version.
+ *
+ * @param modelInfo
+ * @param options
+ * @return the WSDLModeler for specific target version.
+ */
+ public WSDLModelerBase createWSDLModeler(
+ WSDLModelInfo modelInfo,
+ Properties options) {
+ WSDLModelerBase wsdlModeler = null;
+ if (classVersion.equals(VersionUtil.JAXWS_VERSION_20))
+ wsdlModeler = new WSDLModeler(modelInfo, options);
+ else {
+ // TODO: throw exception
+ }
+ return wsdlModeler;
+ }
+
+ /**
+ * Returns the Names for specific target version.
+ * //bug fix:4904604
+ * @return instance of Names
+ */
+ public Names createNames() {
+ Names names = new Names();
+ return names;
+ }
+
+ public String getVersion() {
+ return classVersion;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/JAXWSClassFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/JavaCompilerHelper.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/JavaCompilerHelper.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/JavaCompilerHelper.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,174 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.util;
+
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.jboss.com.sun.xml.ws.util.localization.Localizable;
+
+
+/**
+ * A helper class to invoke javac.
+ *
+ * @author WS Development Team
+ */
+public class JavaCompilerHelper extends ToolBase {
+
+ public JavaCompilerHelper(OutputStream out) {
+ super(out, " ");
+ this.out = out;
+ }
+
+ public boolean compile(String[] args) {
+ return internalCompile(args);
+ }
+
+ protected String getResourceBundleName() {
+ return "org.jboss.com.sun.tools.ws.resources.javacompiler";
+ }
+
+ protected boolean internalCompile(String[] args) {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ Class comSunToolsJavacMainClass = null;
+ try {
+ /* try to use the new compiler */
+ comSunToolsJavacMainClass =
+ cl.loadClass("com.sun.tools.javac.Main");
+ try {
+ Method compileMethod =
+ comSunToolsJavacMainClass.getMethod(
+ "compile",
+ compile141MethodSignature);
+ try {
+ Object result =
+ compileMethod.invoke(
+ null,
+ new Object[] { args, new PrintWriter(out)});
+ if (!(result instanceof Integer)) {
+ return false;
+ }
+ return ((Integer) result).intValue() == 0;
+ } catch (IllegalAccessException e3) {
+ return false;
+ } catch (IllegalArgumentException e3) {
+ return false;
+ } catch (InvocationTargetException e3) {
+ return false;
+ }
+ } catch (NoSuchMethodException e2) {
+ //tryout 1.3.1 signature
+ return internalCompilePre141(args);
+ //onError(getMessage("javacompiler.nosuchmethod.error",
"getMethod(\"compile\", compile141MethodSignature)"));
+ //return false;
+ }
+ } catch (ClassNotFoundException e) {
+ onError(
+ getMessage(
+ "javacompiler.classpath.error",
+ "com.sun.tools.javac.Main"));
+ return false;
+ } catch (SecurityException e) {
+ return false;
+ }
+ }
+
+ protected boolean internalCompilePre141(String[] args) {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ try {
+ Class sunToolsJavacMainClass =
cl.loadClass("sun.tools.javac.Main");
+ try {
+ Constructor constructor =
+
sunToolsJavacMainClass.getConstructor(constructorSignature);
+ try {
+ Object javacMain =
+ constructor.newInstance(new Object[] { out,
"javac" });
+ Method compileMethod =
+ sunToolsJavacMainClass.getMethod(
+ "compile",
+ compileMethodSignature);
+ Object result =
+ compileMethod.invoke(javacMain, new Object[]
{ args });
+ if (!(result instanceof Boolean)) {
+ return false;
+ }
+ return ((Boolean) result).booleanValue();
+ } catch (InstantiationException e4) {
+ return false;
+ } catch (IllegalAccessException e4) {
+ return false;
+ } catch (IllegalArgumentException e4) {
+ return false;
+ } catch (InvocationTargetException e4) {
+ return false;
+ }
+
+ } catch (NoSuchMethodException e3) {
+ onError(
+ getMessage(
+ "javacompiler.nosuchmethod.error",
+ "getMethod(\"compile\",
compileMethodSignature)"));
+ return false;
+ }
+ } catch (ClassNotFoundException e2) {
+ return false;
+ }
+ }
+
+ protected String getGenericErrorMessage() {
+ return "javacompiler.error";
+ }
+
+ protected void run() {
+ }
+
+ protected boolean parseArguments(String[] args) {
+ return false;
+ }
+
+ public void onError(Localizable msg) {
+ report(getMessage("javacompiler.error", localizer.localize(msg)));
+ }
+
+ protected OutputStream out;
+
+ protected static final Class[] compile141MethodSignature;
+ protected static final Class[] constructorSignature;
+ protected static final Class[] compileMethodSignature;
+
+ static {
+ compile141MethodSignature = new Class[2];
+ compile141MethodSignature[0] = (new String[0]).getClass();
+ compile141MethodSignature[1] = PrintWriter.class;
+ //jdk version < 1.4.1 signature
+ constructorSignature = new Class[2];
+ constructorSignature[0] = OutputStream.class;
+ constructorSignature[1] = String.class;
+ compileMethodSignature = new Class[1];
+ compileMethodSignature[0] = compile141MethodSignature[0]; // String[]
+
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/JavaCompilerHelper.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/MapBase.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/MapBase.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/MapBase.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,689 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.util;
+
+import java.util.AbstractCollection;
+import java.util.AbstractSet;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+/*
+ * This class was lifted from JDK 1.4 (where it's called java.util.AbstractMap)
+ * so that we can use it on 1.3.1.
+ *
+ * @author WS Development Team
+ */
+
+/**
+ * This class provides a skeletal implementation of the <tt>Map</tt>
+ * interface, to minimize the effort required to implement this interface. <p>
+ *
+ * To implement an unmodifiable map, the programmer needs only to extend this
+ * class and provide an implementation for the <tt>entrySet</tt> method,
which
+ * returns a set-view of the map's mappings. Typically, the returned set
+ * will, in turn, be implemented atop <tt>AbstractSet</tt>. This set should
+ * not support the <tt>add</tt> or <tt>remove</tt> methods, and
its iterator
+ * should not support the <tt>remove</tt> method.<p>
+ *
+ * To implement a modifiable map, the programmer must additionally override
+ * this class's <tt>put</tt> method (which otherwise throws an
+ * <tt>UnsupportedOperationException</tt>), and the iterator returned by
+ * <tt>entrySet().iterator()</tt> must additionally implement its
+ * <tt>remove</tt> method.<p>
+ *
+ * The programmer should generally provide a void (no argument) and map
+ * constructor, as per the recommendation in the <tt>Map</tt> interface
+ * specification.<p>
+ *
+ * The documentation for each non-abstract methods in this class describes its
+ * implementation in detail. Each of these methods may be overridden if the
+ * map being implemented admits a more efficient implementation.
+ *
+ * @author Josh Bloch
+ * @version 1.32, 12/03/01
+ * @see Map
+ * @see Collection
+ * @since 1.2
+ */
+
+public abstract class MapBase implements Map {
+ /**
+ * Sole constructor. (For invocation by subclass constructors, typically
+ * implicit.)
+ */
+ protected MapBase() {
+ }
+
+ // Query Operations
+
+ /**
+ * Returns the number of key-value mappings in this map. If the map
+ * contains more than <tt>Integer.MAX_VALUE</tt> elements, returns
+ * <tt>Integer.MAX_VALUE</tt>.<p>
+ *
+ * This implementation returns <tt>entrySet().size()</tt>.
+ *
+ * @return the number of key-value mappings in this map.
+ */
+ public int size() {
+ return entrySet().size();
+ }
+
+ /**
+ * Returns <tt>true</tt> if this map contains no key-value mappings.
<p>
+ *
+ * This implementation returns <tt>size() == 0</tt>.
+ *
+ * @return <tt>true</tt> if this map contains no key-value mappings.
+ */
+ public boolean isEmpty() {
+ return size() == 0;
+ }
+
+ /**
+ * Returns <tt>true</tt> if this map maps one or more keys to this
value.
+ * More formally, returns <tt>true</tt> if and only if this map contains
+ * at least one mapping to a value <tt>v</tt> such that
<tt>(value==null ?
+ * v==null : value.equals(v))</tt>. This operation will probably require
+ * time linear in the map size for most implementations of map.<p>
+ *
+ * This implementation iterates over entrySet() searching for an entry
+ * with the specified value. If such an entry is found, <tt>true</tt>
is
+ * returned. If the iteration terminates without finding such an entry,
+ * <tt>false</tt> is returned. Note that this implementation requires
+ * linear time in the size of the map.
+ *
+ * @param value value whose presence in this map is to be tested.
+ *
+ * @return <tt>true</tt> if this map maps one or more keys to this
value.
+ */
+ public boolean containsValue(Object value) {
+ Iterator i = entrySet().iterator();
+ if (value == null) {
+ while (i.hasNext()) {
+ Entry e = (Entry) i.next();
+ if (e.getValue() == null)
+ return true;
+ }
+ } else {
+ while (i.hasNext()) {
+ Entry e = (Entry) i.next();
+ if (value.equals(e.getValue()))
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Returns <tt>true</tt> if this map contains a mapping for the
specified
+ * key. <p>
+ *
+ * This implementation iterates over <tt>entrySet()</tt> searching for
an
+ * entry with the specified key. If such an entry is found,
<tt>true</tt>
+ * is returned. If the iteration terminates without finding such an
+ * entry, <tt>false</tt> is returned. Note that this implementation
+ * requires linear time in the size of the map; many implementations will
+ * override this method.
+ *
+ * @param key key whose presence in this map is to be tested.
+ * @return <tt>true</tt> if this map contains a mapping for the
specified
+ * key.
+ *
+ * @throws NullPointerException key is <tt>null</tt> and this map does
not
+ * not permit <tt>null</tt> keys.
+ */
+ public boolean containsKey(Object key) {
+ Iterator i = entrySet().iterator();
+ if (key == null) {
+ while (i.hasNext()) {
+ Entry e = (Entry) i.next();
+ if (e.getKey() == null)
+ return true;
+ }
+ } else {
+ while (i.hasNext()) {
+ Entry e = (Entry) i.next();
+ if (key.equals(e.getKey()))
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Returns the value to which this map maps the specified key. Returns
+ * <tt>null</tt> if the map contains no mapping for this key. A return
+ * value of <tt>null</tt> does not <i>necessarily</i>
indicate that the
+ * map contains no mapping for the key; it's also possible that the map
+ * explicitly maps the key to <tt>null</tt>. The containsKey operation
+ * may be used to distinguish these two cases. <p>
+ *
+ * This implementation iterates over <tt>entrySet()</tt> searching for
an
+ * entry with the specified key. If such an entry is found, the entry's
+ * value is returned. If the iteration terminates without finding such an
+ * entry, <tt>null</tt> is returned. Note that this implementation
+ * requires linear time in the size of the map; many implementations will
+ * override this method.
+ *
+ * @param key key whose associated value is to be returned.
+ * @return the value to which this map maps the specified key.
+ *
+ * @throws NullPointerException if the key is <tt>null</tt> and this map
+ * does not not permit <tt>null</tt> keys.
+ *
+ * @see #containsKey(Object)
+ */
+ public Object get(Object key) {
+ Iterator i = entrySet().iterator();
+ if (key == null) {
+ while (i.hasNext()) {
+ Entry e = (Entry) i.next();
+ if (e.getKey() == null)
+ return e.getValue();
+ }
+ } else {
+ while (i.hasNext()) {
+ Entry e = (Entry) i.next();
+ if (key.equals(e.getKey()))
+ return e.getValue();
+ }
+ }
+ return null;
+ }
+
+ // Modification Operations
+
+ /**
+ * Associates the specified value with the specified key in this map
+ * (optional operation). If the map previously contained a mapping for
+ * this key, the old value is replaced.<p>
+ *
+ * This implementation always throws an
+ * <tt>UnsupportedOperationException</tt>.
+ *
+ * @param key key with which the specified value is to be associated.
+ * @param value value to be associated with the specified key.
+ *
+ * @return previous value associated with specified key, or
<tt>null</tt>
+ * if there was no mapping for key. (A <tt>null</tt> return can
+ * also indicate that the map previously associated
<tt>null</tt>
+ * with the specified key, if the implementation supports
+ * <tt>null</tt> values.)
+ *
+ * @throws UnsupportedOperationException if the <tt>put</tt> operation
is
+ * not supported by this map.
+ *
+ * @throws ClassCastException if the class of the specified key or value
+ * prevents it from being stored in this map.
+ *
+ * @throws IllegalArgumentException if some aspect of this key or value *
+ * prevents it from being stored in this map.
+ *
+ * @throws NullPointerException this map does not permit <tt>null</tt>
+ * keys or values, and the specified key or value is
+ * <tt>null</tt>.
+ */
+ public Object put(Object key, Object value) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Removes the mapping for this key from this map if present (optional
+ * operation). <p>
+ *
+ * This implementation iterates over <tt>entrySet()</tt> searching for
an
+ * entry with the specified key. If such an entry is found, its value is
+ * obtained with its <tt>getValue</tt> operation, the entry is is
removed
+ * from the Collection (and the backing map) with the iterator's
+ * <tt>remove</tt> operation, and the saved value is returned. If the
+ * iteration terminates without finding such an entry, <tt>null</tt> is
+ * returned. Note that this implementation requires linear time in the
+ * size of the map; many implementations will override this method.<p>
+ *
+ * Note that this implementation throws an
+ * <tt>UnsupportedOperationException</tt> if the
<tt>entrySet</tt> iterator
+ * does not support the <tt>remove</tt> method and this map contains a
+ * mapping for the specified key.
+ *
+ * @param key key whose mapping is to be removed from the map.
+ * @return previous value associated with specified key, or
<tt>null</tt>
+ * if there was no entry for key. (A <tt>null</tt> return can
+ * also indicate that the map previously associated
<tt>null</tt>
+ * with the specified key, if the implementation supports
+ * <tt>null</tt> values.)
+ * @throws UnsupportedOperationException if the <tt>remove</tt>
operation
+ * is not supported by this map.
+ */
+ public Object remove(Object key) {
+ Iterator i = entrySet().iterator();
+ Entry correctEntry = null;
+ if (key == null) {
+ while (correctEntry == null && i.hasNext()) {
+ Entry e = (Entry) i.next();
+ if (e.getKey() == null)
+ correctEntry = e;
+ }
+ } else {
+ while (correctEntry == null && i.hasNext()) {
+ Entry e = (Entry) i.next();
+ if (key.equals(e.getKey()))
+ correctEntry = e;
+ }
+ }
+
+ Object oldValue = null;
+ if (correctEntry != null) {
+ oldValue = correctEntry.getValue();
+ i.remove();
+ }
+ return oldValue;
+ }
+
+ // Bulk Operations
+
+ /**
+ * Copies all of the mappings from the specified map to this map
+ * (optional operation). These mappings will replace any mappings that
+ * this map had for any of the keys currently in the specified map.<p>
+ *
+ * This implementation iterates over the specified map's
+ * <tt>entrySet()</tt> collection, and calls this map's
<tt>put</tt>
+ * operation once for each entry returned by the iteration.<p>
+ *
+ * Note that this implementation throws an
+ * <tt>UnsupportedOperationException</tt> if this map does not support
+ * the <tt>put</tt> operation and the specified map is nonempty.
+ *
+ * @param t mappings to be stored in this map.
+ *
+ * @throws UnsupportedOperationException if the <tt>putAll</tt>
operation
+ * is not supported by this map.
+ *
+ * @throws ClassCastException if the class of a key or value in the
+ * specified map prevents it from being stored in this map.
+ *
+ * @throws IllegalArgumentException if some aspect of a key or value in
+ * the specified map prevents it from being stored in this map.
+ * @throws NullPointerException the specified map is <tt>null</tt>, or
if
+ * this map does not permit <tt>null</tt> keys or values, and
the
+ * specified map contains <tt>null</tt> keys or values.
+ */
+ public void putAll(Map t) {
+ Iterator i = t.entrySet().iterator();
+ while (i.hasNext()) {
+ Entry e = (Entry) i.next();
+ put(e.getKey(), e.getValue());
+ }
+ }
+
+ /**
+ * Removes all mappings from this map (optional operation). <p>
+ *
+ * This implementation calls <tt>entrySet().clear()</tt>.
+ *
+ * Note that this implementation throws an
+ * <tt>UnsupportedOperationException</tt> if the
<tt>entrySet</tt>
+ * does not support the <tt>clear</tt> operation.
+ *
+ * @throws UnsupportedOperationException clear is not supported
+ * by this map.
+ */
+ public void clear() {
+ entrySet().clear();
+ }
+
+ // Views
+
+ /**
+ * Each of these fields are initialized to contain an instance of the
+ * appropriate view the first time this view is requested. The views are
+ * stateless, so there's no reason to create more than one of each.
+ */
+ transient volatile Set keySet = null;
+ transient volatile Collection values = null;
+
+ /**
+ * Returns a Set view of the keys contained in this map. The Set is
+ * backed by the map, so changes to the map are reflected in the Set,
+ * and vice-versa. (If the map is modified while an iteration over
+ * the Set is in progress, the results of the iteration are undefined.)
+ * The Set supports element removal, which removes the corresponding entry
+ * from the map, via the Iterator.remove, Set.remove, removeAll
+ * retainAll, and clear operations. It does not support the add or
+ * addAll operations.<p>
+ *
+ * This implementation returns a Set that subclasses
+ * AbstractSet. The subclass's iterator method returns a "wrapper
+ * object" over this map's entrySet() iterator. The size method delegates
+ * to this map's size method and the contains method delegates to this
+ * map's containsKey method.<p>
+ *
+ * The Set is created the first time this method is called,
+ * and returned in response to all subsequent calls. No synchronization
+ * is performed, so there is a slight chance that multiple calls to this
+ * method will not all return the same Set.
+ *
+ * @return a Set view of the keys contained in this map.
+ */
+ public Set keySet() {
+ if (keySet == null) {
+ keySet = new AbstractSet() {
+ public Iterator iterator() {
+ return new Iterator() {
+ private Iterator i = entrySet().iterator();
+
+ public boolean hasNext() {
+ return i.hasNext();
+ }
+
+ public Object next() {
+ return ((Entry) i.next()).getKey();
+ }
+
+ public void remove() {
+ i.remove();
+ }
+ };
+ }
+
+ public int size() {
+ return MapBase.this.size();
+ }
+
+ public boolean contains(Object k) {
+ return MapBase.this.containsKey(k);
+ }
+ };
+ }
+ return keySet;
+ }
+
+ /**
+ * Returns a collection view of the values contained in this map. The
+ * collection is backed by the map, so changes to the map are reflected in
+ * the collection, and vice-versa. (If the map is modified while an
+ * iteration over the collection is in progress, the results of the
+ * iteration are undefined.) The collection supports element removal,
+ * which removes the corresponding entry from the map, via the
+ * <tt>Iterator.remove</tt>, <tt>Collection.remove</tt>,
+ * <tt>removeAll</tt>, <tt>retainAll</tt> and
<tt>clear</tt> operations.
+ * It does not support the <tt>add</tt> or <tt>addAll</tt>
operations.<p>
+ *
+ * This implementation returns a collection that subclasses abstract
+ * collection. The subclass's iterator method returns a "wrapper
object"
+ * over this map's <tt>entrySet()</tt> iterator. The size method
+ * delegates to this map's size method and the contains method delegates
+ * to this map's containsValue method.<p>
+ *
+ * The collection is created the first time this method is called, and
+ * returned in response to all subsequent calls. No synchronization is
+ * performed, so there is a slight chance that multiple calls to this
+ * method will not all return the same Collection.
+ *
+ * @return a collection view of the values contained in this map.
+ */
+ public Collection values() {
+ if (values == null) {
+ values = new AbstractCollection() {
+ public Iterator iterator() {
+ return new Iterator() {
+ private Iterator i = entrySet().iterator();
+
+ public boolean hasNext() {
+ return i.hasNext();
+ }
+
+ public Object next() {
+ return ((Entry) i.next()).getValue();
+ }
+
+ public void remove() {
+ i.remove();
+ }
+ };
+ }
+
+ public int size() {
+ return MapBase.this.size();
+ }
+
+ public boolean contains(Object v) {
+ return MapBase.this.containsValue(v);
+ }
+ };
+ }
+ return values;
+ }
+
+ /**
+ * Returns a set view of the mappings contained in this map. Each element
+ * in this set is a Map.Entry. The set is backed by the map, so changes
+ * to the map are reflected in the set, and vice-versa. (If the map is
+ * modified while an iteration over the set is in progress, the results of
+ * the iteration are undefined.) The set supports element removal, which
+ * removes the corresponding entry from the map, via the
+ * <tt>Iterator.remove</tt>, <tt>Set.remove</tt>,
<tt>removeAll</tt>,
+ * <tt>retainAll</tt> and <tt>clear</tt> operations. It does
not support
+ * the <tt>add</tt> or <tt>addAll</tt> operations.
+ *
+ * @return a set view of the mappings contained in this map.
+ */
+ public abstract Set entrySet();
+
+ // Comparison and hashing
+
+ /**
+ * Compares the specified object with this map for equality. Returns
+ * <tt>true</tt> if the given object is also a map and the two maps
+ * represent the same mappings. More formally, two maps <tt>t1</tt> and
+ * <tt>t2</tt> represent the same mappings if
+ * <tt>t1.keySet().equals(t2.keySet())</tt> and for every key
<tt>k</tt>
+ * in <tt>t1.keySet()</tt>, <tt> (t1.get(k)==null ? t2.get(k)==null
:
+ * t1.get(k).equals(t2.get(k))) </tt>. This ensures that the
+ * <tt>equals</tt> method works properly across different
implementations
+ * of the map interface.<p>
+ *
+ * This implementation first checks if the specified object is this map;
+ * if so it returns <tt>true</tt>. Then, it checks if the specified
+ * object is a map whose size is identical to the size of this set; if
+ * not, it it returns <tt>false</tt>. If so, it iterates over this
map's
+ * <tt>entrySet</tt> collection, and checks that the specified map
+ * contains each mapping that this map contains. If the specified map
+ * fails to contain such a mapping, <tt>false</tt> is returned. If the
+ * iteration completes, <tt>true</tt> is returned.
+ *
+ * @param o object to be compared for equality with this map.
+ * @return <tt>true</tt> if the specified object is equal to this map.
+ */
+ public boolean equals(Object o) {
+ if (o == this)
+ return true;
+
+ if (!(o instanceof Map))
+ return false;
+ Map t = (Map) o;
+ if (t.size() != size())
+ return false;
+
+ try {
+ Iterator i = entrySet().iterator();
+ while (i.hasNext()) {
+ Entry e = (Entry) i.next();
+ Object key = e.getKey();
+ Object value = e.getValue();
+ if (value == null) {
+ if (!(t.get(key) == null && t.containsKey(key)))
+ return false;
+ } else {
+ if (!value.equals(t.get(key)))
+ return false;
+ }
+ }
+ } catch (ClassCastException unused) {
+ return false;
+ } catch (NullPointerException unused) {
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Returns the hash code value for this map. The hash code of a map is
+ * defined to be the sum of the hash codes of each entry in the map's
+ * <tt>entrySet()</tt> view. This ensures that
<tt>t1.equals(t2)</tt>
+ * implies that <tt>t1.hashCode()==t2.hashCode()</tt> for any two maps
+ * <tt>t1</tt> and <tt>t2</tt>, as required by the general
contract of
+ * Object.hashCode.<p>
+ *
+ * This implementation iterates over <tt>entrySet()</tt>, calling
+ * <tt>hashCode</tt> on each element (entry) in the Collection, and
adding
+ * up the results.
+ *
+ * @return the hash code value for this map.
+ * @see java.util.Map.Entry#hashCode()
+ * @see Object#hashCode()
+ * @see Object#equals(Object)
+ * @see Set#equals(Object)
+ */
+ public int hashCode() {
+ int h = 0;
+ Iterator i = entrySet().iterator();
+ while (i.hasNext())
+ h += i.next().hashCode();
+ return h;
+ }
+
+ /**
+ * Returns a string representation of this map. The string representation
+ * consists of a list of key-value mappings in the order returned by the
+ * map's <tt>entrySet</tt> view's iterator, enclosed in braces
+ * (<tt>"{}"</tt>). Adjacent mappings are separated by the
characters
+ * <tt>", "</tt> (comma and space). Each key-value mapping is
rendered as
+ * the key followed by an equals sign (<tt>"="</tt>) followed
by the
+ * associated value. Keys and values are converted to strings as by
+ * <tt>String.valueOf(Object)</tt>.<p>
+ *
+ * This implementation creates an empty string buffer, appends a left
+ * brace, and iterates over the map's <tt>entrySet</tt> view,
appending
+ * the string representation of each <tt>map.entry</tt> in turn. After
+ * appending each entry except the last, the string <tt>",
"</tt> is
+ * appended. Finally a right brace is appended. A string is obtained
+ * from the stringbuffer, and returned.
+ *
+ * @return a String representation of this map.
+ */
+ public String toString() {
+ StringBuffer buf = new StringBuffer();
+ buf.append("{");
+
+ Iterator i = entrySet().iterator();
+ boolean hasNext = i.hasNext();
+ while (hasNext) {
+ Entry e = (Entry) (i.next());
+ Object key = e.getKey();
+ Object value = e.getValue();
+ buf.append(
+ (key == this ? "(this Map)" : key)
+ + "="
+ + (value == this ? "(this Map)" : value));
+
+ hasNext = i.hasNext();
+ if (hasNext)
+ buf.append(", ");
+ }
+
+ buf.append("}");
+ return buf.toString();
+ }
+
+ /**
+ * Returns a shallow copy of this <tt>MapBase</tt> instance: the keys
+ * and values themselves are not cloned.
+ *
+ * @return a shallow copy of this map.
+ */
+ protected Object clone() throws CloneNotSupportedException {
+ MapBase result = (MapBase) super.clone();
+ result.keySet = null;
+ result.values = null;
+ return result;
+ }
+
+ /**
+ * This should be made public as soon as possible. It greately simplifies
+ * the task of implementing Map.
+ */
+ static class SimpleEntry implements Entry {
+ Object key;
+ Object value;
+
+ public SimpleEntry(Object key, Object value) {
+ this.key = key;
+ this.value = value;
+ }
+
+ public SimpleEntry(Map.Entry e) {
+ this.key = e.getKey();
+ this.value = e.getValue();
+ }
+
+ public Object getKey() {
+ return key;
+ }
+
+ public Object getValue() {
+ return value;
+ }
+
+ public Object setValue(Object value) {
+ Object oldValue = this.value;
+ this.value = value;
+ return oldValue;
+ }
+
+ public boolean equals(Object o) {
+ if (!(o instanceof Map.Entry))
+ return false;
+ Map.Entry e = (Map.Entry) o;
+ return eq(key, e.getKey()) && eq(value, e.getValue());
+ }
+
+ public int hashCode() {
+ Object v;
+ return ((key == null) ? 0 : key.hashCode())
+ ^ ((value == null) ? 0 : value.hashCode());
+ }
+
+ public String toString() {
+ return key + "=" + value;
+ }
+
+ private static boolean eq(Object o1, Object o2) {
+ return (o1 == null ? o2 == null : o1.equals(o2));
+ }
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/MapBase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/ToolBase.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/ToolBase.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/ToolBase.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,140 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.util;
+
+import java.io.OutputStream;
+import java.io.PrintStream;
+
+import org.jboss.com.sun.xml.ws.util.localization.Localizable;
+import org.jboss.com.sun.xml.ws.util.localization.LocalizableMessageFactory;
+import org.jboss.com.sun.xml.ws.util.localization.Localizer;
+
+
+/**
+ * A base class for command-line tools.
+ *
+ * @author WS Development Team
+ */
+public abstract class ToolBase {
+
+ public ToolBase(OutputStream out, String program) {
+ this.out = out;
+ this.program = program;
+ initialize();
+ }
+
+ protected void initialize() {
+ messageFactory = new LocalizableMessageFactory(getResourceBundleName());
+ localizer = new Localizer();
+ }
+
+ public boolean run(String[] args) {
+ if (!parseArguments(args)) {
+ return false;
+ }
+
+ try {
+ run();
+ return wasSuccessful();
+ } catch (Exception e) {
+ if (e instanceof Localizable) {
+ report((Localizable) e);
+ } else {
+ report(getMessage(getGenericErrorMessage(), e.toString()));
+ }
+ printStackTrace(e);
+ return false;
+ }
+ }
+
+ public boolean wasSuccessful() {
+ return true;
+ }
+
+ protected abstract boolean parseArguments(String[] args);
+ protected abstract void run() throws Exception;
+ public void runProcessorActions() {}
+ protected abstract String getGenericErrorMessage();
+ protected abstract String getResourceBundleName();
+
+ public void printStackTrace(Throwable t) {
+ PrintStream outstream =
+ out instanceof PrintStream
+ ? (PrintStream) out
+ : new PrintStream(out, true);
+ t.printStackTrace(outstream);
+ outstream.flush();
+ }
+
+ protected void report(String msg) {
+ PrintStream outstream =
+ out instanceof PrintStream
+ ? (PrintStream) out
+ : new PrintStream(out, true);
+ outstream.println(msg);
+ outstream.flush();
+ }
+
+ protected void report(Localizable msg) {
+ report(localizer.localize(msg));
+ }
+
+ public Localizable getMessage(String key) {
+ return getMessage(key, (Object[]) null);
+ }
+
+ public Localizable getMessage(String key, String arg) {
+ return messageFactory.getMessage(key, new Object[] { arg });
+ }
+
+ public Localizable getMessage(String key, String arg1, String arg2) {
+ return messageFactory.getMessage(key, new Object[] { arg1, arg2 });
+ }
+
+ public Localizable getMessage(
+ String key,
+ String arg1,
+ String arg2,
+ String arg3) {
+ return messageFactory.getMessage(
+ key,
+ new Object[] { arg1, arg2, arg3 });
+ }
+
+ public Localizable getMessage(String key, Localizable localizable) {
+ return messageFactory.getMessage(key, new Object[] { localizable });
+ }
+
+ public Localizable getMessage(String key, Object[] args) {
+ return messageFactory.getMessage(key, args);
+ }
+
+ protected OutputStream out;
+ protected String program;
+ protected Localizer localizer;
+ protected LocalizableMessageFactory messageFactory;
+
+ protected final static String TRUE = "true";
+ protected final static String FALSE = "false";
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/ToolBase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/WSDLParseException.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/WSDLParseException.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/WSDLParseException.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,44 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.util;
+
+import org.jboss.com.sun.xml.ws.util.exception.JAXWSExceptionBase;
+import org.jboss.com.sun.xml.ws.util.localization.Localizable;
+
+/**
+ * @author WS Development Team
+ */
+public class WSDLParseException extends JAXWSExceptionBase {
+
+ public WSDLParseException(String key, Object... args) {
+ super(key, args);
+ }
+
+ public WSDLParseException(Throwable throwable) {
+ super(throwable);
+ }
+
+ public String getResourceBundleName() {
+ return "org.jboss.com.sun.tools.ws.resources.util";
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/WSDLParseException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/WSToolsObjectFactoryImpl.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/WSToolsObjectFactoryImpl.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/WSToolsObjectFactoryImpl.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,47 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.util;
+
+import java.io.OutputStream;
+
+import org.jboss.com.sun.tools.ws.spi.WSToolsObjectFactory;
+import org.jboss.com.sun.tools.ws.wscompile.CompileTool;
+
+/**
+ * Factory implementation class to instantiate concrete objects for JAX-WS tools.
+ *
+ * @author JAX-WS Development Team
+ */
+public class WSToolsObjectFactoryImpl extends WSToolsObjectFactory {
+
+ @Override
+ public boolean wsimport(OutputStream logStream, String[] args) {
+ CompileTool tool = new CompileTool(logStream, "wsimport");
+ return tool.run(args);
+ }
+
+ @Override
+ public boolean wsgen(OutputStream logStream, String[] args) {
+ CompileTool tool = new CompileTool(logStream, "wsgen");
+ return tool.run(args);
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/WSToolsObjectFactoryImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/xml/NodeListIterator.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/xml/NodeListIterator.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/xml/NodeListIterator.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,61 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.util.xml;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+import org.w3c.dom.NodeList;
+
+/**
+ * @author WS Development Team
+ */
+public class NodeListIterator implements Iterator {
+
+ protected NodeList _list;
+ protected int _index;
+
+ public NodeListIterator(NodeList list) {
+ _list = list;
+ _index = 0;
+ }
+
+ public boolean hasNext() {
+ if (_list == null)
+ return false;
+ return _index < _list.getLength();
+ }
+
+ public Object next() throws NoSuchElementException {
+ if (_list.getLength() == 0)
+ throw new NoSuchElementException();
+ Object obj = _list.item(_index);
+ if (obj != null)
+ ++_index;
+ return obj;
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/xml/NodeListIterator.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/xml/NullEntityResolver.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/xml/NullEntityResolver.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/xml/NullEntityResolver.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,42 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.util.xml;
+
+import java.io.StringReader;
+
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+
+/**
+ * @author WS Development Team
+ */
+public class NullEntityResolver implements EntityResolver {
+
+ public NullEntityResolver() {
+ }
+
+ public InputSource resolveEntity(String publicId, String systemId) {
+ // always resolve to an empty document
+ return new InputSource(new StringReader(""));
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/xml/NullEntityResolver.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/xml/PrettyPrintingXmlWriter.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/xml/PrettyPrintingXmlWriter.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/xml/PrettyPrintingXmlWriter.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,644 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.util.xml;
+
+import java.io.BufferedWriter;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.UnsupportedEncodingException;
+
+import org.jboss.com.sun.xml.ws.util.xml.CDATA;
+
+
+// ## Delay IOExceptions until flush or close
+// ## Need DOM, SAX output
+
+/**
+ * A writer of XML output streams.
+ *
+ * <p> An XML writer knows hardly anything about XML document well-formedness,
+ * to say nothing of validity. It relies upon the invoker to ensure that the
+ * generated document is well-formed and, if required, valid.
+ *
+ *
+ * @author WS Development Team
+ */
+
+public class PrettyPrintingXmlWriter {
+
+ private static final boolean shouldPrettyprint = true;
+
+ private BufferedWriter out;
+
+ private PrettyPrintingXmlWriter(OutputStreamWriter w, boolean declare)
+ throws IOException {
+ // XXX-NOTE - set the buffer size to 1024 here
+ this.out = new BufferedWriter(w, 1024);
+ String enc = w.getEncoding();
+
+ /* Work around bogus canonical encoding names */
+ if (enc.equals("UTF8"))
+ enc = "UTF-8";
+ else if (enc.equals("ASCII"))
+ enc = "US-ASCII";
+
+ if (declare) {
+ out.write("<?xml version=\"1.0\" encoding=\"" +
enc + "\"?>");
+ out.newLine();
+ needNewline = true;
+ }
+ }
+
+ /**
+ * Creates a new writer that will write to the given byte-output stream
+ * using the given encoding. An initial XML declaration will optionally be
+ * written to the stream. </p>
+ *
+ * @param out
+ * The target byte-output stream
+ *
+ * @param enc
+ * The character encoding to be used
+ *
+ * @param declare
+ * If <tt>true</tt>, write the XML declaration to the output
stream
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ *
+ * @throws UnsupportedEncodingException
+ * If the named encoding is not supported
+ */
+ public PrettyPrintingXmlWriter(
+ OutputStream out,
+ String enc,
+ boolean declare)
+ throws UnsupportedEncodingException, IOException {
+ this(new OutputStreamWriter(out, enc), declare);
+ }
+
+ /**
+ * Creates a new writer that will write to the given byte-output stream
+ * using the given encoding. An initial XML declaration will be written to
+ * the stream. </p>
+ *
+ * @param out
+ * The target byte-output stream
+ *
+ * @param enc
+ * The character encoding to be used
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ *
+ * @throws UnsupportedEncodingException
+ * If the named encoding is not supported
+ */
+ public PrettyPrintingXmlWriter(OutputStream out, String enc)
+ throws UnsupportedEncodingException, IOException {
+ this(new OutputStreamWriter(out, enc), true);
+ }
+
+ /**
+ * Creates a new writer that will write to the given byte-output stream
+ * using the UTF-8 encoding. An initial XML declaration will be written to
+ * the stream. </p>
+ *
+ * @param out
+ * The target byte-output stream
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ */
+ public PrettyPrintingXmlWriter(OutputStream out) throws IOException {
+ this(new OutputStreamWriter(out, "UTF-8"), true);
+ }
+
+ private char quoteChar = '"';
+
+ /**
+ * Sets the quote character to be used by this writer when writing
+ * attribute values. </p>
+ *
+ * @param quote The new quote character, either a
+ * <small>QUOTATION MARK</small>
(<tt>'\u0022'</tt>),
+ * or an <small>APOSTROPHE-QUOTE</small>
+ * (<tt>'\u0027'</tt>)
+ *
+ * @throws IllegalArgumentException
+ * If the argument is neither of the above characters
+ */
+ public void setQuote(char quote) {
+ if (quote != '"' && quote != '\'')
+ throw new IllegalArgumentException(
+ "Illegal quote character: " + quote);
+ quoteChar = quote;
+ }
+
+ // Quote a character
+ private void quote(char c) throws IOException {
+ switch (c) {
+ case '&' :
+ out.write("&");
+ break;
+ case '<' :
+ out.write("<");
+ break;
+ case '>' :
+ out.write(">");
+ break;
+ default :
+ out.write(c);
+ break;
+ }
+ }
+
+ // Quote a character in an attribute value
+ private void aquote(char c) throws IOException {
+ switch (c) {
+ case '\'' :
+ if (quoteChar == c)
+ out.write("'");
+ else
+ out.write(c);
+ break;
+ case '"' :
+ if (quoteChar == c)
+ out.write(""");
+ else
+ out.write(c);
+ break;
+ default :
+ quote(c);
+ break;
+ }
+ }
+
+ //
+ private void nonQuote(char c) throws IOException {
+ out.write(c);
+ }
+
+ // Quote a string containing character data
+ private void quote(String s) throws IOException {
+ for (int i = 0; i < s.length(); i++)
+ quote(s.charAt(i));
+ }
+
+ /* Allowing support for CDATA */
+ private void nonQuote(String s) throws IOException {
+ for (int i = 0; i < s.length(); i++)
+ nonQuote(s.charAt(i));
+ }
+
+ // Quote a string containing an attribute value
+ private void aquote(String s) throws IOException {
+ for (int i = 0; i < s.length(); i++)
+ aquote(s.charAt(i));
+ }
+
+ private void indent(int depth) throws IOException {
+ for (int i = 0; i < depth; i++)
+ out.write(" ");
+ }
+
+ // Formatting state
+ private int depth = 0;
+ private boolean inStart = false;
+ private boolean needNewline = false;
+ private boolean writtenChars = false;
+ private boolean inAttribute = false;
+ private boolean inAttributeValue = false;
+
+ /**
+ * Writes a DOCTYPE declaration. </p>
+ *
+ * @param root The name of the root element
+ *
+ * @param dtd The URI of the document-type definition
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ */
+ public void doctype(String root, String dtd) throws IOException {
+ if (shouldPrettyprint && needNewline)
+ out.newLine();
+ needNewline = true;
+ out.write("<!DOCTYPE " + root + " SYSTEM " + quoteChar);
+ quote(dtd);
+ out.write(quoteChar + ">");
+ if (shouldPrettyprint)
+ out.newLine();
+ }
+
+ private void start0(String name) throws IOException {
+ finishStart();
+ if (shouldPrettyprint && !writtenChars) {
+ needNewline = true;
+ indent(depth);
+ }
+ out.write('<');
+ out.write(name);
+ inStart = true;
+ writtenChars = false;
+ depth++;
+ }
+
+ private void start1(String name) throws IOException {
+ finishStart();
+ if (shouldPrettyprint && !writtenChars) {
+ if (needNewline)
+ out.newLine();
+ needNewline = true;
+ indent(depth);
+ }
+ out.write('<');
+ out.write(name);
+ inStart = true;
+ writtenChars = false;
+ depth++;
+ }
+
+ private void finishStart() throws IOException {
+ if (inStart) {
+ if (inAttribute)
+ out.write(quoteChar);
+ out.write('>');
+ inStart = false;
+ inAttribute = false;
+ inAttributeValue = false;
+ }
+ }
+
+ /**
+ * Writes a start tag for the named element. </p>
+ *
+ * @param name The name to be used in the start tag
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ */
+ public void start(String name) throws IOException {
+ start1(name);
+ }
+
+ /**
+ * Writes an attribute for the current element. </p>
+ *
+ * @param name The attribute's name
+ *
+ * @param value The attribute's value
+ *
+ * @throws IllegalStateException
+ * If the previous method invoked upon this object was neither
+ * {@link #start start} nor {@link #attribute attribute}
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ */
+ public void attribute(String name, String value) throws IOException {
+ attributeName(name);
+ attributeValue(value);
+ }
+
+ /**
+ * Writes an attribute (unquoted) for the current element. </p>
+ *
+ * @param name The attribute's name
+ *
+ * @param value The attribute's value
+ *
+ * @throws IllegalStateException
+ * If the previous method invoked upon this object was neither
+ * {@link #start start} nor {@link #attribute attribute}
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ */
+ public void attributeUnquoted(String name, String value)
+ throws IOException {
+ attributeName(name);
+ attributeValueUnquoted(value);
+ }
+
+ /**
+ * Writes an attribute for the current element. </p>
+ *
+ * @param prefix The attribute's prefix
+ *
+ * @param name The attribute's name
+ *
+ * @param value The attribute's value
+ *
+ * @throws IllegalStateException
+ * If the previous method invoked upon this object was neither
+ * {@link #start start} nor {@link #attribute attribute}
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ */
+ public void attribute(String prefix, String name, String value)
+ throws IOException {
+ attributeName(prefix, name);
+ attributeValue(value);
+ }
+
+ /**
+ * Writes an attribute (unquoted) for the current element. </p>
+ *
+ * @param prefix The attribute's prefix
+ *
+ * @param name The attribute's name
+ *
+ * @param value The attribute's value
+ *
+ * @throws IllegalStateException
+ * If the previous method invoked upon this object was neither
+ * {@link #start start} nor {@link #attribute attribute}
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ */
+ public void attributeUnquoted(String prefix, String name, String value)
+ throws IOException {
+ attributeName(prefix, name);
+ attributeValueUnquoted(value);
+ }
+
+ /**
+ * Writes an attribute name for the current element. After invoking this
+ * method, invoke the {@link #attributeValue attributeValue} method to
+ * write the attribute value, or invoke the {@link #attributeValueToken
+ * attributeValueToken} method to write one or more space-separated value
+ * tokens. </p>
+ *
+ * @param name The attribute's name
+ *
+ * @throws IllegalStateException
+ * If the previous method invoked upon this object was neither
+ * {@link #start start} nor {@link #attribute attribute}
+ */
+ public void attributeName(String name) throws IOException {
+ if (!inStart)
+ throw new IllegalStateException();
+ if (inAttribute) {
+ out.write(quoteChar);
+ inAttribute = false;
+ inAttributeValue = false;
+ }
+ out.write(' ');
+ out.write(name);
+ out.write('=');
+ out.write(quoteChar);
+ inAttribute = true;
+ }
+
+ /**
+ * Writes an attribute name for the current element. After invoking this
+ * method, invoke the {@link #attributeValue attributeValue} method to
+ * write the attribute value, or invoke the {@link #attributeValueToken
+ * attributeValueToken} method to write one or more space-separated value
+ * tokens. </p>
+ *
+ * @param prefix The attribute's prefix
+ * @param name The attribute's name
+ *
+ * @throws IllegalStateException
+ * If the previous method invoked upon this object was neither
+ * {@link #start start} nor {@link #attribute attribute}
+ */
+ public void attributeName(String prefix, String name) throws IOException {
+ if (!inStart)
+ throw new IllegalStateException();
+ if (inAttribute) {
+ out.write(quoteChar);
+ inAttribute = false;
+ inAttributeValue = false;
+ }
+ out.write(' ');
+ out.write(prefix);
+ out.write(':');
+ out.write(name);
+ out.write('=');
+ out.write(quoteChar);
+ inAttribute = true;
+ }
+
+ /**
+ * Writes a value for the current attribute. </p>
+ *
+ * @param value The attribute's value
+ *
+ * @throws IllegalStateException
+ * If the previous method invoked upon this object was not
+ * {@link #attributeName attributeName}
+ */
+ public void attributeValue(String value) throws IOException {
+ if (!inAttribute || inAttributeValue)
+ throw new IllegalStateException();
+ aquote(value);
+ out.write(quoteChar);
+ inAttribute = false;
+ }
+
+ /**
+ * Writes a value (unquoted) for the current attribute. </p>
+ *
+ * @param value The attribute's value
+ *
+ * @throws IllegalStateException
+ * If the previous method invoked upon this object was not
+ * {@link #attributeName attributeName}
+ */
+ public void attributeValueUnquoted(String value) throws IOException {
+ if (!inAttribute || inAttributeValue)
+ throw new IllegalStateException();
+ out.write(value, 0, value.length());
+ out.write(quoteChar);
+ inAttribute = false;
+ }
+
+ /**
+ * Writes one token of the current attribute's value. Adjacent tokens will
+ * be separated by single space characters. </p>
+ *
+ * @param token The token to be written
+ *
+ * @throws IllegalStateException
+ * If the previous method invoked upon this object was neither
+ * {@link #attributeName attributeName} nor
+ * {@link #attributeValueToken attributeValueToken}
+ */
+ public void attributeValueToken(String token) throws IOException {
+ if (!inAttribute)
+ throw new IllegalStateException();
+ if (inAttributeValue)
+ out.write(' ');
+ aquote(token);
+ inAttributeValue = true;
+ }
+
+ /**
+ * Writes an end tag for the named element. </p>
+ *
+ * @param name The name to be used in the end tag
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ */
+ public void end(String name) throws IOException {
+ if (inStart) {
+ if (inAttribute)
+ out.write(quoteChar);
+ out.write("/>");
+ inStart = false;
+ inAttribute = false;
+ inAttributeValue = false;
+ } else {
+ out.write("</");
+ out.write(name);
+ out.write('>');
+ }
+ depth--;
+ writtenChars = false;
+ }
+
+ /**
+ * Writes some character data. </p>
+ *
+ * @param chars The character data to be written
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ */
+ public void chars(String chars) throws IOException {
+ finishStart();
+ quote(chars);
+ writtenChars = true;
+ }
+
+ public void chars(CDATA chars) throws IOException {
+ finishStart();
+ nonQuote(chars.getText());
+ writtenChars = true;
+ }
+
+ /**
+ * Writes some character data, skipping quoting. </p>
+ *
+ * @param chars The character data to be written
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ */
+ public void charsUnquoted(String chars) throws IOException {
+ finishStart();
+ out.write(chars, 0, chars.length());
+ writtenChars = true;
+ }
+
+ /**
+ * Writes some character data, skipping quoting. </p>
+ *
+ * @param buf Buffer containing the character data to be written
+ * @param off The offset of the data to be written
+ * @param len The length of the data to be written
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ */
+ public void charsUnquoted(char[] buf, int off, int len)
+ throws IOException {
+ finishStart();
+ out.write(buf, off, len);
+ writtenChars = true;
+ }
+
+ /**
+ * Writes a leaf element with the given character content. </p>
+ *
+ * @param name ame to be used in the start and end tags
+ *
+ * @param chars character data to be written
+ *
+ * <p> This method writes a start tag with the given name, followed by the
+ * given character data, followed by an end tag. If the <tt>chars</tt>
+ * parameter is <tt>null</tt> or the empty string then an empty tag is
+ * written. </p>
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ */
+ public void leaf(String name, String chars) throws IOException {
+ start1(name);
+ if ((chars != null) && (chars.length() != 0))
+ chars(chars);
+ end(name);
+ }
+
+ public void inlineLeaf(String name, String chars) throws IOException {
+ start0(name);
+ if ((chars != null) && (chars.length() != 0))
+ chars(chars);
+ end(name);
+ }
+
+ /**
+ * Writes an empty leaf element. </p>
+ *
+ * @param name name to be used in the empty-element tag
+ */
+ public void leaf(String name) throws IOException {
+ leaf(name, null);
+ }
+
+ public void inlineLeaf(String name) throws IOException {
+ inlineLeaf(name, null);
+ }
+
+ /**
+ * Flushes the writer. </p>
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ */
+ public void flush() throws IOException {
+ if (depth != 0)
+ throw new IllegalStateException("Nonzero depth");
+ // if (shouldPrettyprint)
+ out.newLine();
+ out.flush();
+ }
+
+ /**
+ * Flushes the writer and closes the underlying byte-output stream. </p>
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ */
+ public void close() throws IOException {
+ flush();
+ out.close();
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/xml/PrettyPrintingXmlWriter.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/xml/XmlUtil.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/xml/XmlUtil.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/xml/XmlUtil.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,84 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.util.xml;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerFactory;
+
+import org.jboss.com.sun.tools.ws.util.WSDLParseException;
+import org.jboss.com.sun.xml.ws.util.xml.NamedNodeMapIterator;
+import org.jboss.com.sun.xml.ws.util.xml.NodeListIterator;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.EntityReference;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
+
+import org.jboss.com.sun.xml.messaging.saaj.util.ByteInputStream;
+
+/**
+ * @author WS Development Team
+ */
+public class XmlUtil extends org.jboss.com.sun.xml.ws.util.xml.XmlUtil {
+
+ public static boolean matchesTagNS(Element e, String tag, String nsURI) {
+ try {
+ return e.getLocalName().equals(tag)
+ && e.getNamespaceURI().equals(nsURI);
+ } catch (NullPointerException npe) {
+
+ // localname not null since parsing would fail before here
+ throw new WSDLParseException(
+ "null.namespace.found",
+ e.getLocalName());
+ }
+ }
+
+ public static boolean matchesTagNS(
+ Element e,
+ javax.xml.namespace.QName name) {
+ try {
+ return e.getLocalName().equals(name.getLocalPart())
+ && e.getNamespaceURI().equals(name.getNamespaceURI());
+ } catch (NullPointerException npe) {
+
+ // localname not null since parsing would fail before here
+ throw new WSDLParseException(
+ "null.namespace.found",
+ e.getLocalName());
+ }
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/xml/XmlUtil.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/xml/XmlWriter.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/xml/XmlWriter.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/xml/XmlWriter.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,641 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.util.xml;
+
+import java.io.BufferedWriter;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.UnsupportedEncodingException;
+
+import org.jboss.com.sun.xml.ws.util.xml.CDATA;
+
+
+// ## Delay IOExceptions until flush or close
+// ## Need DOM, SAX output
+
+/**
+ * A writer of XML output streams.
+ *
+ * <p> An XML writer knows hardly anything about XML document well-formedness,
+ * to say nothing of validity. It relies upon the invoker to ensure that the
+ * generated document is well-formed and, if required, valid.
+ *
+ *
+ * @author WS Development Team
+ */
+
+public class XmlWriter {
+
+ private static final boolean shouldPrettyprint = false;
+
+ private BufferedWriter out;
+
+ private XmlWriter(OutputStreamWriter w, boolean declare)
+ throws IOException {
+ // XXX-NOTE - set the buffer size to 1024 here
+ this.out = new BufferedWriter(w, 1024);
+ String enc = w.getEncoding();
+
+ /* Work around bogus canonical encoding names */
+ if (enc.equals("UTF8"))
+ enc = "UTF-8";
+ else if (enc.equals("ASCII"))
+ enc = "US-ASCII";
+
+ if (declare) {
+ out.write("<?xml version=\"1.0\" encoding=\"" +
enc + "\"?>");
+ out.newLine();
+ needNewline = true;
+ }
+ }
+
+ /**
+ * Creates a new writer that will write to the given byte-output stream
+ * using the given encoding. An initial XML declaration will optionally be
+ * written to the stream. </p>
+ *
+ * @param out
+ * The target byte-output stream
+ *
+ * @param enc
+ * The character encoding to be used
+ *
+ * @param declare
+ * If <tt>true</tt>, write the XML declaration to the output
stream
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ *
+ * @throws UnsupportedEncodingException
+ * If the named encoding is not supported
+ */
+ public XmlWriter(OutputStream out, String enc, boolean declare)
+ throws UnsupportedEncodingException, IOException {
+ this(new OutputStreamWriter(out, enc), declare);
+ }
+
+ /**
+ * Creates a new writer that will write to the given byte-output stream
+ * using the given encoding. An initial XML declaration will be written to
+ * the stream. </p>
+ *
+ * @param out
+ * The target byte-output stream
+ *
+ * @param enc
+ * The character encoding to be used
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ *
+ * @throws UnsupportedEncodingException
+ * If the named encoding is not supported
+ */
+ public XmlWriter(OutputStream out, String enc)
+ throws UnsupportedEncodingException, IOException {
+ this(new OutputStreamWriter(out, enc), true);
+ }
+
+ /**
+ * Creates a new writer that will write to the given byte-output stream
+ * using the UTF-8 encoding. An initial XML declaration will be written to
+ * the stream. </p>
+ *
+ * @param out
+ * The target byte-output stream
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ */
+ public XmlWriter(OutputStream out) throws IOException {
+ this(new OutputStreamWriter(out, "UTF-8"), true);
+ }
+
+ private char quoteChar = '"';
+
+ /**
+ * Sets the quote character to be used by this writer when writing
+ * attribute values. </p>
+ *
+ * @param quote The new quote character, either a
+ * <small>QUOTATION MARK</small>
(<tt>'\u0022'</tt>),
+ * or an <small>APOSTROPHE-QUOTE</small>
+ * (<tt>'\u0027'</tt>)
+ *
+ * @throws IllegalArgumentException
+ * If the argument is neither of the above characters
+ */
+ public void setQuote(char quote) {
+ if (quote != '"' && quote != '\'')
+ throw new IllegalArgumentException(
+ "Illegal quote character: " + quote);
+ quoteChar = quote;
+ }
+
+ // Quote a character
+ private void quote(char c) throws IOException {
+ switch (c) {
+ case '&' :
+ out.write("&");
+ break;
+ case '<' :
+ out.write("<");
+ break;
+ case '>' :
+ out.write(">");
+ break;
+ default :
+ out.write(c);
+ break;
+ }
+ }
+
+ //
+ private void nonQuote(char c) throws IOException {
+ out.write(c);
+ }
+
+ // Quote a character in an attribute value
+ private void aquote(char c) throws IOException {
+ switch (c) {
+ case '\'' :
+ if (quoteChar == c)
+ out.write("'");
+ else
+ out.write(c);
+ break;
+ case '"' :
+ if (quoteChar == c)
+ out.write(""");
+ else
+ out.write(c);
+ break;
+ default :
+ quote(c);
+ break;
+ }
+ }
+
+ // Quote a string containing character data
+ private void quote(String s) throws IOException {
+ for (int i = 0; i < s.length(); i++)
+ quote(s.charAt(i));
+ }
+
+ /* Allowing support for CDATA */
+ private void nonQuote(String s) throws IOException {
+ for (int i = 0; i < s.length(); i++)
+ nonQuote(s.charAt(i));
+ }
+
+ // Quote a string containing an attribute value
+ private void aquote(String s) throws IOException {
+ for (int i = 0; i < s.length(); i++)
+ aquote(s.charAt(i));
+ }
+
+ private void indent(int depth) throws IOException {
+ for (int i = 0; i < depth; i++)
+ out.write(" ");
+ }
+
+ // Formatting state
+ private int depth = 0;
+ private boolean inStart = false;
+ private boolean needNewline = false;
+ private boolean writtenChars = false;
+ private boolean inAttribute = false;
+ private boolean inAttributeValue = false;
+
+ /**
+ * Writes a DOCTYPE declaration. </p>
+ *
+ * @param root The name of the root element
+ *
+ * @param dtd The URI of the document-type definition
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ */
+ public void doctype(String root, String dtd) throws IOException {
+ if (shouldPrettyprint && needNewline)
+ out.newLine();
+ needNewline = true;
+ out.write("<!DOCTYPE " + root + " SYSTEM " + quoteChar);
+ quote(dtd);
+ out.write(quoteChar + ">");
+ if (shouldPrettyprint)
+ out.newLine();
+ }
+
+ private void start0(String name) throws IOException {
+ finishStart();
+ if (shouldPrettyprint && !writtenChars) {
+ needNewline = true;
+ indent(depth);
+ }
+ out.write('<');
+ out.write(name);
+ inStart = true;
+ writtenChars = false;
+ depth++;
+ }
+
+ private void start1(String name) throws IOException {
+ finishStart();
+ if (shouldPrettyprint && !writtenChars) {
+ if (needNewline)
+ out.newLine();
+ needNewline = true;
+ indent(depth);
+ }
+ out.write('<');
+ out.write(name);
+ inStart = true;
+ writtenChars = false;
+ depth++;
+ }
+
+ private void finishStart() throws IOException {
+ if (inStart) {
+ if (inAttribute)
+ out.write(quoteChar);
+ out.write('>');
+ inStart = false;
+ inAttribute = false;
+ inAttributeValue = false;
+ }
+ }
+
+ /**
+ * Writes a start tag for the named element. </p>
+ *
+ * @param name The name to be used in the start tag
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ */
+ public void start(String name) throws IOException {
+ start1(name);
+ }
+
+ /**
+ * Writes an attribute for the current element. </p>
+ *
+ * @param name The attribute's name
+ *
+ * @param value The attribute's value
+ *
+ * @throws IllegalStateException
+ * If the previous method invoked upon this object was neither
+ * {@link #start start} nor {@link #attribute attribute}
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ */
+ public void attribute(String name, String value) throws IOException {
+ attributeName(name);
+ attributeValue(value);
+ }
+
+ /**
+ * Writes an attribute (unquoted) for the current element. </p>
+ *
+ * @param name The attribute's name
+ *
+ * @param value The attribute's value
+ *
+ * @throws IllegalStateException
+ * If the previous method invoked upon this object was neither
+ * {@link #start start} nor {@link #attribute attribute}
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ */
+ public void attributeUnquoted(String name, String value)
+ throws IOException {
+ attributeName(name);
+ attributeValueUnquoted(value);
+ }
+
+ /**
+ * Writes an attribute for the current element. </p>
+ *
+ * @param prefix The attribute's prefix
+ *
+ * @param name The attribute's name
+ *
+ * @param value The attribute's value
+ *
+ * @throws IllegalStateException
+ * If the previous method invoked upon this object was neither
+ * {@link #start start} nor {@link #attribute attribute}
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ */
+ public void attribute(String prefix, String name, String value)
+ throws IOException {
+ attributeName(prefix, name);
+ attributeValue(value);
+ }
+
+ /**
+ * Writes an attribute (unquoted) for the current element. </p>
+ *
+ * @param prefix The attribute's prefix
+ *
+ * @param name The attribute's name
+ *
+ * @param value The attribute's value
+ *
+ * @throws IllegalStateException
+ * If the previous method invoked upon this object was neither
+ * {@link #start start} nor {@link #attribute attribute}
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ */
+ public void attributeUnquoted(String prefix, String name, String value)
+ throws IOException {
+ attributeName(prefix, name);
+ attributeValueUnquoted(value);
+ }
+
+ /**
+ * Writes an attribute name for the current element. After invoking this
+ * method, invoke the {@link #attributeValue attributeValue} method to
+ * write the attribute value, or invoke the {@link #attributeValueToken
+ * attributeValueToken} method to write one or more space-separated value
+ * tokens. </p>
+ *
+ * @param name The attribute's name
+ *
+ * @throws IllegalStateException
+ * If the previous method invoked upon this object was neither
+ * {@link #start start} nor {@link #attribute attribute}
+ */
+ public void attributeName(String name) throws IOException {
+ if (!inStart)
+ throw new IllegalStateException();
+ if (inAttribute) {
+ out.write(quoteChar);
+ inAttribute = false;
+ inAttributeValue = false;
+ }
+ out.write(' ');
+ out.write(name);
+ out.write('=');
+ out.write(quoteChar);
+ inAttribute = true;
+ }
+
+ /**
+ * Writes an attribute name for the current element. After invoking this
+ * method, invoke the {@link #attributeValue attributeValue} method to
+ * write the attribute value, or invoke the {@link #attributeValueToken
+ * attributeValueToken} method to write one or more space-separated value
+ * tokens. </p>
+ *
+ * @param prefix The attribute's prefix
+ * @param name The attribute's name
+ *
+ * @throws IllegalStateException
+ * If the previous method invoked upon this object was neither
+ * {@link #start start} nor {@link #attribute attribute}
+ */
+ public void attributeName(String prefix, String name) throws IOException {
+ if (!inStart)
+ throw new IllegalStateException();
+ if (inAttribute) {
+ out.write(quoteChar);
+ inAttribute = false;
+ inAttributeValue = false;
+ }
+ out.write(' ');
+ out.write(prefix);
+ out.write(':');
+ out.write(name);
+ out.write('=');
+ out.write(quoteChar);
+ inAttribute = true;
+ }
+
+ /**
+ * Writes a value for the current attribute. </p>
+ *
+ * @param value The attribute's value
+ *
+ * @throws IllegalStateException
+ * If the previous method invoked upon this object was not
+ * {@link #attributeName attributeName}
+ */
+ public void attributeValue(String value) throws IOException {
+ if (!inAttribute || inAttributeValue)
+ throw new IllegalStateException();
+ aquote(value);
+ out.write(quoteChar);
+ inAttribute = false;
+ }
+
+ /**
+ * Writes a value (unquoted) for the current attribute. </p>
+ *
+ * @param value The attribute's value
+ *
+ * @throws IllegalStateException
+ * If the previous method invoked upon this object was not
+ * {@link #attributeName attributeName}
+ */
+ public void attributeValueUnquoted(String value) throws IOException {
+ if (!inAttribute || inAttributeValue)
+ throw new IllegalStateException();
+ out.write(value, 0, value.length());
+ out.write(quoteChar);
+ inAttribute = false;
+ }
+
+ /**
+ * Writes one token of the current attribute's value. Adjacent tokens will
+ * be separated by single space characters. </p>
+ *
+ * @param token The token to be written
+ *
+ * @throws IllegalStateException
+ * If the previous method invoked upon this object was neither
+ * {@link #attributeName attributeName} nor
+ * {@link #attributeValueToken attributeValueToken}
+ */
+ public void attributeValueToken(String token) throws IOException {
+ if (!inAttribute)
+ throw new IllegalStateException();
+ if (inAttributeValue)
+ out.write(' ');
+ aquote(token);
+ inAttributeValue = true;
+ }
+
+ /**
+ * Writes an end tag for the named element. </p>
+ *
+ * @param name The name to be used in the end tag
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ */
+ public void end(String name) throws IOException {
+ if (inStart) {
+ if (inAttribute)
+ out.write(quoteChar);
+ out.write("/>");
+ inStart = false;
+ inAttribute = false;
+ inAttributeValue = false;
+ } else {
+ out.write("</");
+ out.write(name);
+ out.write('>');
+ }
+ depth--;
+ writtenChars = false;
+ }
+
+ /**
+ * Writes some character data. </p>
+ *
+ * @param chars The character data to be written
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ */
+ public void chars(String chars) throws IOException {
+ finishStart();
+ quote(chars);
+ writtenChars = true;
+ }
+
+ public void chars(CDATA chars) throws IOException {
+ finishStart();
+ nonQuote(chars.getText());
+ writtenChars = true;
+ }
+
+ /**
+ * Writes some character data, skipping quoting. </p>
+ *
+ * @param chars The character data to be written
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ */
+ public void charsUnquoted(String chars) throws IOException {
+ finishStart();
+ out.write(chars, 0, chars.length());
+ writtenChars = true;
+ }
+
+ /**
+ * Writes some character data, skipping quoting. </p>
+ *
+ * @param buf Buffer containing the character data to be written
+ * @param off The offset of the data to be written
+ * @param len The length of the data to be written
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ */
+ public void charsUnquoted(char[] buf, int off, int len)
+ throws IOException {
+ finishStart();
+ out.write(buf, off, len);
+ writtenChars = true;
+ }
+
+ /**
+ * Writes a leaf element with the given character content. </p>
+ *
+ * @param name The name to be used in the start and end tags
+ *
+ * @param chars The character data to be written
+ *
+ * <p> This method writes a start tag with the given name, followed by the
+ * given character data, followed by an end tag. If the <tt>chars</tt>
+ * parameter is <tt>null</tt> or the empty string then an empty tag is
+ * written. </p>
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ */
+ public void leaf(String name, String chars) throws IOException {
+ start1(name);
+ if ((chars != null) && (chars.length() != 0))
+ chars(chars);
+ end(name);
+ }
+
+ public void inlineLeaf(String name, String chars) throws IOException {
+ start0(name);
+ if ((chars != null) && (chars.length() != 0))
+ chars(chars);
+ end(name);
+ }
+
+ /**
+ * Writes an empty leaf element. </p>
+ *
+ * @param name name to be used in the empty-element tag
+ */
+ public void leaf(String name) throws IOException {
+ leaf(name, null);
+ }
+
+ public void inlineLeaf(String name) throws IOException {
+ inlineLeaf(name, null);
+ }
+
+ /**
+ * Flushes the writer. </p>
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ */
+ public void flush() throws IOException {
+ if (depth != 0)
+ // throw new IllegalStateException("Nonzero depth");
+ // if (shouldPrettyprint)
+ out.newLine();
+ out.flush();
+ }
+
+ /**
+ * Flushes the writer and closes the underlying byte-output stream. </p>
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ */
+ public void close() throws IOException {
+ flush();
+ out.close();
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/util/xml/XmlWriter.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/version.properties
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/version.properties
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/version.properties 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,3 @@
+build-id=01/28/2007 08:27 PM(jason)
+build-version=JAX-WS RI 2.0-01/28/2007 08:27 PM(jason)
+major-version=2.0
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wscompile/ActionConstants.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wscompile/ActionConstants.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wscompile/ActionConstants.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,42 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.wscompile;
+
+/**
+ * @author WS Development Team
+ */
+public interface ActionConstants {
+// public static final String ACTION_SERVICE_INTERFACE_GENERATOR =
+// "service.interface.generator";
+ public static final String ACTION_SERVICE_GENERATOR =
+ "service.generator";
+ public static final String ACTION_REMOTE_INTERFACE_GENERATOR =
+ "remote.interface.impl.generator";
+ public static final String ACTION_REMOTE_INTERFACE_IMPL_GENERATOR =
+ "remote.interface.impl.generator";
+ public static final String ACTION_JAXB_TYPE_GENERATOR =
+ "jaxb.type.generator";
+ public static final String ACTION_CUSTOM_EXCEPTION_GENERATOR =
+ "custom.exception.generator";
+ public static final String ACTION_WSDL_GENERATOR =
+ "wsdl.generator";
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wscompile/ActionConstants.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wscompile/CompileTool.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wscompile/CompileTool.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wscompile/CompileTool.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,964 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.wscompile;
+
+import com.sun.mirror.apt.AnnotationProcessor;
+import com.sun.mirror.apt.AnnotationProcessorEnvironment;
+import com.sun.mirror.apt.AnnotationProcessorFactory;
+import com.sun.mirror.declaration.AnnotationTypeDeclaration;
+
+
+import javax.xml.namespace.QName;
+import javax.xml.transform.Result;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.ws.BindingType;
+import javax.xml.ws.Holder;
+import javax.xml.ws.soap.SOAPBinding;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.OutputStream;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+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;
+
+import org.jboss.com.sun.tools.ws.ToolVersion;
+import org.jboss.com.sun.tools.ws.processor.Processor;
+import org.jboss.com.sun.tools.ws.processor.ProcessorAction;
+import org.jboss.com.sun.tools.ws.processor.ProcessorConstants;
+import org.jboss.com.sun.tools.ws.processor.ProcessorNotificationListener;
+import org.jboss.com.sun.tools.ws.processor.ProcessorOptions;
+import org.jboss.com.sun.tools.ws.processor.config.ClassModelInfo;
+import org.jboss.com.sun.tools.ws.processor.config.Configuration;
+import org.jboss.com.sun.tools.ws.processor.config.WSDLModelInfo;
+import org.jboss.com.sun.tools.ws.processor.config.parser.Reader;
+import org.jboss.com.sun.tools.ws.processor.generator.CustomExceptionGenerator;
+import org.jboss.com.sun.tools.ws.processor.generator.SeiGenerator;
+import org.jboss.com.sun.tools.ws.processor.model.Model;
+import
org.jboss.com.sun.tools.ws.processor.modeler.annotation.AnnotationProcessorContext;
+import org.jboss.com.sun.tools.ws.processor.modeler.annotation.WebServiceAP;
+import org.jboss.com.sun.tools.ws.processor.util.ClientProcessorEnvironment;
+import org.jboss.com.sun.tools.ws.processor.util.GeneratedFileInfo;
+import org.jboss.com.sun.tools.ws.processor.util.ProcessorEnvironment;
+import org.jboss.com.sun.tools.ws.processor.util.ProcessorEnvironmentBase;
+import org.jboss.com.sun.tools.ws.util.ForkEntityResolver;
+import org.jboss.com.sun.tools.ws.util.JavaCompilerHelper;
+import org.jboss.com.sun.tools.ws.util.ToolBase;
+import org.jboss.com.sun.xml.ws.binding.BindingImpl;
+import org.jboss.com.sun.xml.ws.binding.soap.SOAPBindingImpl;
+import org.jboss.com.sun.xml.ws.util.JAXWSUtils;
+import org.jboss.com.sun.xml.ws.util.VersionUtil;
+import org.jboss.com.sun.xml.ws.util.localization.Localizable;
+import org.jboss.com.sun.xml.ws.util.xml.XmlUtil;
+import org.jboss.com.sun.xml.ws.wsdl.writer.WSDLGenerator;
+import org.xml.sax.EntityResolver;
+
+/**
+ * This is the real implementation class for both WsGen and WsImport.
+ *
+ * <P>If the program being executed is WsGen, the CompileTool acts as an
+ * {@link com.sun.mirror.apt.AnnotationProcessorFactory AnnotationProcessorFactory}
+ * and uses {@link
org.jboss.com.sun.tools.ws.processor.modeler.annotation.WebServiceAP
+ * WebServiceAP} as the {@link com.sun.mirror.apt.AnnotationProcessor
+ * AnnotationProcessor} for the APT framework. In this case APT takes control
+ * while processing the SEI passed to WsGen. The APT framework then invokes the
+ * WebServiceAP to process classes that contain javax.jws.* annotations.
+ * WsGen uses the APT reflection library to process the SEI and to generate any
+ * JAX-WS spec mandated Java beans.
+ *
+ * <p>If the program being executed is WsImport, the CompileTool creates a
+ * {@link org.jboss.com.sun.tools.ws.processor.Processor Processor} to help with the
+ * processing. First the {@link
org.jboss.com.sun.tools.ws.processor.Processor#runModeler()
+ * Processor.runModeler()} method is called to create an instance of the
+ * {@link org.jboss.com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler WSDLModeler}
to
+ * process the WSDL being imported, which intern processes the WSDL and creates
+ * a {@link org.jboss.com.sun.tools.ws.processor.model.Model Model} that is returned
to the
+ * Processor. The CompileTool then registers a number of
+ * {@link org.jboss.com.sun.tools.ws.processor.ProcessorAction ProcessorActions} with
the
+ * Processor. Some of these ProcessorActions include
+ * the {@link org.jboss.com.sun.tools.ws.processor.generator.CustomExceptionGenerator
+ * CustomExceptionGenerator} to generate Exception classes,
+ * the {@link org.jboss.com.sun.tools.ws.processor.generator.JAXBTypeGenerator
+ * JAXBTypeGenerator} to generate JAXB types,
+ * the {@link org.jboss.com.sun.tools.ws.processor.generator.ServiceGenerator
+ * ServiceGenerator} to generate the Service interface, and
+ * the {@link org.jboss.com.sun.tools.ws.processor.generator.SeiGenerator
+ * RemoteInterfaceGenerator} to generate the service endpoint interface.
+ * The CompileTool then invokes the {@link
org.jboss.com.sun.tools.ws.processor.Processor#runActions()
+ * Processor.runActions()} method to cause these ProcessorActions to run.
+ * Once the ProcessorActions have been run, the CompileTool will invoke javac
+ * to compile any classes generated by the ProcessorActions.
+ *
+ * @author WS Development Team
+ *
+ */
+public class CompileTool extends ToolBase implements ProcessorNotificationListener,
+ AnnotationProcessorFactory {
+
+ public CompileTool(OutputStream out, String program) {
+ super(out, program);
+ listener = this;
+ }
+
+ protected boolean parseArguments(String[] args) {
+ for (int i = 0; i < args.length; i++) {
+ if (args[i].equals("")) {
+ args[i] = null;
+ } else if (args[i].equals("-g")) {
+ compilerDebug = true;
+ args[i] = null;
+ } /*else if (args[i].equals("-O")) {
+ compilerOptimize = true;
+ args[i] = null;
+ }*/ else if (args[i].equals("-verbose")) {
+ verbose = true;
+ args[i] = null;
+ } else if (args[i].equals("-b")) {
+ if(program.equals(WSGEN)) {
+ onError(getMessage("wscompile.invalidOption", args[i]));
+ usage();
+ return false;
+ }
+ if ((i + 1) < args.length) {
+ args[i] = null;
+ String file = args[++i];
+ args[i] = null;
+
bindingFiles.add(JAXWSUtils.absolutize(JAXWSUtils.getFileOrURLName(file)));
+ } else {
+ onError(getMessage("wscompile.missingOptionArgument",
"-b"));
+ usage();
+ return false;
+ }
+ } else if (args[i].equals("-version")) {
+ report(ToolVersion.VERSION.BUILD_VERSION);
+ doNothing = true;
+ args[i] = null;
+ return true;
+ } else if (args[i].equals("-keep")) {
+ keepGenerated = true;
+ args[i] = null;
+ } else if(args[i].equals("-wsdllocation")){
+ if(program.equals(WSGEN)) {
+ onError(getMessage("wscompile.invalidOption", args[i]));
+ usage();
+ return false;
+ }
+ if ((i + 1) < args.length) {
+ args[i]=null;
+ wsdlLocation = args[++i];
+ args[i]=null;
+ } else {
+ onError(getMessage("wscompile.missingOptionArgument",
args[i]));
+ usage();
+ return false;
+ }
+ } else if(args[i].equals("-p")){
+ if(program.equals(WSGEN)) {
+ onError(getMessage("wscompile.invalidOption", args[i]));
+ usage();
+ return false;
+ }
+ if ((i + 1) < args.length) {
+ args[i]=null;
+ defaultPackage = args[++i];
+ args[i]=null;
+ } else {
+ onError(getMessage("wscompile.missingOptionArgument",
args[i]));
+ usage();
+ return false;
+ }
+ }else if(args[i].equals("-catalog")){
+ if(program.equals(WSGEN)) {
+ onError(getMessage("wscompile.invalidOption", args[i]));
+ usage();
+ return false;
+ }
+ if ((i + 1) < args.length) {
+ args[i]=null;
+ catalog = args[++i];
+ args[i]=null;
+ } else {
+ onError(getMessage("wscompile.missingOptionArgument",
args[i]));
+ usage();
+ return false;
+ }
+ }else if (args[i].equals(SERVICENAME_OPTION)) {
+ if(program.equals(WSIMPORT)) {
+ onError(getMessage("wscompile.invalidOption", args[i]));
+ usage();
+ return false;
+ }
+ if ((i + 1) < args.length) {
+ args[i] = null;
+ serviceName = QName.valueOf(args[++i]);
+ if (serviceName.getNamespaceURI() == null ||
serviceName.getNamespaceURI().length() == 0) {
+
onError(getMessage("wsgen.servicename.missing.namespace", args[i]));
+ usage();
+ return false;
+ }
+ if (serviceName.getLocalPart() == null ||
serviceName.getLocalPart().length() == 0) {
+
onError(getMessage("wsgen.servicename.missing.localname", args[i]));
+ usage();
+ return false;
+ }
+ args[i] = null;
+ } else {
+ onError(getMessage("wscompile.missingOptionArgument",
args[i]));
+ usage();
+ return false;
+ }
+ } else if (args[i].equals(PORTNAME_OPTION)) {
+ if(program.equals(WSIMPORT)) {
+ onError(getMessage("wscompile.invalidOption", args[i]));
+ usage();
+ return false;
+ }
+ if ((i + 1) < args.length) {
+ args[i] = null;
+ portName = QName.valueOf(args[++i]);
+ if (portName.getNamespaceURI() == null ||
portName.getNamespaceURI().length() == 0) {
+ onError(getMessage("wsgen.portname.missing.namespace",
args[i]));
+ usage();
+ return false;
+ }
+ if (portName.getLocalPart() == null ||
portName.getLocalPart().length() == 0) {
+ onError(getMessage("wsgen.portname.missing.localname",
args[i]));
+ usage();
+ return false;
+ }
+ args[i] = null;
+ } else {
+ onError(getMessage("wscompile.missingOptionArgument",
args[i]));
+ usage();
+ return false;
+ }
+ } else if (args[i].equals("-d")) {
+ if ((i + 1) < args.length) {
+ if (destDir != null) {
+ onError(getMessage("wscompile.duplicateOption",
"-d"));
+ usage();
+ return false;
+ }
+ args[i] = null;
+ destDir = new File(args[++i]);
+ args[i] = null;
+ if (!destDir.exists()) {
+ onError(getMessage("wscompile.noSuchDirectory",
destDir.getPath()));
+ usage();
+ return false;
+ }
+ } else {
+ onError(getMessage("wscompile.missingOptionArgument",
"-d"));
+ usage();
+ return false;
+ }
+ } else if (args[i].equals("-r")) {
+ if (program.equals(WSIMPORT)) {
+ onError(getMessage("wscompile.invalidOption", args[i]));
+ usage();
+ return false;
+ }
+ if ((i + 1) < args.length) {
+ if (nonclassDestDir != null) {
+ onError(getMessage("wscompile.duplicateOption",
"-r"));
+ usage();
+ return false;
+ }
+ args[i] = null;
+ nonclassDestDir = new File(args[++i]);
+ args[i] = null;
+ if (!nonclassDestDir.exists()) {
+ onError(getMessage("wscompile.noSuchDirectory",
nonclassDestDir.getPath()));
+ usage();
+ return false;
+ }
+ } else {
+ onError(getMessage("wscompile.missingOptionArgument",
"-r"));
+ usage();
+ return false;
+ }
+ } else if (args[i].equals("-s")) {
+ if ((i + 1) < args.length) {
+ if (sourceDir != null) {
+ onError(getMessage("wscompile.duplicateOption",
"-s"));
+ usage();
+ return false;
+ }
+ args[i] = null;
+ sourceDir = new File(args[++i]);
+ args[i] = null;
+ if (!sourceDir.exists()) {
+ onError(getMessage("wscompile.noSuchDirectory",
sourceDir.getPath()));
+ usage();
+ return false;
+ }
+ keepGenerated = true;
+ } else {
+ onError(getMessage("wscompile.missingOptionArgument",
"-s"));
+ usage();
+ return false;
+ }
+ } else if (args[i].equals("-classpath") ||
args[i].equals("-cp")) {
+ if (program.equals(WSIMPORT)) {
+ onError(getMessage("wscompile.invalidOption", args[i]));
+ usage();
+ return false;
+ }
+ if ((i + 1) < args.length) {
+ if (userClasspath != null) {
+ onError(getMessage("wscompile.duplicateOption",
args[i]));
+ usage();
+ return false;
+ }
+ args[i] = null;
+ userClasspath = args[++i];
+ args[i] = null;
+ } else {
+ onError(getMessage("wscompile.missingOptionArgument",
args[i]));
+ usage();
+ return false;
+ }
+
+ } else if (args[i].startsWith("-httpproxy:")) {
+ if(program.equals(WSGEN)) {
+ onError(getMessage("wscompile.invalidOption", args[i]));
+ usage();
+ return false;
+ }
+ String value = args[i].substring(11);
+ if (value.length() == 0) {
+ onError(getMessage("wscompile.invalidOption", args[i]));
+ usage();
+ return false;
+ }
+ int index = value.indexOf(':');
+ if (index == -1) {
+ System.setProperty("proxySet", TRUE);
+ System.setProperty("proxyHost", value);
+ System.setProperty("proxyPort", "8080");
+ } else {
+ System.setProperty("proxySet", TRUE);
+ System.setProperty("proxyHost", value.substring(0,
index));
+ System.setProperty("proxyPort", value.substring(index +
1));
+ }
+ args[i] = null;
+ } else if (args[i].startsWith("-wsdl")) {
+ if (program.equals(WSIMPORT)) {
+ onError(getMessage("wscompile.invalidOption", args[i]));
+ usage();
+ return false;
+ }
+ genWsdl = true;
+ String value = args[i].substring(5);
+ int index = value.indexOf(':');
+ if (index == 0) {
+ value = value.substring(1);
+ index = value.indexOf('/');
+ if (index == -1) {
+ protocol = value;
+ transport = HTTP;
+ } else {
+ protocol = value.substring(0, index);
+ transport = value.substring(index + 1);
+ }
+ if (!isValidProtocol(protocol)) {
+ onError(getMessage("wsgen.invalid.protocol", protocol,
VALID_PROTOCOLS));
+ }
+ protocolSet = true;
+ if (!isValidTransport(transport)) {
+ onError(getMessage("wsgen.invalid.transport",
transport, VALID_TRANSPORTS));
+ }
+ }
+ args[i] = null;
+ } else if (args[i].equals("-extension")) {
+ extensions = true;
+ args[i] = null;
+ } else if (args[i].startsWith("-help")) {
+ help();
+ return false;
+ } else if (args[i].equals("-Xdonotoverwrite")) {
+ if(program.equals(WSIMPORT)) {
+ onError(getMessage("wscompile.invalidOption", args[i]));
+ usage();
+ return false;
+ }
+ doNotOverWrite = true;
+ args[i] = null;
+ }
+ }
+
+ for (String arg : args) {
+ if (arg != null) {
+ if (arg.startsWith("-")) {
+ onError(getMessage("wscompile.invalidOption", arg));
+ usage();
+ return false;
+ }
+
+ // the input source could be a local file or a URL,get the
+ // abolutized URL string
+ String fileName = arg;
+ if (program.equals(WSGEN)) {
+ if (!isValidWSGenClass(fileName))
+ return false;
+ }
+ inputFiles.add(fileName);
+ }
+ }
+
+ if (inputFiles.isEmpty()) {
+ onError(getMessage(program+".missingFile"));
+ usage();
+ return false;
+ }
+ if (!extensions && hasExtensions())
+ return false;
+
+ // put jaxws and jaxb binding files
+ properties.put(ProcessorOptions.BINDING_FILES, bindingFiles);
+ if (!validateArguments()) {
+ usage();
+ return false;
+ }
+ return true;
+ }
+
+ protected boolean isValidWSGenClass(String className) {
+ Class clazz = getClass(className);
+ if (clazz == null) {
+ onError(getMessage("wsgen.class.not.found", className));
+ return false;
+ }
+ if (clazz.isEnum() || clazz.isInterface() ||
+ clazz.isPrimitive()) {
+ onError(getMessage("wsgen.class.must.be.implementation.class",
className));
+ return false;
+ }
+ if (genWsdl) {
+ BindingImpl binding = (BindingImpl)BindingImpl.getBinding(null, clazz, null,
false);
+ if (!(binding instanceof SOAPBinding)) {
+
onError(getMessage("wsgen.cannot.gen.wsdl.for.non.soap.binding",
+ new Object[] {className, binding.getBindingId()}));
+ return false;
+ }
+ SOAPBindingImpl soapBinding = (SOAPBindingImpl)binding;
+ if ((soapBinding.getActualBindingId().equals(SOAPBinding.SOAP12HTTP_BINDING)
||
+
soapBinding.getActualBindingId().equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING)) &&
+ !(protocol.equals(X_SOAP12) && extensions)) {
+ onError(getMessage("wsgen.cannot.gen.wsdl.for.soap12.binding",
+ new Object[] {className, binding.getBindingId()}));
+ return false;
+ }
+ if
(soapBinding.getActualBindingId().equals(SOAPBindingImpl.X_SOAP12HTTP_BINDING) &&
+ !extensions) {
+
onError(getMessage("wsgen.cannot.gen.wsdl.for.xsoap12.binding.wo.extention",
+ new Object[] {className, binding.getBindingId()}));
+ return false;
+ }
+ }
+ return true;
+ }
+
+ protected boolean validateArguments() {
+ if (!genWsdl) {
+ if (serviceName != null) {
+ onError(getMessage("wsgen.wsdl.arg.no.genwsdl",
SERVICENAME_OPTION));
+ return false;
+ }
+ if (portName != null) {
+ onError(getMessage("wsgen.wsdl.arg.no.genwsdl",
PORTNAME_OPTION));
+ return false;
+ }
+ }
+ return true;
+ }
+
+ protected boolean hasExtensions() {
+ if (protocol.equalsIgnoreCase(X_SOAP12)) {
+ onError(getMessage("wsgen.soap12.without.extension"));
+ return true;
+ }
+ return false;
+ }
+
+
+ static public boolean isValidProtocol(String protocol) {
+ return (protocol.equalsIgnoreCase(SOAP11) ||
+ protocol.equalsIgnoreCase(X_SOAP12));
+ }
+
+ static public boolean isValidTransport(String transport) {
+ return (transport.equalsIgnoreCase(HTTP));
+ }
+
+ protected void run() throws Exception {
+ if (doNothing) {
+ return;
+ }
+ try {
+ beforeHook();
+ if(entityResolver == null){
+ if(catalog != null && catalog.length() > 0)
+ entityResolver =
XmlUtil.createEntityResolver(JAXWSUtils.getFileOrURL(catalog));
+ }else if(catalog != null && catalog.length() > 0){
+ EntityResolver er =
XmlUtil.createEntityResolver(JAXWSUtils.getFileOrURL(catalog));
+ entityResolver = new ForkEntityResolver(er, entityResolver);
+ }
+ environment = createEnvironment();
+ configuration = createConfiguration();
+ setEnvironmentValues(environment);
+ if (configuration.getModelInfo() instanceof ClassModelInfo) {
+ buildModel(((ClassModelInfo)
configuration.getModelInfo()).getClassName());
+ } else {
+ processor = new Processor(configuration, properties);
+ configuration.getModelInfo().setEntityResolver(entityResolver);
+ configuration.getModelInfo().setDefaultJavaPackage(defaultPackage);
+ processor.runModeler();
+ withModelHook();
+ registerProcessorActions(processor);
+ processor.runActions();
+ if (environment.getErrorCount() == 0) {
+ compileGeneratedClasses();
+ }
+ }
+ afterHook();
+ } finally {
+ if (!keepGenerated) {
+ removeGeneratedFiles();
+ }
+ if (environment != null) {
+ environment.shutdown();
+ }
+ }
+ }
+
+ protected void setEnvironmentValues(ProcessorEnvironment env) {
+ int envFlags = env.getFlags();
+ envFlags |= ProcessorEnvironment.F_WARNINGS;
+ if (verbose) {
+ envFlags |= ProcessorEnvironment.F_VERBOSE;
+ }
+ env.setFlags(envFlags);
+ }
+
+ protected void initialize() {
+ super.initialize();
+ properties = new Properties();
+ actions = new HashMap<String,ProcessorAction>();
+ actions.put(ActionConstants.ACTION_SERVICE_GENERATOR,
+ new org.jboss.com.sun.tools.ws.processor.generator.ServiceGenerator());
+ actions.put(ActionConstants.ACTION_REMOTE_INTERFACE_GENERATOR,
+ new SeiGenerator());
+ actions.put(ActionConstants.ACTION_CUSTOM_EXCEPTION_GENERATOR,
+ new CustomExceptionGenerator());
+ actions.put(ActionConstants.ACTION_JAXB_TYPE_GENERATOR,
+ new org.jboss.com.sun.tools.ws.processor.generator.JAXBTypeGenerator());
+ }
+
+ public void removeGeneratedFiles() {
+ environment.deleteGeneratedFiles();
+ }
+
+ public void buildModel(String endpoint) {
+ context = new AnnotationProcessorContext();
+ webServiceAP = new WebServiceAP(this, environment, properties, context);
+
+ String classpath = environment.getClassPath();
+
+ String[] args = new String[8];
+ args[0] = "-d";
+ args[1] = destDir.getAbsolutePath();
+ args[2] = "-classpath";
+ args[3] = classpath;
+ args[4] = "-s";
+ args[5] = sourceDir.getAbsolutePath();
+ args[6] = "-XclassesAsDecls";
+ args[7] = endpoint;
+
+ int result = com.sun.tools.apt.Main.process(this, args);
+ if (result != 0) {
+ environment.error(getMessage("wscompile.compilationFailed"));
+ return;
+ }
+ if (genWsdl) {
+ String tmpPath = destDir.getAbsolutePath()+File.pathSeparator+classpath;
+ ClassLoader classLoader = new
URLClassLoader(ProcessorEnvironmentBase.pathToURLs(tmpPath),
+ this.getClass().getClassLoader());
+ Class<?> endpointClass = null;
+
+ try {
+ endpointClass = classLoader.loadClass(endpoint);
+ } catch (ClassNotFoundException e) {
+ // this should never happen
+ environment.error(getMessage("wsgen.class.not.found",
endpoint));
+ }
+ String bindingID = getBindingID(protocol);
+ if (!protocolSet) {
+ BindingImpl binding = (BindingImpl)BindingImpl.getBinding(null,
+ endpointClass, null, false);
+ bindingID = binding.getBindingId();
+ }
+ org.jboss.com.sun.xml.ws.modeler.RuntimeModeler rtModeler =
+ new org.jboss.com.sun.xml.ws.modeler.RuntimeModeler(endpointClass,
serviceName, bindingID);
+ rtModeler.setClassLoader(classLoader);
+ if (portName != null)
+ rtModeler.setPortName(portName);
+ org.jboss.com.sun.xml.ws.model.RuntimeModel rtModel =
rtModeler.buildRuntimeModel();
+ WSDLGenerator wsdlGenerator = new WSDLGenerator(rtModel,
+ new org.jboss.com.sun.xml.ws.wsdl.writer.WSDLOutputResolver() {
+ public Result getWSDLOutput(String suggestedFilename) {
+ File wsdlFile =
+ new File(nonclassDestDir, suggestedFilename);
+
+ Result result = new StreamResult();
+ try {
+ result = new StreamResult(new
FileOutputStream(wsdlFile));
+
result.setSystemId(wsdlFile.toString().replace('\\', '/'));
+ } catch (FileNotFoundException e) {
+
environment.error(getMessage("wsgen.could.not.create.file",
wsdlFile.toString()));
+ }
+ return result;
+ }
+ public Result getSchemaOutput(String namespace, String
suggestedFilename) {
+ if (namespace.equals(""))
+ return null;
+ return getWSDLOutput(suggestedFilename);
+ }
+ public Result getAbstractWSDLOutput(Holder<String>
filename) {
+ return getWSDLOutput(filename.value);
+ }
+ public Result getSchemaOutput(String namespace,
Holder<String> filename) {
+ return getSchemaOutput(namespace, filename.value);
+ }
+ }, bindingID);
+ wsdlGenerator.doGeneration();
+ }
+ }
+
+ static public String getBindingID(String protocol) {
+ if (protocol.equals(SOAP11))
+ return SOAP11_ID;
+ if (protocol.equals(X_SOAP12))
+ return SOAP12_ID;
+ return null;
+ }
+
+ public void runProcessorActions() {
+ if (!(configuration.getModelInfo() instanceof ClassModelInfo)) {
+ onError(getMessage("wscompile.classmodelinfo.expected", new
Object[] { configuration
+ .getModelInfo() }));
+ return;
+ }
+ Model model = context.getSEIContext(
+ ((ClassModelInfo)
configuration.getModelInfo()).getClassName()).getModel();
+ processor = new Processor(configuration, properties, model);
+ withModelHook();
+ registerProcessorActions(processor);
+ processor.runActions();
+ // TODO throw an error
+// if (environment.getErrorCount() != 0) {
+// }
+
+ }
+ /**
+ * @return the SourceVersion string
+ */
+ protected String getSourceVersion() {
+ if (targetVersion == null) {
+
+ /* no target specified, defaulting to the default version,
+ * which is the latest version
+ */
+ return VersionUtil.JAXWS_VERSION_DEFAULT;
+ }
+ return targetVersion;
+ }
+
+ protected void withModelHook() {
+ }
+
+ protected void afterHook() {
+ }
+
+ protected void compileGeneratedClasses() {
+ List<String> sourceFiles = new ArrayList<String>();
+
+ for (Iterator iter = environment.getGeneratedFiles(); iter.hasNext();) {
+ GeneratedFileInfo fileInfo = (GeneratedFileInfo) iter.next();
+ File f = fileInfo.getFile();
+ if (f.exists() && f.getName().endsWith(".java")) {
+ sourceFiles.add(f.getAbsolutePath());
+ }
+ }
+
+ if (sourceFiles.size() > 0) {
+ String classDir = destDir.getAbsolutePath();
+ String classpathString = createClasspathString();
+ String[] args = new String[4 + (compilerDebug ? 1 : 0)
+ + (compilerOptimize ? 1 : 0) + sourceFiles.size()];
+ args[0] = "-d";
+ args[1] = classDir;
+ args[2] = "-classpath";
+ args[3] = classpathString;
+ int baseIndex = 4;
+ if (compilerDebug) {
+ args[baseIndex++] = "-g";
+ }
+ if (compilerOptimize) {
+ args[baseIndex++] = "-O";
+ }
+ for (int i = 0; i < sourceFiles.size(); ++i) {
+ args[baseIndex + i] = sourceFiles.get(i);
+ }
+
+ // ByteArrayOutputStream javacOutput = new ByteArrayOutputStream();
+ JavaCompilerHelper compilerHelper = new JavaCompilerHelper(out);
+ boolean result = compilerHelper.compile(args);
+ if (!result) {
+ environment.error(getMessage("wscompile.compilationFailed"));
+ }
+ }
+ }
+
+ protected ProcessorAction getAction(String name) {
+ return actions.get(name);
+ }
+
+ protected String createClasspathString() {
+ if (userClasspath == null) {
+ userClasspath = "";
+ }
+ return userClasspath + File.pathSeparator +
System.getProperty("java.class.path");
+ }
+
+ protected void registerProcessorActions(Processor processor) {
+ register(processor);
+ }
+
+ protected void register(Processor processor) {
+ boolean genServiceInterface = false;
+ boolean genInterface = false;
+ boolean genCustomClasses = false;
+
+ if (configuration.getModelInfo() instanceof WSDLModelInfo) {
+ genInterface = true;
+ //genInterfaceTemplate = true;
+ genServiceInterface = true;
+ genCustomClasses = true;
+ }
+
+ if (genServiceInterface) {
+ processor.add(getAction(ActionConstants.ACTION_SERVICE_GENERATOR));
+ }
+
+ if (genCustomClasses) {
+ processor.add(getAction(ActionConstants.ACTION_JAXB_TYPE_GENERATOR));
+ }
+
+ if (genInterface) {
+ processor.add(getAction(ActionConstants.ACTION_CUSTOM_EXCEPTION_GENERATOR));
+ processor.add(getAction(ActionConstants.ACTION_REMOTE_INTERFACE_GENERATOR));
+ }
+ }
+
+ protected Configuration createConfiguration() throws Exception {
+ if (environment == null)
+ environment = createEnvironment();
+ Reader reader = new Reader(environment, properties);
+ return reader.parse(entityResolver, inputFiles);
+ }
+
+ protected void beforeHook() {
+ if (destDir == null) {
+ destDir = new File(".");
+ }
+ if (sourceDir == null) {
+ sourceDir = destDir;
+ }
+ if (nonclassDestDir == null) {
+ nonclassDestDir = destDir;
+ }
+
+ properties.setProperty(ProcessorOptions.SOURCE_DIRECTORY_PROPERTY, sourceDir
+ .getAbsolutePath());
+ properties.setProperty(ProcessorOptions.DESTINATION_DIRECTORY_PROPERTY, destDir
+ .getAbsolutePath());
+ properties.setProperty(ProcessorOptions.NONCLASS_DESTINATION_DIRECTORY_PROPERTY,
+ nonclassDestDir.getAbsolutePath());
+ properties.setProperty(ProcessorOptions.EXTENSION, (extensions ? "true"
: "false"));
+ properties.setProperty(ProcessorOptions.PRINT_STACK_TRACE_PROPERTY,
+ (verbose ? TRUE : FALSE));
+ properties.setProperty(ProcessorOptions.PROTOCOL, protocol);
+ properties.setProperty(ProcessorOptions.TRANSPORT, transport);
+ properties.setProperty(ProcessorOptions.JAXWS_SOURCE_VERSION,
getSourceVersion());
+ if(wsdlLocation != null)
+ properties.setProperty(ProcessorOptions.WSDL_LOCATION, wsdlLocation);
+ if(defaultPackage != null)
+ properties.setProperty(ProcessorOptions.DEFAULT_PACKAGE, defaultPackage);
+ properties.setProperty(ProcessorOptions.DONOT_OVERWRITE_CLASSES, (doNotOverWrite
? TRUE : FALSE));
+ }
+
+ protected String getGenericErrorMessage() {
+ return "wscompile.error";
+ }
+
+ protected String getResourceBundleName() {
+ return "org.jboss.com.sun.tools.ws.resources.wscompile";
+ }
+
+ public Collection<String> supportedOptions() {
+ return supportedOptions;
+ }
+
+ public Collection<String> supportedAnnotationTypes() {
+ return supportedAnnotations;
+ }
+
+ public void onError(Localizable msg) {
+ report(getMessage("wscompile.error", localizer.localize(msg)));
+ }
+
+ public void onWarning(Localizable msg) {
+ report(getMessage("wscompile.warning", localizer.localize(msg)));
+ }
+
+ public void onInfo(Localizable msg) {
+ report(getMessage("wscompile.info", localizer.localize(msg)));
+ }
+
+ public AnnotationProcessor getProcessorFor(Set<AnnotationTypeDeclaration>
atds,
+ AnnotationProcessorEnvironment apEnv) {
+ if (verbose)
+ apEnv.getMessager().printNotice("\tap round: " + ++round);
+ webServiceAP.init(apEnv);
+ return webServiceAP;
+ }
+
+ private Class getClass(String className) {
+ try {
+ ProcessorEnvironment env = createEnvironment();
+ return env.getClassLoader().loadClass(className);
+ } catch (ClassNotFoundException e) {
+ return null;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ private ProcessorEnvironment createEnvironment() throws Exception {
+ String cpath = userClasspath + File.pathSeparator +
System.getProperty("java.class.path");
+ ProcessorEnvironment env = new ClientProcessorEnvironment(System.out, cpath,
listener);
+ return env;
+ }
+
+ protected void usage() {
+ help();
+ //report(getMessage(program+".usage", program));
+ }
+
+ protected void help() {
+ report(getMessage(program+".help", program));
+ report(getMessage(program+".usage.examples"));
+ }
+
+ public void setEntityResolver(EntityResolver entityResolver) {
+ this.entityResolver = entityResolver;
+ }
+
+ /*
+ * Processor doesn't examine any options.
+ */
+ static final Collection<String> supportedOptions = Collections
+ .unmodifiableSet(new HashSet<String>());
+
+ /*
+ * All annotation types are supported.
+ */
+ static Collection<String> supportedAnnotations;
+ static {
+ Collection<String> types = new HashSet<String>();
+ types.add("*");
+ types.add("javax.jws.*");
+ types.add("javax.jws.soap.*");
+ supportedAnnotations = Collections.unmodifiableCollection(types);
+ }
+
+ private AnnotationProcessorContext context;
+
+ private WebServiceAP webServiceAP;
+
+ private int round = 0;
+
+ // End AnnotationProcessorFactory stuff
+ // -----------------------------------------------------------------------------
+
+ protected Properties properties;
+ protected ProcessorEnvironment environment;
+ protected Configuration configuration;
+ protected ProcessorNotificationListener listener;
+ protected Processor processor;
+ protected Map<String,ProcessorAction> actions;
+ protected List<String> inputFiles = new ArrayList<String>();
+ protected File sourceDir;
+ protected File destDir;
+ protected File nonclassDestDir;
+ protected boolean doNothing = false;
+ protected boolean compilerDebug = false;
+ protected boolean compilerOptimize = false;
+ protected boolean verbose = false;
+ protected boolean keepGenerated = false;
+ protected boolean doNotOverWrite = false;
+ protected boolean extensions = false;
+ protected String userClasspath = null;
+ protected Set<String> bindingFiles = new HashSet<String>();
+ protected boolean genWsdl = false;
+ protected String protocol = SOAP11;
+ protected boolean protocolSet = false;
+ protected String transport = HTTP;
+ protected static final String SOAP11 = "soap1.1";
+ protected static final String X_SOAP12 = "Xsoap1.2";
+ protected static final String HTTP = "http";
+ protected static final String WSIMPORT = "wsimport";
+ protected static final String WSGEN = "wsgen";
+ protected static final String SOAP11_ID =
javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING;
+ protected static final String SOAP12_ID =
javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING;
+ protected static final String VALID_PROTOCOLS = SOAP11 +", "+X_SOAP12;
+ protected static final String VALID_TRANSPORTS = "http";
+ protected String targetVersion = null;
+ protected String wsdlLocation;
+ protected String defaultPackage;
+ protected String catalog;
+ protected QName serviceName;
+ protected QName portName;
+ protected static final String PORTNAME_OPTION = "-portname";
+ protected static final String SERVICENAME_OPTION = "-servicename";
+ protected EntityResolver entityResolver;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wscompile/CompileTool.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wscompile/FilerCodeWriter.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wscompile/FilerCodeWriter.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wscompile/FilerCodeWriter.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,69 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.wscompile;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Writer;
+
+import com.sun.codemodel.CodeWriter;
+import com.sun.codemodel.JPackage;
+import java.io.BufferedOutputStream;
+
+import org.jboss.com.sun.tools.ws.processor.util.ProcessorEnvironment;
+
+import com.sun.mirror.apt.Filer;
+
+/**
+ * Writes all the source files using the specified Filer.
+ *
+ * @author WS Development Team
+ */
+public class FilerCodeWriter extends WSCodeWriter {
+
+ /** The Filer used to create files. */
+ private final Filer filer;
+
+ private Writer w;
+
+ public FilerCodeWriter(File outDir, ProcessorEnvironment env ) throws IOException {
+ super(outDir, env);
+ this.filer = env.getFiler();
+ }
+
+
+ public Writer openSource(JPackage pkg, String fileName) throws IOException {
+ String tmp = fileName.substring(0, fileName.length()-5);
+ w = filer.createSourceFile(pkg.name()+"."+tmp);
+ return w;
+ }
+
+
+ public void close() throws IOException {
+ super.close();
+ if (w != null)
+ w.close();
+ w = null;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wscompile/FilerCodeWriter.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wscompile/WSCodeWriter.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wscompile/WSCodeWriter.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wscompile/WSCodeWriter.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,63 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.wscompile;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.jboss.com.sun.tools.ws.processor.util.GeneratedFileInfo;
+import org.jboss.com.sun.tools.ws.processor.util.ProcessorEnvironment;
+
+import com.sun.codemodel.JPackage;
+import com.sun.codemodel.writer.FileCodeWriter;
+
+/**
+ * {@link FileCodeWriter} implementation that notifies
+ * JAX-WS about newly created files.
+ *
+ * @author
+ * Kohsuke Kawaguchi (kohsuke.kawaguchi(a)sun.com)
+ */
+public class WSCodeWriter extends FileCodeWriter {
+ private final ProcessorEnvironment env;
+
+ public WSCodeWriter( File outDir, ProcessorEnvironment _env ) throws IOException {
+ super(outDir);
+ this.env = _env;
+ }
+
+ protected File getFile(JPackage pkg, String fileName ) throws IOException {
+ File f = super.getFile(pkg, fileName);
+
+ // notify JAX-WS RI
+ GeneratedFileInfo fi = new GeneratedFileInfo();
+ fi.setType("JAXB"/*GeneratorConstants.FILE_TYPE_VALUETYPE*/);
+ fi.setFile(f);
+ env.addGeneratedFile(fi);
+ // we can't really tell the file type, for we don't know
+ // what this file is used for. Fortunately,
+ // FILE_TYPE doesn't seem to be used, so it doesn't really
+ // matter what we set.
+
+ return f;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wscompile/WSCodeWriter.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Binding.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Binding.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Binding.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,146 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.AbstractDocument;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Defining;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Entity;
+import org.jboss.com.sun.tools.ws.wsdl.framework.EntityAction;
+import org.jboss.com.sun.tools.ws.wsdl.framework.EntityReferenceAction;
+import org.jboss.com.sun.tools.ws.wsdl.framework.ExtensibilityHelper;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extensible;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extension;
+import org.jboss.com.sun.tools.ws.wsdl.framework.GlobalEntity;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Kind;
+import org.jboss.com.sun.tools.ws.wsdl.framework.QNameAction;
+
+
+/**
+ * Entity corresponding to the "binding" WSDL element.
+ *
+ * @author WS Development Team
+ */
+public class Binding extends GlobalEntity implements Extensible {
+
+ public Binding(Defining defining) {
+ super(defining);
+ _operations = new ArrayList();
+ _helper = new ExtensibilityHelper();
+ }
+
+ public void add(BindingOperation operation) {
+ _operations.add(operation);
+ }
+
+ public Iterator operations() {
+ return _operations.iterator();
+ }
+
+ public QName getPortType() {
+ return _portType;
+ }
+
+ public void setPortType(QName n) {
+ _portType = n;
+ }
+
+ public PortType resolvePortType(AbstractDocument document) {
+ return (PortType) document.find(Kinds.PORT_TYPE, _portType);
+ }
+
+ public Kind getKind() {
+ return Kinds.BINDING;
+ }
+
+ public QName getElementName() {
+ return WSDLConstants.QNAME_BINDING;
+ }
+
+ public Documentation getDocumentation() {
+ return _documentation;
+ }
+
+ public void setDocumentation(Documentation d) {
+ _documentation = d;
+ }
+
+ public void withAllSubEntitiesDo(EntityAction action) {
+ for (Iterator iter = _operations.iterator(); iter.hasNext();) {
+ action.perform((Entity) iter.next());
+ }
+ _helper.withAllSubEntitiesDo(action);
+ }
+
+ public void withAllQNamesDo(QNameAction action) {
+ super.withAllQNamesDo(action);
+
+ if (_portType != null) {
+ action.perform(_portType);
+ }
+ }
+
+ public void withAllEntityReferencesDo(EntityReferenceAction action) {
+ super.withAllEntityReferencesDo(action);
+ if (_portType != null) {
+ action.perform(Kinds.PORT_TYPE, _portType);
+ }
+ }
+
+ public void accept(WSDLDocumentVisitor visitor) throws Exception {
+ visitor.preVisit(this);
+ //bug fix: 4947340, extensions should be the first element
+ _helper.accept(visitor);
+ for (Iterator iter = _operations.iterator(); iter.hasNext();) {
+ ((BindingOperation) iter.next()).accept(visitor);
+ }
+ visitor.postVisit(this);
+ }
+
+ public void validateThis() {
+ if (getName() == null) {
+ failValidation("validation.missingRequiredAttribute",
"name");
+ }
+ if (_portType == null) {
+ failValidation("validation.missingRequiredAttribute",
"type");
+ }
+ }
+
+ public void addExtension(Extension e) {
+ _helper.addExtension(e);
+ }
+
+ public Iterator extensions() {
+ return _helper.extensions();
+ }
+
+ private ExtensibilityHelper _helper;
+ private Documentation _documentation;
+ private QName _portType;
+ private List _operations;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Binding.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/BindingFault.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/BindingFault.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/BindingFault.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,94 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document;
+
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.Entity;
+import org.jboss.com.sun.tools.ws.wsdl.framework.EntityAction;
+import org.jboss.com.sun.tools.ws.wsdl.framework.ExtensibilityHelper;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extensible;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extension;
+
+
+/**
+ * Entity corresponding to the "fault" child element of a binding operation.
+ *
+ * @author WS Development Team
+ */
+public class BindingFault extends Entity implements Extensible {
+
+ public BindingFault() {
+ _helper = new ExtensibilityHelper();
+ }
+
+ public String getName() {
+ return _name;
+ }
+
+ public void setName(String name) {
+ _name = name;
+ }
+
+ public QName getElementName() {
+ return WSDLConstants.QNAME_FAULT;
+ }
+
+ public Documentation getDocumentation() {
+ return _documentation;
+ }
+
+ public void setDocumentation(Documentation d) {
+ _documentation = d;
+ }
+
+ public void addExtension(Extension e) {
+ _helper.addExtension(e);
+ }
+
+ public Iterator extensions() {
+ return _helper.extensions();
+ }
+
+ public void withAllSubEntitiesDo(EntityAction action) {
+ _helper.withAllSubEntitiesDo(action);
+ }
+
+ public void accept(WSDLDocumentVisitor visitor) throws Exception {
+ visitor.preVisit(this);
+ _helper.accept(visitor);
+ visitor.postVisit(this);
+ }
+
+ public void validateThis() {
+ if (_name == null) {
+ failValidation("validation.missingRequiredAttribute",
"name");
+ }
+ }
+
+ private ExtensibilityHelper _helper;
+ private Documentation _documentation;
+ private String _name;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/BindingFault.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/BindingInput.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/BindingInput.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/BindingInput.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,89 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document;
+
+import java.util.Iterator;
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.Entity;
+import org.jboss.com.sun.tools.ws.wsdl.framework.EntityAction;
+import org.jboss.com.sun.tools.ws.wsdl.framework.ExtensibilityHelper;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extensible;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extension;
+
+/**
+ * Entity corresponding to the "input" child element of a binding operation.
+ *
+ * @author WS Development Team
+ */
+public class BindingInput extends Entity implements Extensible {
+
+ public BindingInput() {
+ _helper = new ExtensibilityHelper();
+ }
+
+ public String getName() {
+ return _name;
+ }
+
+ public void setName(String name) {
+ _name = name;
+ }
+
+ public QName getElementName() {
+ return WSDLConstants.QNAME_INPUT;
+ }
+
+ public Documentation getDocumentation() {
+ return _documentation;
+ }
+
+ public void setDocumentation(Documentation d) {
+ _documentation = d;
+ }
+
+ public void addExtension(Extension e) {
+ _helper.addExtension(e);
+ }
+
+ public Iterator extensions() {
+ return _helper.extensions();
+ }
+
+ public void withAllSubEntitiesDo(EntityAction action) {
+ _helper.withAllSubEntitiesDo(action);
+ }
+
+ public void accept(WSDLDocumentVisitor visitor) throws Exception {
+ visitor.preVisit(this);
+ _helper.accept(visitor);
+ visitor.postVisit(this);
+ }
+
+ public void validateThis() {
+ }
+
+ private ExtensibilityHelper _helper;
+ private Documentation _documentation;
+ private String _name;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/BindingInput.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/BindingOperation.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/BindingOperation.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/BindingOperation.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,201 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.Entity;
+import org.jboss.com.sun.tools.ws.wsdl.framework.EntityAction;
+import org.jboss.com.sun.tools.ws.wsdl.framework.ExtensibilityHelper;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extensible;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extension;
+
+
+/**
+ * Entity corresponding to the "operation" child element of a WSDL
"binding" element.
+ *
+ * @author WS Development Team
+ */
+public class BindingOperation extends Entity implements Extensible {
+
+ public BindingOperation() {
+ _faults = new ArrayList();
+ _helper = new ExtensibilityHelper();
+ }
+
+ public String getName() {
+ return _name;
+ }
+
+ public void setName(String name) {
+ _name = name;
+ }
+
+ public String getUniqueKey() {
+ if (_uniqueKey == null) {
+ StringBuffer sb = new StringBuffer();
+ sb.append(_name);
+ sb.append(' ');
+ if (_input != null) {
+ sb.append(_input.getName());
+ } else {
+ sb.append(_name);
+ if (_style == OperationStyle.REQUEST_RESPONSE) {
+ sb.append("Request");
+ } else if (_style == OperationStyle.SOLICIT_RESPONSE) {
+ sb.append("Response");
+ }
+ }
+ sb.append(' ');
+ if (_output != null) {
+ sb.append(_output.getName());
+ } else {
+ sb.append(_name);
+ if (_style == OperationStyle.SOLICIT_RESPONSE) {
+ sb.append("Solicit");
+ } else if (_style == OperationStyle.REQUEST_RESPONSE) {
+ sb.append("Response");
+ }
+ }
+ _uniqueKey = sb.toString();
+ }
+
+ return _uniqueKey;
+ }
+
+ public OperationStyle getStyle() {
+ return _style;
+ }
+
+ public void setStyle(OperationStyle s) {
+ _style = s;
+ }
+
+ public BindingInput getInput() {
+ return _input;
+ }
+
+ public void setInput(BindingInput i) {
+ _input = i;
+ }
+
+ public BindingOutput getOutput() {
+ return _output;
+ }
+
+ public void setOutput(BindingOutput o) {
+ _output = o;
+ }
+
+ public void addFault(BindingFault f) {
+ _faults.add(f);
+ }
+
+ public Iterator faults() {
+ return _faults.iterator();
+ }
+
+ public QName getElementName() {
+ return WSDLConstants.QNAME_OPERATION;
+ }
+
+ public Documentation getDocumentation() {
+ return _documentation;
+ }
+
+ public void setDocumentation(Documentation d) {
+ _documentation = d;
+ }
+
+ public void addExtension(Extension e) {
+ _helper.addExtension(e);
+ }
+
+ public Iterator extensions() {
+ return _helper.extensions();
+ }
+
+ public void withAllSubEntitiesDo(EntityAction action) {
+ if (_input != null) {
+ action.perform(_input);
+ }
+ if (_output != null) {
+ action.perform(_output);
+ }
+ for (Iterator iter = _faults.iterator(); iter.hasNext();) {
+ action.perform((Entity) iter.next());
+ }
+ _helper.withAllSubEntitiesDo(action);
+ }
+
+ public void accept(WSDLDocumentVisitor visitor) throws Exception {
+ visitor.preVisit(this);
+ //bug fix: 4947340, extensions should be the first element
+ _helper.accept(visitor);
+ if (_input != null) {
+ _input.accept(visitor);
+ }
+ if (_output != null) {
+ _output.accept(visitor);
+ }
+ for (Iterator iter = _faults.iterator(); iter.hasNext();) {
+ ((BindingFault) iter.next()).accept(visitor);
+ }
+ visitor.postVisit(this);
+ }
+
+ public void validateThis() {
+ if (_name == null) {
+ failValidation("validation.missingRequiredAttribute",
"name");
+ }
+ if (_style == null) {
+ failValidation("validation.missingRequiredProperty",
"style");
+ }
+
+ // verify operation style
+ if (_style == OperationStyle.ONE_WAY) {
+ if (_input == null) {
+ failValidation("validation.missingRequiredSubEntity",
"input");
+ }
+ if (_output != null) {
+ failValidation("validation.invalidSubEntity",
"output");
+ }
+ if (_faults != null && _faults.size() != 0) {
+ failValidation("validation.invalidSubEntity",
"fault");
+ }
+ }
+ }
+
+ private ExtensibilityHelper _helper;
+ private Documentation _documentation;
+ private String _name;
+ private BindingInput _input;
+ private BindingOutput _output;
+ private List _faults;
+ private OperationStyle _style;
+ private String _uniqueKey;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/BindingOperation.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/BindingOutput.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/BindingOutput.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/BindingOutput.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,91 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document;
+
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.Entity;
+import org.jboss.com.sun.tools.ws.wsdl.framework.EntityAction;
+import org.jboss.com.sun.tools.ws.wsdl.framework.ExtensibilityHelper;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extensible;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extension;
+
+
+/**
+ * Entity corresponding to the "output" child element of a binding operation.
+ *
+ * @author WS Development Team
+ */
+public class BindingOutput extends Entity implements Extensible {
+
+ public BindingOutput() {
+ _helper = new ExtensibilityHelper();
+ }
+
+ public String getName() {
+ return _name;
+ }
+
+ public void setName(String name) {
+ _name = name;
+ }
+
+ public QName getElementName() {
+ return WSDLConstants.QNAME_OUTPUT;
+ }
+
+ public Documentation getDocumentation() {
+ return _documentation;
+ }
+
+ public void setDocumentation(Documentation d) {
+ _documentation = d;
+ }
+
+ public void addExtension(Extension e) {
+ _helper.addExtension(e);
+ }
+
+ public Iterator extensions() {
+ return _helper.extensions();
+ }
+
+ public void withAllSubEntitiesDo(EntityAction action) {
+ _helper.withAllSubEntitiesDo(action);
+ }
+
+ public void accept(WSDLDocumentVisitor visitor) throws Exception {
+ visitor.preVisit(this);
+ _helper.accept(visitor);
+ visitor.postVisit(this);
+ }
+
+ public void validateThis() {
+ }
+
+ private ExtensibilityHelper _helper;
+ private Documentation _documentation;
+ private String _name;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/BindingOutput.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Definitions.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Definitions.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Definitions.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,219 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.AbstractDocument;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Defining;
+import org.jboss.com.sun.tools.ws.wsdl.framework.DuplicateEntityException;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Entity;
+import org.jboss.com.sun.tools.ws.wsdl.framework.EntityAction;
+import org.jboss.com.sun.tools.ws.wsdl.framework.ExtensibilityHelper;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extensible;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extension;
+
+
+/**
+ * Entity corresponding to the "definitions" WSDL element.
+ *
+ * @author WS Development Team
+ */
+public class Definitions extends Entity implements Defining, Extensible {
+
+ public Definitions(AbstractDocument document) {
+ _document = document;
+ _bindings = new ArrayList();
+ _imports = new ArrayList();
+ _messages = new ArrayList();
+ _portTypes = new ArrayList();
+ _services = new ArrayList();
+ _importedNamespaces = new HashSet();
+ _helper = new ExtensibilityHelper();
+ }
+
+ public String getName() {
+ return _name;
+ }
+
+ public void setName(String s) {
+ _name = s;
+ }
+
+ public String getTargetNamespaceURI() {
+ return _targetNsURI;
+ }
+
+ public void setTargetNamespaceURI(String s) {
+ _targetNsURI = s;
+ }
+
+ public void setTypes(Types t) {
+ _types = t;
+ }
+
+ public Types getTypes() {
+ return _types;
+ }
+
+ public void add(Message m) {
+ _document.define(m);
+ _messages.add(m);
+ }
+
+ public void add(PortType p) {
+ _document.define(p);
+ _portTypes.add(p);
+ }
+
+ public void add(Binding b) {
+ _document.define(b);
+ _bindings.add(b);
+ }
+
+ public void add(Service s) {
+ _document.define(s);
+ _services.add(s);
+ }
+
+ public void addServiceOveride(Service s) {
+ _services.add(s);
+ }
+
+ public void add(Import i) {
+ _imports.add(i);
+ _importedNamespaces.add(i.getNamespace());
+ }
+
+ public Iterator imports() {
+ return _imports.iterator();
+ }
+
+ public Iterator messages() {
+ return _messages.iterator();
+ }
+
+ public Iterator portTypes() {
+ return _portTypes.iterator();
+ }
+
+ public Iterator bindings() {
+ return _bindings.iterator();
+ }
+
+ public Iterator<Service> services() {
+ return _services.iterator();
+ }
+
+ public QName getElementName() {
+ return WSDLConstants.QNAME_DEFINITIONS;
+ }
+
+ public Documentation getDocumentation() {
+ return _documentation;
+ }
+
+ public void setDocumentation(Documentation d) {
+ _documentation = d;
+ }
+
+ public void addExtension(Extension e) {
+ _helper.addExtension(e);
+ }
+
+ public Iterator extensions() {
+ return _helper.extensions();
+ }
+
+ public void withAllSubEntitiesDo(EntityAction action) {
+ if (_types != null) {
+ action.perform(_types);
+ }
+ for (Iterator iter = _messages.iterator(); iter.hasNext();) {
+ action.perform((Entity) iter.next());
+ }
+ for (Iterator iter = _portTypes.iterator(); iter.hasNext();) {
+ action.perform((Entity) iter.next());
+ }
+ for (Iterator iter = _bindings.iterator(); iter.hasNext();) {
+ action.perform((Entity) iter.next());
+ }
+ for (Iterator iter = _services.iterator(); iter.hasNext();) {
+ action.perform((Entity) iter.next());
+ }
+ for (Iterator iter = _imports.iterator(); iter.hasNext();) {
+ action.perform((Entity) iter.next());
+ }
+ _helper.withAllSubEntitiesDo(action);
+ }
+
+ public void accept(WSDLDocumentVisitor visitor) throws Exception {
+ visitor.preVisit(this);
+
+ for (Iterator iter = _imports.iterator(); iter.hasNext();) {
+ ((Import) iter.next()).accept(visitor);
+ }
+
+ if (_types != null) {
+ _types.accept(visitor);
+ }
+
+ for (Iterator iter = _messages.iterator(); iter.hasNext();) {
+ ((Message) iter.next()).accept(visitor);
+ }
+ for (Iterator iter = _portTypes.iterator(); iter.hasNext();) {
+ ((PortType) iter.next()).accept(visitor);
+ }
+ for (Iterator iter = _bindings.iterator(); iter.hasNext();) {
+ ((Binding) iter.next()).accept(visitor);
+ }
+ for (Iterator iter = _services.iterator(); iter.hasNext();) {
+ ((Service) iter.next()).accept(visitor);
+ }
+
+ _helper.accept(visitor);
+ visitor.postVisit(this);
+ }
+
+ public void validateThis() {
+ }
+
+ private AbstractDocument _document;
+ private ExtensibilityHelper _helper;
+ private Documentation _documentation;
+ private String _name;
+ private String _targetNsURI;
+ private Types _types;
+ private List _messages;
+ private List _portTypes;
+ private List _bindings;
+ private List<Service> _services;
+ private List _imports;
+ private Set _importedNamespaces;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Definitions.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Documentation.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Documentation.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Documentation.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,49 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document;
+
+/**
+ * Entity corresponding to the "documentation" WSDL element.
+ *
+ * @author WS Development Team
+ */
+public class Documentation {
+
+ public Documentation(String s) {
+ content = s;
+ }
+
+ public String getContent() {
+ return content;
+ }
+
+ public void setContent(String s) {
+ content = s;
+ }
+
+ public void accept(WSDLDocumentVisitor visitor) throws Exception {
+ visitor.visit(this);
+ }
+
+ private String content;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Documentation.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Fault.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Fault.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Fault.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,127 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document;
+
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.AbstractDocument;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Entity;
+import org.jboss.com.sun.tools.ws.wsdl.framework.EntityReferenceAction;
+import org.jboss.com.sun.tools.ws.wsdl.framework.ExtensibilityHelper;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extensible;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extension;
+import org.jboss.com.sun.tools.ws.wsdl.framework.QNameAction;
+
+
+/**
+ * Entity corresponding to the "fault" child element of a port type operation.
+ *
+ * @author WS Development Team
+ */
+public class Fault extends Entity implements Extensible{
+
+ public Fault() {
+ _helper = new ExtensibilityHelper();
+ }
+
+ public String getName() {
+ return _name;
+ }
+
+ public void setName(String name) {
+ _name = name;
+ }
+
+ public QName getMessage() {
+ return _message;
+ }
+
+ public void setMessage(QName n) {
+ _message = n;
+ }
+
+ public Message resolveMessage(AbstractDocument document) {
+ return (Message) document.find(Kinds.MESSAGE, _message);
+ }
+
+ public QName getElementName() {
+ return WSDLConstants.QNAME_FAULT;
+ }
+
+ public Documentation getDocumentation() {
+ return _documentation;
+ }
+
+ public void setDocumentation(Documentation d) {
+ _documentation = d;
+ }
+
+ public void withAllQNamesDo(QNameAction action) {
+ if (_message != null) {
+ action.perform(_message);
+ }
+ }
+
+ public void withAllEntityReferencesDo(EntityReferenceAction action) {
+ super.withAllEntityReferencesDo(action);
+ if (_message != null) {
+ action.perform(Kinds.MESSAGE, _message);
+ }
+ }
+
+ public void accept(WSDLDocumentVisitor visitor) throws Exception {
+ visitor.preVisit(this);
+ visitor.postVisit(this);
+ }
+
+ public void validateThis() {
+ if (_name == null) {
+ failValidation("validation.missingRequiredAttribute",
"name");
+ }
+ if (_message == null) {
+ failValidation("validation.missingRequiredAttribute",
"message");
+ }
+ }
+
+ private Documentation _documentation;
+ private String _name;
+ private QName _message;
+ private ExtensibilityHelper _helper;
+
+ /* (non-Javadoc)
+ * @see Extensible#addExtension(Extension)
+ */
+ public void addExtension(Extension e) {
+ _helper.addExtension(e);
+
+ }
+
+ /* (non-Javadoc)
+ * @see Extensible#extensions()
+ */
+ public Iterator extensions() {
+ return _helper.extensions();
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Fault.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Import.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Import.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Import.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,84 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.Entity;
+
+
+/**
+ * Entity corresponding to the "import" WSDL element.
+ *
+ * @author WS Development Team
+ */
+public class Import extends Entity{
+
+ public Import() {
+ }
+
+ public String getNamespace() {
+ return _namespace;
+ }
+
+ public void setNamespace(String s) {
+ _namespace = s;
+ }
+
+ public String getLocation() {
+ return _location;
+ }
+
+ public void setLocation(String s) {
+ _location = s;
+ }
+
+ public QName getElementName() {
+ return WSDLConstants.QNAME_IMPORT;
+ }
+
+ public Documentation getDocumentation() {
+ return _documentation;
+ }
+
+ public void setDocumentation(Documentation d) {
+ _documentation = d;
+ }
+
+ public void accept(WSDLDocumentVisitor visitor) throws Exception {
+ visitor.visit(this);
+ }
+
+ public void validateThis() {
+ if (_location == null) {
+ failValidation("validation.missingRequiredAttribute",
"location");
+ }
+ if (_namespace == null) {
+ failValidation("validation.missingRequiredAttribute",
"namespace");
+ }
+ }
+
+ private Documentation _documentation;
+ private String _location;
+ private String _namespace;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Import.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Input.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Input.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Input.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,102 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.AbstractDocument;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Entity;
+import org.jboss.com.sun.tools.ws.wsdl.framework.EntityReferenceAction;
+import org.jboss.com.sun.tools.ws.wsdl.framework.QNameAction;
+
+
+/**
+ * Entity corresponding to the "input" child element of a port type operation.
+ *
+ * @author WS Development Team
+ */
+public class Input extends Entity {
+
+ public Input() {
+ }
+
+ public String getName() {
+ return _name;
+ }
+
+ public void setName(String name) {
+ _name = name;
+ }
+
+ public QName getMessage() {
+ return _message;
+ }
+
+ public void setMessage(QName n) {
+ _message = n;
+ }
+
+ public Message resolveMessage(AbstractDocument document) {
+ return (Message) document.find(Kinds.MESSAGE, _message);
+ }
+
+ public QName getElementName() {
+ return WSDLConstants.QNAME_INPUT;
+ }
+
+ public Documentation getDocumentation() {
+ return _documentation;
+ }
+
+ public void setDocumentation(Documentation d) {
+ _documentation = d;
+ }
+
+ public void withAllQNamesDo(QNameAction action) {
+ if (_message != null) {
+ action.perform(_message);
+ }
+ }
+
+ public void withAllEntityReferencesDo(EntityReferenceAction action) {
+ super.withAllEntityReferencesDo(action);
+ if (_message != null) {
+ action.perform(Kinds.MESSAGE, _message);
+ }
+ }
+
+ public void accept(WSDLDocumentVisitor visitor) throws Exception {
+ visitor.preVisit(this);
+ visitor.postVisit(this);
+ }
+
+ public void validateThis() {
+ if (_message == null) {
+ failValidation("validation.missingRequiredAttribute",
"message");
+ }
+ }
+
+ private Documentation _documentation;
+ private String _name;
+ private QName _message;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Input.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Kinds.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Kinds.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Kinds.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,41 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.Kind;
+
+/**
+ * Enumeration of the kind of entities that can be defined in a WSDL
"definitions" element.
+ *
+ * @author WS Development Team
+ */
+public class Kinds {
+ public static final Kind BINDING = new Kind("wsdl:binding");
+ public static final Kind MESSAGE = new Kind("wsdl:message");
+ public static final Kind PORT = new Kind("wsdl:port");
+ public static final Kind PORT_TYPE = new Kind("wsdl:portType");
+ public static final Kind SERVICE = new Kind("wsdl:service");
+
+ private Kinds() {
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Kinds.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Message.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Message.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Message.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,120 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.Defining;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Entity;
+import org.jboss.com.sun.tools.ws.wsdl.framework.EntityAction;
+import org.jboss.com.sun.tools.ws.wsdl.framework.GlobalEntity;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Kind;
+import org.jboss.com.sun.tools.ws.wsdl.framework.ValidationException;
+
+
+/**
+ * Entity corresponding to the "message" WSDL element.
+ *
+ * @author WS Development Team
+ */
+public class Message extends GlobalEntity {
+
+ public Message(Defining defining) {
+ super(defining);
+ _parts = new ArrayList<MessagePart>();
+ _partsByName = new HashMap<String, MessagePart>();
+ }
+
+ public void add(MessagePart part) {
+ if (_partsByName.get(part.getName()) != null)
+ throw new ValidationException(
+ "validation.duplicateName",
+ part.getName());
+ _partsByName.put(part.getName(), part);
+ _parts.add(part);
+ }
+
+ public Iterator<MessagePart> parts() {
+ return _parts.iterator();
+ }
+
+ public List<MessagePart> getParts(){
+ return _parts;
+ }
+
+ public MessagePart getPart(String name) {
+ return _partsByName.get(name);
+ }
+
+ public int numParts() {
+ return _parts.size();
+ }
+
+ public Kind getKind() {
+ return Kinds.MESSAGE;
+ }
+
+ public QName getElementName() {
+ return WSDLConstants.QNAME_MESSAGE;
+ }
+
+ public Documentation getDocumentation() {
+ return _documentation;
+ }
+
+ public void setDocumentation(Documentation d) {
+ _documentation = d;
+ }
+
+ public void withAllSubEntitiesDo(EntityAction action) {
+ super.withAllSubEntitiesDo(action);
+
+ for (Iterator iter = _parts.iterator(); iter.hasNext();) {
+ action.perform((Entity) iter.next());
+ }
+ }
+
+ public void accept(WSDLDocumentVisitor visitor) throws Exception {
+ visitor.preVisit(this);
+ for (Iterator<MessagePart> iter = _parts.iterator(); iter.hasNext();) {
+ iter.next().accept(visitor);
+ }
+ visitor.postVisit(this);
+ }
+
+ public void validateThis() {
+ if (getName() == null) {
+ failValidation("validation.missingRequiredAttribute",
"name");
+ }
+ }
+
+ private Documentation _documentation;
+ private List<MessagePart> _parts;
+ private Map<String, MessagePart> _partsByName;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Message.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/MessagePart.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/MessagePart.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/MessagePart.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,155 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.Entity;
+import org.jboss.com.sun.tools.ws.wsdl.framework.EntityReferenceAction;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Kind;
+import org.jboss.com.sun.tools.ws.wsdl.framework.QNameAction;
+import org.jboss.com.sun.xml.ws.model.Mode;
+
+
+/**
+ * Entity corresponding to a WSDL message part.
+ *
+ * @author WS Development Team
+ */
+public class MessagePart extends Entity {
+
+ public static final int SOAP_BODY_BINDING = 1;
+ public static final int SOAP_HEADER_BINDING = 2;
+ public static final int SOAP_HEADERFAULT_BINDING = 3;
+ public static final int SOAP_FAULT_BINDING = 4;
+ public static final int WSDL_MIME_BINDING = 5;
+ public static final int PART_NOT_BOUNDED = -1;
+
+ public MessagePart() {
+ }
+
+ public String getName() {
+ return _name;
+ }
+
+ public void setName(String name) {
+ _name = name;
+ }
+
+ public QName getDescriptor() {
+ return _descriptor;
+ }
+
+ public void setDescriptor(QName n) {
+ _descriptor = n;
+ }
+
+ public Kind getDescriptorKind() {
+ return _descriptorKind;
+ }
+
+ public void setDescriptorKind(Kind k) {
+ _descriptorKind = k;
+ }
+
+ public QName getElementName() {
+ return WSDLConstants.QNAME_PART;
+ }
+
+ public int getBindingExtensibilityElementKind(){
+ return _bindingKind;
+ }
+
+ public void setBindingExtensibilityElementKind(int kind) {
+ _bindingKind = kind;
+ }
+
+ public void withAllQNamesDo(QNameAction action) {
+ if (_descriptor != null) {
+ action.perform(_descriptor);
+ }
+ }
+
+ public void withAllEntityReferencesDo(EntityReferenceAction action) {
+ super.withAllEntityReferencesDo(action);
+ if (_descriptor != null && _descriptorKind != null) {
+ action.perform(_descriptorKind, _descriptor);
+ }
+ }
+
+ public void accept(WSDLDocumentVisitor visitor) throws Exception {
+ visitor.visit(this);
+ }
+
+ public void validateThis() {
+// if (_descriptorKind == null || _descriptor == null) {
+// failValidation("validation.missingRequiredProperty",
"descriptor");
+// }else
+ if(_descriptor != null &&
_descriptor.getLocalPart().equals("")){
+ failValidation("validation.invalidElement",
_descriptor.toString());
+ }
+ }
+
+ public void setMode(Mode mode){
+ this.mode = mode;
+ }
+
+ public Mode getMode(){
+ return mode;
+ }
+
+ public boolean isINOUT(){
+ if(mode!=null)
+ return (mode == Mode.INOUT);
+ return false;
+ }
+
+ public boolean isIN(){
+ if(mode!=null)
+ return (mode == Mode.IN);
+ return false;
+ }
+
+ public boolean isOUT(){
+ if(mode!=null)
+ return (mode == Mode.OUT);
+ return false;
+ }
+
+ public void setReturn(boolean ret){
+ isRet=ret;
+ }
+
+ public boolean isReturn(){
+ return isRet;
+ }
+
+
+ private boolean isRet;
+ private String _name;
+ private QName _descriptor;
+ private Kind _descriptorKind;
+ private int _bindingKind;
+
+ private Mode mode;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/MessagePart.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Operation.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Operation.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Operation.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,225 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.Entity;
+import org.jboss.com.sun.tools.ws.wsdl.framework.EntityAction;
+import org.jboss.com.sun.tools.ws.wsdl.framework.ExtensibilityHelper;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extensible;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extension;
+
+
+/**
+ * Entity corresponding to the "operation" child element of a
"portType" WSDL element.
+ *
+ * @author WS Development Team
+ */
+public class Operation extends Entity implements Extensible{
+
+ public Operation() {
+ _faults = new ArrayList();
+ _helper = new ExtensibilityHelper();
+ }
+
+ public String getName() {
+ return _name;
+ }
+
+ public void setName(String name) {
+ _name = name;
+ }
+
+ public String getUniqueKey() {
+ if (_uniqueKey == null) {
+ StringBuffer sb = new StringBuffer();
+ sb.append(_name);
+ sb.append(' ');
+ if (_input != null) {
+ sb.append(_input.getName());
+ } else {
+ sb.append(_name);
+ if (_style == OperationStyle.REQUEST_RESPONSE) {
+ sb.append("Request");
+ } else if (_style == OperationStyle.SOLICIT_RESPONSE) {
+ sb.append("Response");
+ }
+ }
+ sb.append(' ');
+ if (_output != null) {
+ sb.append(_output.getName());
+ } else {
+ sb.append(_name);
+ if (_style == OperationStyle.SOLICIT_RESPONSE) {
+ sb.append("Solicit");
+ } else if (_style == OperationStyle.REQUEST_RESPONSE) {
+ sb.append("Response");
+ }
+ }
+ _uniqueKey = sb.toString();
+ }
+
+ return _uniqueKey;
+ }
+
+ public OperationStyle getStyle() {
+ return _style;
+ }
+
+ public void setStyle(OperationStyle s) {
+ _style = s;
+ }
+
+ public Input getInput() {
+ return _input;
+ }
+
+ public void setInput(Input i) {
+ _input = i;
+ }
+
+ public Output getOutput() {
+ return _output;
+ }
+
+ public void setOutput(Output o) {
+ _output = o;
+ }
+
+ public void addFault(Fault f) {
+ _faults.add(f);
+ }
+
+ public Iterator faults() {
+ return _faults.iterator();
+ }
+
+ public String getParameterOrder() {
+ return _parameterOrder;
+ }
+
+ public void setParameterOrder(String s) {
+ _parameterOrder = s;
+ }
+
+ public QName getElementName() {
+ return WSDLConstants.QNAME_OPERATION;
+ }
+
+ public Documentation getDocumentation() {
+ return _documentation;
+ }
+
+ public void setDocumentation(Documentation d) {
+ _documentation = d;
+ }
+
+ public void withAllSubEntitiesDo(EntityAction action) {
+ super.withAllSubEntitiesDo(action);
+
+ if (_input != null) {
+ action.perform(_input);
+ }
+ if (_output != null) {
+ action.perform(_output);
+ }
+ for (Iterator iter = _faults.iterator(); iter.hasNext();) {
+ action.perform((Entity) iter.next());
+ }
+ _helper.withAllSubEntitiesDo(action);
+ }
+
+ public void accept(WSDLDocumentVisitor visitor) throws Exception {
+ visitor.preVisit(this);
+ if (_input != null) {
+ _input.accept(visitor);
+ }
+ if (_output != null) {
+ _output.accept(visitor);
+ }
+ for (Iterator iter = _faults.iterator(); iter.hasNext();) {
+ ((Fault) iter.next()).accept(visitor);
+ }
+ visitor.postVisit(this);
+ }
+
+ public void validateThis() {
+ if (_name == null) {
+ failValidation("validation.missingRequiredAttribute",
"name");
+ }
+ if (_style == null) {
+ failValidation("validation.missingRequiredProperty",
"style");
+ }
+
+ // verify operation style
+ if (_style == OperationStyle.ONE_WAY) {
+ if (_input == null) {
+ failValidation("validation.missingRequiredSubEntity",
"input");
+ }
+ if (_output != null) {
+ failValidation("validation.invalidSubEntity",
"output");
+ }
+ if (_faults != null && _faults.size() != 0) {
+ failValidation("validation.invalidSubEntity",
"fault");
+ }
+ if (_parameterOrder != null) {
+ failValidation("validation.invalidAttribute",
"parameterOrder");
+ }
+ } else if (_style == OperationStyle.NOTIFICATION) {
+ if (_parameterOrder != null) {
+ failValidation("validation.invalidAttribute",
"parameterOrder");
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see Extensible#addExtension(Extension)
+ */
+ public void addExtension(Extension e) {
+ _helper.addExtension(e);
+
+ }
+
+ /* (non-Javadoc)
+ * @see Extensible#extensions()
+ */
+ public Iterator extensions() {
+ return _helper.extensions();
+ }
+
+
+ private Documentation _documentation;
+ private String _name;
+ private Input _input;
+ private Output _output;
+ private List _faults;
+ private OperationStyle _style;
+ private String _parameterOrder;
+ private String _uniqueKey;
+ private ExtensibilityHelper _helper;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Operation.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/OperationStyle.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/OperationStyle.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/OperationStyle.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,39 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document;
+
+/**
+ * Enumeration of the supported WSDL operation styles.
+ *
+ * @author WS Development Team
+ */
+public final class OperationStyle {
+
+ public static final OperationStyle ONE_WAY = new OperationStyle();
+ public static final OperationStyle REQUEST_RESPONSE = new OperationStyle();
+ public static final OperationStyle SOLICIT_RESPONSE = new OperationStyle();
+ public static final OperationStyle NOTIFICATION = new OperationStyle();
+
+ private OperationStyle() {
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/OperationStyle.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Output.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Output.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Output.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,102 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.AbstractDocument;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Entity;
+import org.jboss.com.sun.tools.ws.wsdl.framework.EntityReferenceAction;
+import org.jboss.com.sun.tools.ws.wsdl.framework.QNameAction;
+
+
+/**
+ * Entity corresponding to the "output" child element of a port type
operation.
+ *
+ * @author WS Development Team
+ */
+public class Output extends Entity {
+
+ public Output() {
+ }
+
+ public String getName() {
+ return _name;
+ }
+
+ public void setName(String name) {
+ _name = name;
+ }
+
+ public QName getMessage() {
+ return _message;
+ }
+
+ public void setMessage(QName n) {
+ _message = n;
+ }
+
+ public Message resolveMessage(AbstractDocument document) {
+ return (Message) document.find(Kinds.MESSAGE, _message);
+ }
+
+ public QName getElementName() {
+ return WSDLConstants.QNAME_OUTPUT;
+ }
+
+ public Documentation getDocumentation() {
+ return _documentation;
+ }
+
+ public void setDocumentation(Documentation d) {
+ _documentation = d;
+ }
+
+ public void withAllQNamesDo(QNameAction action) {
+ if (_message != null) {
+ action.perform(_message);
+ }
+ }
+
+ public void withAllEntityReferencesDo(EntityReferenceAction action) {
+ super.withAllEntityReferencesDo(action);
+ if (_message != null) {
+ action.perform(Kinds.MESSAGE, _message);
+ }
+ }
+
+ public void accept(WSDLDocumentVisitor visitor) throws Exception {
+ visitor.preVisit(this);
+ visitor.postVisit(this);
+ }
+
+ public void validateThis() {
+ if (_message == null) {
+ failValidation("validation.missingRequiredAttribute",
"message");
+ }
+ }
+
+ private Documentation _documentation;
+ private String _name;
+ private QName _message;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Output.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Port.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Port.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Port.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,135 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document;
+
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.AbstractDocument;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Defining;
+import org.jboss.com.sun.tools.ws.wsdl.framework.EntityAction;
+import org.jboss.com.sun.tools.ws.wsdl.framework.EntityReferenceAction;
+import org.jboss.com.sun.tools.ws.wsdl.framework.ExtensibilityHelper;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extensible;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extension;
+import org.jboss.com.sun.tools.ws.wsdl.framework.GlobalEntity;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Kind;
+import org.jboss.com.sun.tools.ws.wsdl.framework.QNameAction;
+
+
+/**
+ * Entity corresponding to the "port" WSDL element.
+ *
+ * @author WS Development Team
+ */
+public class Port extends GlobalEntity implements Extensible {
+
+ public Port(Defining defining) {
+ super(defining);
+ _helper = new ExtensibilityHelper();
+ }
+
+ public Service getService() {
+ return _service;
+ }
+
+ public void setService(Service s) {
+ _service = s;
+ }
+
+ public QName getBinding() {
+ return _binding;
+ }
+
+ public void setBinding(QName n) {
+ _binding = n;
+ }
+
+ public Binding resolveBinding(AbstractDocument document) {
+ return (Binding) document.find(Kinds.BINDING, _binding);
+ }
+
+ public Kind getKind() {
+ return Kinds.PORT;
+ }
+
+ public QName getElementName() {
+ return WSDLConstants.QNAME_PORT;
+ }
+
+ public Documentation getDocumentation() {
+ return _documentation;
+ }
+
+ public void setDocumentation(Documentation d) {
+ _documentation = d;
+ }
+
+ public void withAllQNamesDo(QNameAction action) {
+ super.withAllQNamesDo(action);
+
+ if (_binding != null) {
+ action.perform(_binding);
+ }
+ }
+
+ public void withAllEntityReferencesDo(EntityReferenceAction action) {
+ super.withAllEntityReferencesDo(action);
+ if (_binding != null) {
+ action.perform(Kinds.BINDING, _binding);
+ }
+ }
+
+ public void accept(WSDLDocumentVisitor visitor) throws Exception {
+ visitor.preVisit(this);
+ _helper.accept(visitor);
+ visitor.postVisit(this);
+ }
+
+ public void validateThis() {
+ if (getName() == null) {
+ failValidation("validation.missingRequiredAttribute",
"name");
+ }
+ if (_binding == null) {
+ failValidation("validation.missingRequiredAttribute",
"binding");
+ }
+ }
+
+ public void addExtension(Extension e) {
+ _helper.addExtension(e);
+ }
+
+ public Iterator extensions() {
+ return _helper.extensions();
+ }
+
+ public void withAllSubEntitiesDo(EntityAction action) {
+ _helper.withAllSubEntitiesDo(action);
+ }
+
+ private ExtensibilityHelper _helper;
+ private Documentation _documentation;
+ private Service _service;
+ private QName _binding;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Port.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/PortType.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/PortType.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/PortType.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,142 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.Defining;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Entity;
+import org.jboss.com.sun.tools.ws.wsdl.framework.EntityAction;
+import org.jboss.com.sun.tools.ws.wsdl.framework.ExtensibilityHelper;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extensible;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extension;
+import org.jboss.com.sun.tools.ws.wsdl.framework.GlobalEntity;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Kind;
+import org.jboss.com.sun.tools.ws.wsdl.framework.ValidationException;
+
+
+/**
+ * Entity corresponding to the "portType" WSDL element.
+ *
+ * @author WS Development Team
+ */
+public class PortType extends GlobalEntity implements Extensible{
+
+ public PortType(Defining defining) {
+ super(defining);
+ _operations = new ArrayList();
+ _operationKeys = new HashSet();
+ _helper = new ExtensibilityHelper();
+ }
+
+ public void add(Operation operation) {
+ String key = operation.getUniqueKey();
+ if (_operationKeys.contains(key))
+ throw new ValidationException(
+ "validation.ambiguousName",
+ operation.getName());
+ _operationKeys.add(key);
+ _operations.add(operation);
+ }
+
+ public Iterator operations() {
+ return _operations.iterator();
+ }
+
+ public Set getOperationsNamed(String s) {
+ Set result = new HashSet();
+ for (Iterator iter = _operations.iterator(); iter.hasNext();) {
+ Operation operation = (Operation) iter.next();
+ if (operation.getName().equals(s)) {
+ result.add(operation);
+ }
+ }
+ return result;
+ }
+
+ public Kind getKind() {
+ return Kinds.PORT_TYPE;
+ }
+
+ public QName getElementName() {
+ return WSDLConstants.QNAME_PORT_TYPE;
+ }
+
+ public Documentation getDocumentation() {
+ return _documentation;
+ }
+
+ public void setDocumentation(Documentation d) {
+ _documentation = d;
+ }
+
+ public void withAllSubEntitiesDo(EntityAction action) {
+ super.withAllSubEntitiesDo(action);
+
+ for (Iterator iter = _operations.iterator(); iter.hasNext();) {
+ action.perform((Entity) iter.next());
+ }
+ _helper.withAllSubEntitiesDo(action);
+ }
+
+ public void accept(WSDLDocumentVisitor visitor) throws Exception {
+ visitor.preVisit(this);
+ _helper.accept(visitor);
+ for (Iterator iter = _operations.iterator(); iter.hasNext();) {
+ ((Operation) iter.next()).accept(visitor);
+ }
+ visitor.postVisit(this);
+ }
+
+ public void validateThis() {
+ if (getName() == null) {
+ failValidation("validation.missingRequiredAttribute",
"name");
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see Extensible#addExtension(Extension)
+ */
+ public void addExtension(Extension e) {
+ _helper.addExtension(e);
+
+ }
+
+ /* (non-Javadoc)
+ * @see Extensible#extensions()
+ */
+ public Iterator extensions() {
+ return _helper.extensions();
+ }
+
+ private Documentation _documentation;
+ private List _operations;
+ private Set _operationKeys;
+ private ExtensibilityHelper _helper;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/PortType.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Service.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Service.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Service.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,112 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.Defining;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Entity;
+import org.jboss.com.sun.tools.ws.wsdl.framework.EntityAction;
+import org.jboss.com.sun.tools.ws.wsdl.framework.ExtensibilityHelper;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extensible;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extension;
+import org.jboss.com.sun.tools.ws.wsdl.framework.GlobalEntity;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Kind;
+
+
+/**
+ * Entity corresponding to the "service" WSDL element.
+ *
+ * @author WS Development Team
+ */
+public class Service extends GlobalEntity implements Extensible {
+
+ public Service(Defining defining) {
+ super(defining);
+ _ports = new ArrayList();
+ _helper = new ExtensibilityHelper();
+ }
+
+ public void add(Port port) {
+ port.setService(this);
+ _ports.add(port);
+ }
+
+ public Iterator <Port> ports() {
+ return _ports.iterator();
+ }
+
+ public Kind getKind() {
+ return Kinds.SERVICE;
+ }
+
+ public QName getElementName() {
+ return WSDLConstants.QNAME_SERVICE;
+ }
+
+ public Documentation getDocumentation() {
+ return _documentation;
+ }
+
+ public void setDocumentation(Documentation d) {
+ _documentation = d;
+ }
+
+ public void withAllSubEntitiesDo(EntityAction action) {
+ for (Iterator iter = _ports.iterator(); iter.hasNext();) {
+ action.perform((Entity) iter.next());
+ }
+ _helper.withAllSubEntitiesDo(action);
+ }
+
+ public void accept(WSDLDocumentVisitor visitor) throws Exception {
+ visitor.preVisit(this);
+ for (Iterator iter = _ports.iterator(); iter.hasNext();) {
+ ((Port) iter.next()).accept(visitor);
+ }
+ _helper.accept(visitor);
+ visitor.postVisit(this);
+ }
+
+ public void validateThis() {
+ if (getName() == null) {
+ failValidation("validation.missingRequiredAttribute",
"name");
+ }
+ }
+
+ public void addExtension(Extension e) {
+ _helper.addExtension(e);
+ }
+
+ public Iterator extensions() {
+ return _helper.extensions();
+ }
+
+ private ExtensibilityHelper _helper;
+ private Documentation _documentation;
+ private List <Port> _ports;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Service.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Types.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Types.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Types.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,87 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document;
+
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.Entity;
+import org.jboss.com.sun.tools.ws.wsdl.framework.EntityAction;
+import org.jboss.com.sun.tools.ws.wsdl.framework.ExtensibilityHelper;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extensible;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extension;
+import org.jboss.com.sun.tools.ws.wsdl.framework.ExtensionVisitor;
+
+
+/**
+ * Entity corresponding to the "types" WSDL element.
+ *
+ * @author WS Development Team
+ */
+public class Types extends Entity implements Extensible {
+
+ public Types() {
+ _helper = new ExtensibilityHelper();
+ }
+
+ public QName getElementName() {
+ return WSDLConstants.QNAME_TYPES;
+ }
+
+ public Documentation getDocumentation() {
+ return _documentation;
+ }
+
+ public void setDocumentation(Documentation d) {
+ _documentation = d;
+ }
+
+ public void accept(WSDLDocumentVisitor visitor) throws Exception {
+ visitor.preVisit(this);
+ _helper.accept(visitor);
+ visitor.postVisit(this);
+ }
+
+ public void validateThis() {
+ }
+
+ public void addExtension(Extension e) {
+ _helper.addExtension(e);
+ }
+
+ public Iterator extensions() {
+ return _helper.extensions();
+ }
+
+ public void withAllSubEntitiesDo(EntityAction action) {
+ _helper.withAllSubEntitiesDo(action);
+ }
+
+ public void accept(ExtensionVisitor visitor) throws Exception {
+ _helper.accept(visitor);
+ }
+
+ private ExtensibilityHelper _helper;
+ private Documentation _documentation;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/Types.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/WSDLConstants.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/WSDLConstants.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/WSDLConstants.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,56 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Interface defining WSDL-related constants.
+ *
+ * @author WS Development Team
+ */
+public interface WSDLConstants {
+
+ // namespace URIs
+ public static String NS_XMLNS = "http://www.w3.org/2000/xmlns/";
+ public static String NS_WSDL = "http://schemas.xmlsoap.org/wsdl/";
+
+ // QNames
+ public static QName QNAME_BINDING = new QName(NS_WSDL, "binding");
+ public static QName QNAME_DEFINITIONS = new QName(NS_WSDL, "definitions");
+ public static QName QNAME_DOCUMENTATION =
+ new QName(NS_WSDL, "documentation");
+ public static QName QNAME_FAULT = new QName(NS_WSDL, "fault");
+ public static QName QNAME_IMPORT = new QName(NS_WSDL, "import");
+ public static QName QNAME_INPUT = new QName(NS_WSDL, "input");
+ public static QName QNAME_MESSAGE = new QName(NS_WSDL, "message");
+ public static QName QNAME_OPERATION = new QName(NS_WSDL, "operation");
+ public static QName QNAME_OUTPUT = new QName(NS_WSDL, "output");
+ public static QName QNAME_PART = new QName(NS_WSDL, "part");
+ public static QName QNAME_PORT = new QName(NS_WSDL, "port");
+ public static QName QNAME_PORT_TYPE = new QName(NS_WSDL, "portType");
+ public static QName QNAME_SERVICE = new QName(NS_WSDL, "service");
+ public static QName QNAME_TYPES = new QName(NS_WSDL, "types");
+
+ public static QName QNAME_ATTR_ARRAY_TYPE = new QName(NS_WSDL,
"arrayType");
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/WSDLConstants.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/WSDLDocument.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/WSDLDocument.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/WSDLDocument.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,183 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.AbstractDocument;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Entity;
+import org.jboss.com.sun.tools.ws.wsdl.framework.EntityAction;
+import org.jboss.com.sun.tools.ws.wsdl.framework.EntityReferenceAction;
+import org.jboss.com.sun.tools.ws.wsdl.framework.EntityReferenceValidator;
+import org.jboss.com.sun.tools.ws.wsdl.framework.GloballyKnown;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Kind;
+import org.jboss.com.sun.tools.ws.wsdl.framework.NoSuchEntityException;
+import org.jboss.com.sun.tools.ws.wsdl.framework.ValidationException;
+
+
+/**
+ * A WSDL document.
+ *
+ * @author WS Development Team
+ */
+public class WSDLDocument extends AbstractDocument{
+
+ public WSDLDocument() {
+ }
+
+ public Definitions getDefinitions() {
+ return _definitions;
+ }
+
+ public void setDefinitions(Definitions d) {
+ _definitions = d;
+ }
+
+ public Set collectAllNamespaces() {
+ Set result = super.collectAllNamespaces();
+ if (_definitions.getTargetNamespaceURI() != null) {
+ result.add(_definitions.getTargetNamespaceURI());
+ }
+ return result;
+ }
+
+ public QName[] getAllServiceQNames() {
+
+ ArrayList serviceQNames = new ArrayList();
+
+ for (Iterator iter = getDefinitions().services(); iter.hasNext();) {
+ Service next = (Service) iter.next();
+ String targetNamespace = next.getDefining().getTargetNamespaceURI();
+ String localName = next.getName();
+ QName serviceQName = new QName(targetNamespace, localName);
+ serviceQNames.add(serviceQName);
+ }
+ return (QName[]) serviceQNames.toArray(new QName[serviceQNames.size()]);
+ }
+
+ public QName[] getAllPortQNames() {
+ ArrayList portQNames = new ArrayList();
+
+ for (Iterator iter = getDefinitions().services(); iter.hasNext();) {
+ Service next = (Service) iter.next();
+ //Iterator ports = next.ports();
+ for (Iterator piter = next.ports(); piter.hasNext();) {
+ // If it's a relative import
+ Port pnext = (Port) piter.next();
+ String targetNamespace =
+ pnext.getDefining().getTargetNamespaceURI();
+ String localName = pnext.getName();
+ QName portQName = new QName(targetNamespace, localName);
+ portQNames.add(portQName);
+ }
+ }
+ return (QName[]) portQNames.toArray(new QName[portQNames.size()]);
+ }
+
+ public QName[] getPortQNames(String serviceNameLocalPart) {
+
+ ArrayList portQNames = new ArrayList();
+
+ for (Iterator iter = getDefinitions().services(); iter.hasNext();) {
+ Service next = (Service) iter.next();
+ if (next.getName().equals(serviceNameLocalPart)) {
+ for (Iterator piter = next.ports(); piter.hasNext();) {
+ Port pnext = (Port) piter.next();
+ String targetNamespace =
+ pnext.getDefining().getTargetNamespaceURI();
+ String localName = pnext.getName();
+ QName portQName = new QName(targetNamespace, localName);
+ portQNames.add(portQName);
+ }
+ }
+ }
+ return (QName[]) portQNames.toArray(new QName[portQNames.size()]);
+ }
+
+ public void accept(WSDLDocumentVisitor visitor) throws Exception {
+ _definitions.accept(visitor);
+ }
+
+ public void validate(EntityReferenceValidator validator) {
+ GloballyValidatingAction action =
+ new GloballyValidatingAction(this, validator);
+ withAllSubEntitiesDo(action);
+ if (action.getException() != null) {
+ throw action.getException();
+ }
+ }
+
+ protected Entity getRoot() {
+ return _definitions;
+ }
+
+ private Definitions _definitions;
+
+ private class GloballyValidatingAction
+ implements EntityAction, EntityReferenceAction {
+ public GloballyValidatingAction(
+ AbstractDocument document,
+ EntityReferenceValidator validator) {
+ _document = document;
+ _validator = validator;
+ }
+
+ public void perform(Entity entity) {
+ try {
+ entity.validateThis();
+ entity.withAllEntityReferencesDo(this);
+ entity.withAllSubEntitiesDo(this);
+ } catch (ValidationException e) {
+ if (_exception == null) {
+ _exception = e;
+ }
+ }
+ }
+
+ public void perform(Kind kind, QName name) {
+ try {
+ GloballyKnown entity = _document.find(kind, name);
+ } catch (NoSuchEntityException e) {
+ // failed to resolve, check with the validator
+ if (_exception == null) {
+ if (_validator == null
+ || !_validator.isValid(kind, name)) {
+ _exception = e;
+ }
+ }
+ }
+ }
+
+ public ValidationException getException() {
+ return _exception;
+ }
+
+ private ValidationException _exception;
+ private AbstractDocument _document;
+ private EntityReferenceValidator _validator;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/WSDLDocument.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/WSDLDocumentVisitor.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/WSDLDocumentVisitor.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/WSDLDocumentVisitor.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,67 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.ExtensionVisitor;
+
+/**
+ * A visitor for WSDL documents.
+ *
+ * @author WS Development Team
+ */
+public interface WSDLDocumentVisitor extends ExtensionVisitor {
+
+ public void preVisit(Definitions definitions) throws Exception;
+ public void postVisit(Definitions definitions) throws Exception;
+ public void visit(Import i) throws Exception;
+ public void preVisit(Types types) throws Exception;
+ public void postVisit(Types types) throws Exception;
+ public void preVisit(Message message) throws Exception;
+ public void postVisit(Message message) throws Exception;
+ public void visit(MessagePart part) throws Exception;
+ public void preVisit(PortType portType) throws Exception;
+ public void postVisit(PortType portType) throws Exception;
+ public void preVisit(Operation operation) throws Exception;
+ public void postVisit(Operation operation) throws Exception;
+ public void preVisit(Input input) throws Exception;
+ public void postVisit(Input input) throws Exception;
+ public void preVisit(Output output) throws Exception;
+ public void postVisit(Output output) throws Exception;
+ public void preVisit(Fault fault) throws Exception;
+ public void postVisit(Fault fault) throws Exception;
+ public void preVisit(Binding binding) throws Exception;
+ public void postVisit(Binding binding) throws Exception;
+ public void preVisit(BindingOperation operation) throws Exception;
+ public void postVisit(BindingOperation operation) throws Exception;
+ public void preVisit(BindingInput input) throws Exception;
+ public void postVisit(BindingInput input) throws Exception;
+ public void preVisit(BindingOutput output) throws Exception;
+ public void postVisit(BindingOutput output) throws Exception;
+ public void preVisit(BindingFault fault) throws Exception;
+ public void postVisit(BindingFault fault) throws Exception;
+ public void preVisit(Service service) throws Exception;
+ public void postVisit(Service service) throws Exception;
+ public void preVisit(Port port) throws Exception;
+ public void postVisit(Port port) throws Exception;
+ public void visit(Documentation documentation) throws Exception;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/WSDLDocumentVisitor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/WSDLDocumentVisitorBase.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/WSDLDocumentVisitorBase.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/WSDLDocumentVisitorBase.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,102 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.ExtensionVisitorBase;
+
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class WSDLDocumentVisitorBase extends ExtensionVisitorBase {
+ public WSDLDocumentVisitorBase() {
+ }
+
+ public void preVisit(Definitions definitions) throws Exception {
+ }
+ public void postVisit(Definitions definitions) throws Exception {
+ }
+ public void visit(Import i) throws Exception {
+ }
+ public void preVisit(Types types) throws Exception {
+ }
+ public void postVisit(Types types) throws Exception {
+ }
+ public void preVisit(Message message) throws Exception {
+ }
+ public void postVisit(Message message) throws Exception {
+ }
+ public void visit(MessagePart part) throws Exception {
+ }
+ public void preVisit(PortType portType) throws Exception {
+ }
+ public void postVisit(PortType portType) throws Exception {
+ }
+ public void preVisit(Operation operation) throws Exception {
+ }
+ public void postVisit(Operation operation) throws Exception {
+ }
+ public void preVisit(Input input) throws Exception {
+ }
+ public void postVisit(Input input) throws Exception {
+ }
+ public void preVisit(Output output) throws Exception {
+ }
+ public void postVisit(Output output) throws Exception {
+ }
+ public void preVisit(Fault fault) throws Exception {
+ }
+ public void postVisit(Fault fault) throws Exception {
+ }
+ public void preVisit(Binding binding) throws Exception {
+ }
+ public void postVisit(Binding binding) throws Exception {
+ }
+ public void preVisit(BindingOperation operation) throws Exception {
+ }
+ public void postVisit(BindingOperation operation) throws Exception {
+ }
+ public void preVisit(BindingInput input) throws Exception {
+ }
+ public void postVisit(BindingInput input) throws Exception {
+ }
+ public void preVisit(BindingOutput output) throws Exception {
+ }
+ public void postVisit(BindingOutput output) throws Exception {
+ }
+ public void preVisit(BindingFault fault) throws Exception {
+ }
+ public void postVisit(BindingFault fault) throws Exception {
+ }
+ public void preVisit(Service service) throws Exception {
+ }
+ public void postVisit(Service service) throws Exception {
+ }
+ public void preVisit(Port port) throws Exception {
+ }
+ public void postVisit(Port port) throws Exception {
+ }
+ public void visit(Documentation documentation) throws Exception {
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/WSDLDocumentVisitorBase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/http/HTTPAddress.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/http/HTTPAddress.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/http/HTTPAddress.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,59 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document.http;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extension;
+
+
+/**
+ * A HTTP address extension.
+ *
+ * @author WS Development Team
+ */
+public class HTTPAddress extends Extension {
+
+ public HTTPAddress() {
+ }
+
+ public QName getElementName() {
+ return HTTPConstants.QNAME_ADDRESS;
+ }
+
+ public String getLocation() {
+ return _location;
+ }
+
+ public void setLocation(String s) {
+ _location = s;
+ }
+
+ public void validateThis() {
+ if (_location == null) {
+ failValidation("validation.missingRequiredAttribute",
"location");
+ }
+ }
+
+ private String _location;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/http/HTTPAddress.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/http/HTTPBinding.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/http/HTTPBinding.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/http/HTTPBinding.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,59 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document.http;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extension;
+
+
+/**
+ * A HTTP binding extension.
+ *
+ * @author WS Development Team
+ */
+public class HTTPBinding extends Extension {
+
+ public HTTPBinding() {
+ }
+
+ public QName getElementName() {
+ return HTTPConstants.QNAME_BINDING;
+ }
+
+ public String getVerb() {
+ return _verb;
+ }
+
+ public void setVerb(String s) {
+ _verb = s;
+ }
+
+ public void validateThis() {
+ if (_verb == null) {
+ failValidation("validation.missingRequiredAttribute",
"verb");
+ }
+ }
+
+ private String _verb;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/http/HTTPBinding.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/http/HTTPConstants.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/http/HTTPConstants.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/http/HTTPConstants.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,45 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document.http;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Interface defining HTTP-extension-related constants.
+ *
+ * @author WS Development Team
+ */
+public interface HTTPConstants {
+
+ // namespace URIs
+ public static String NS_WSDL_HTTP =
"http://schemas.xmlsoap.org/wsdl/http/";
+
+ // QNames
+ public static QName QNAME_ADDRESS = new QName(NS_WSDL_HTTP, "address");
+ public static QName QNAME_BINDING = new QName(NS_WSDL_HTTP, "binding");
+ public static QName QNAME_OPERATION = new QName(NS_WSDL_HTTP,
"operation");
+ public static QName QNAME_URL_ENCODED =
+ new QName(NS_WSDL_HTTP, "urlEncoded");
+ public static QName QNAME_URL_REPLACEMENT =
+ new QName(NS_WSDL_HTTP, "urlReplacement");
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/http/HTTPConstants.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/http/HTTPOperation.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/http/HTTPOperation.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/http/HTTPOperation.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,59 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document.http;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extension;
+
+
+/**
+ * A HTTP operation extension.
+ *
+ * @author WS Development Team
+ */
+public class HTTPOperation extends Extension {
+
+ public HTTPOperation() {
+ }
+
+ public QName getElementName() {
+ return HTTPConstants.QNAME_OPERATION;
+ }
+
+ public String getLocation() {
+ return _location;
+ }
+
+ public void setLocation(String s) {
+ _location = s;
+ }
+
+ public void validateThis() {
+ if (_location == null) {
+ failValidation("validation.missingRequiredAttribute",
"location");
+ }
+ }
+
+ private String _location;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/http/HTTPOperation.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/http/HTTPUrlEncoded.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/http/HTTPUrlEncoded.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/http/HTTPUrlEncoded.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,45 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document.http;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extension;
+
+
+/**
+ * A HTTP urlEncoded extension.
+ *
+ * @author WS Development Team
+ */
+public class HTTPUrlEncoded extends Extension {
+
+ public HTTPUrlEncoded() {}
+
+ public QName getElementName() {
+ return HTTPConstants.QNAME_URL_ENCODED;
+ }
+
+ public void validateThis() {
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/http/HTTPUrlEncoded.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/http/HTTPUrlReplacement.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/http/HTTPUrlReplacement.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/http/HTTPUrlReplacement.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,46 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document.http;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extension;
+
+
+/**
+ * A HTTP urlReplacement extension.
+ *
+ * @author WS Development Team
+ */
+public class HTTPUrlReplacement extends Extension {
+
+ public HTTPUrlReplacement() {
+ }
+
+ public QName getElementName() {
+ return HTTPConstants.QNAME_URL_REPLACEMENT;
+ }
+
+ public void validateThis() {
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/http/HTTPUrlReplacement.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/jaxws/CustomName.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/jaxws/CustomName.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/jaxws/CustomName.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,75 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.wsdl.document.jaxws;
+
+
+/**
+ * @author Vivek Pandey
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class CustomName {
+
+
+ /**
+ *
+ */
+ public CustomName() {
+ }
+
+ /**
+ *
+ */
+ public CustomName(String name, String javaDoc) {
+ this.name = name;
+ this.javaDoc = javaDoc;
+ }
+
+ /**
+ * @return Returns the javaDoc.
+ */
+ public String getJavaDoc() {
+ return javaDoc;
+ }
+ /**
+ * @param javaDoc The javaDoc to set.
+ */
+ public void setJavaDoc(String javaDoc) {
+ this.javaDoc = javaDoc;
+ }
+ /**
+ * @return Returns the name.
+ */
+ public String getName() {
+ return name;
+ }
+ /**
+ * @param name The name to set.
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ private String javaDoc;
+ private String name;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/jaxws/CustomName.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/jaxws/Exception.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/jaxws/Exception.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/jaxws/Exception.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,51 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.wsdl.document.jaxws;
+
+/**
+ * @author Vivek Pandey
+ *
+ * class representing jaxws:exception
+ *
+ */
+public class Exception {
+
+ public Exception(){}
+
+ public Exception(CustomName name){
+ this.className = name;
+ }
+
+ private CustomName className;
+ /**
+ * @return Returns the className.
+ */
+ public CustomName getClassName() {
+ return className;
+ }
+ /**
+ * @param className The className to set.
+ */
+ public void setClassName(CustomName className) {
+ this.className = className;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/jaxws/Exception.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/jaxws/JAXWSBinding.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/jaxws/JAXWSBinding.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/jaxws/JAXWSBinding.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,335 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.wsdl.document.jaxws;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extensible;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extension;
+import org.w3c.dom.Element;
+
+
+
+/**
+ * @author Vivek Pandey
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class JAXWSBinding extends Extension implements Extensible {
+
+ /**
+ *
+ */
+ public JAXWSBinding(){
+ super();
+ jaxbBindings = new HashSet<Element>();
+ // TODO Auto-generated constructor stub
+ }
+
+
+ /* (non-Javadoc)
+ * @see Entity#validateThis()
+ */
+ public void validateThis(){
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see Elemental#getElementName()
+ */
+ public QName getElementName(){
+ // TODO Auto-generated method stub
+ return JAXWSBindingsConstants.JAXWS_BINDINGS;
+ }
+
+ /* (non-Javadoc)
+ * @see Extensible#addExtension(Extension)
+ */
+ public void addExtension(Extension e) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see Extensible#extensions()
+ */
+ public Iterator extensions() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+// /**
+// * @return Returns the enableAdditionalHeaderMapping.
+// */
+// public Boolean isEnableAdditionalHeaderMapping() {
+// return enableAdditionalHeaderMapping;
+// }
+// /**
+// * @param enableAdditionalHeaderMapping The enableAdditionalHeaderMapping to set.
+// */
+// public void setEnableAdditionalHeaderMapping(
+// Boolean enableAdditionalHeaderMapping) {
+// this.enableAdditionalHeaderMapping = enableAdditionalHeaderMapping;
+// }
+ /**
+ * @return Returns the enableAsyncMapping.
+ */
+ public Boolean isEnableAsyncMapping() {
+ return enableAsyncMapping;
+ }
+ /**
+ * @param enableAsyncMapping The enableAsyncMapping to set.
+ */
+ public void setEnableAsyncMapping(Boolean enableAsyncMapping) {
+ this.enableAsyncMapping = enableAsyncMapping;
+ }
+ /**
+ * @return Returns the enableMimeContentMapping.
+ */
+ public Boolean isEnableMimeContentMapping() {
+ return enableMimeContentMapping;
+ }
+ /**
+ * @param enableMimeContentMapping The enableMimeContentMapping to set.
+ */
+ public void setEnableMimeContentMapping(Boolean enableMimeContentMapping) {
+ this.enableMimeContentMapping = enableMimeContentMapping;
+ }
+ /**
+ * @return Returns the enableWrapperStyle.
+ */
+ public Boolean isEnableWrapperStyle() {
+ return enableWrapperStyle;
+ }
+ /**
+ * @param enableWrapperStyle The enableWrapperStyle to set.
+ */
+ public void setEnableWrapperStyle(Boolean enableWrapperStyle) {
+ this.enableWrapperStyle = enableWrapperStyle;
+ }
+ /**
+ * @return Returns the jaxwsPackage.
+ */
+ public CustomName getJaxwsPackage() {
+ return jaxwsPackage;
+ }
+ /**
+ * @param jaxwsPackage The jaxwsPackage to set.
+ */
+ public void setJaxwsPackage(CustomName jaxwsPackage) {
+ this.jaxwsPackage = jaxwsPackage;
+ }
+ /**
+ * @return Returns the node.
+ */
+ public String getNode() {
+ return node;
+ }
+ /**
+ * @param node The node to set.
+ */
+ public void setNode(String node) {
+ this.node = node;
+ }
+ /**
+ * @return Returns the version.
+ */
+ public String getVersion() {
+ return version;
+ }
+ /**
+ * @param version The version to set.
+ */
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ /**
+ * @return Returns the wsdlLocation.
+ */
+ public String getWsdlLocation() {
+ return wsdlLocation;
+ }
+
+ /**
+ * @param wsdlLocation The wsdlLocation to set.
+ */
+ public void setWsdlLocation(String wsdlLocation) {
+ this.wsdlLocation = wsdlLocation;
+ }
+
+ /**
+ * @return Returns the wsdlNamespace.
+ */
+ public String getWsdlNamespace() {
+ return wsdlNamespace;
+ }
+
+
+ /**
+ * @param wsdlNamespace The wsdlNamespace to set.
+ */
+ public void setWsdlNamespace(String wsdlNamespace) {
+ this.wsdlNamespace = wsdlNamespace;
+ }
+
+ /**
+ * @return Returns the jaxbBindings.
+ */
+ public Set<Element> getJaxbBindings() {
+ return jaxbBindings;
+ }
+
+ /**
+ * @param jaxbBinding The jaxbBindings to set.
+ */
+ public void addJaxbBindings(Element jaxbBinding) {
+ if(jaxbBindings == null)
+ return;
+ this.jaxbBindings.add(jaxbBinding);
+ }
+
+
+ /**
+ * @return the isProvider.
+ */
+ public Boolean isProvider() {
+ return isProvider;
+ }
+ /**
+ * @param isProvider The isProvider to set.
+ */
+ public void setProvider(Boolean isProvider) {
+ this.isProvider = isProvider;
+ }
+
+ /* (non-Javadoc)
+ * @see Entity#getProperty(java.lang.String)
+ */
+ public Object getProperty(String key) {
+ if(key.equals(JAXWSBindingsConstants.JAXB_BINDINGS))
+ return jaxbBindings;
+ return null;
+ }
+
+ /**
+ * @return Returns the methodName.
+ */
+ public CustomName getMethodName() {
+ return methodName;
+ }
+ /**
+ * @param methodName The methodName to set.
+ */
+ public void setMethodName(CustomName methodName) {
+ this.methodName = methodName;
+ }
+
+ /**
+ * @return Returns the parameter.
+ */
+ public Iterator<Parameter> parameters() {
+ return parameters.iterator();
+ }
+
+ /**
+ * @param parameter The parameter to set.
+ */
+ public void addParameter(Parameter parameter) {
+ if(parameters == null)
+ parameters = new ArrayList<Parameter>();
+ parameters.add(parameter);
+ }
+
+ public String getParameterName(String msgName, String wsdlPartName, QName element,
boolean wrapperStyle){
+ if(msgName == null || wsdlPartName == null || element == null || parameters ==
null)
+ return null;
+ for(Parameter param : parameters){
+ if(param.getMessageName().equals(msgName) &&
param.getPart().equals(wsdlPartName)){
+ if(wrapperStyle && (param.getElement() != null)){
+ if(param.getElement().equals(element))
+ return param.getName();
+ }else if(!wrapperStyle){
+ return param.getName();
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @return Returns the className.
+ */
+ public CustomName getClassName() {
+ return className;
+ }
+ /**
+ * @param className The className to set.
+ */
+ public void setClassName(CustomName className) {
+ this.className = className;
+ }
+
+ /**
+ * @return Returns the exception.
+ */
+ public Exception getException() {
+ return exception;
+ }
+ /**
+ * @param exception The exception to set.
+ */
+ public void setException(Exception exception) {
+ this.exception = exception;
+ }
+
+ private String wsdlNamespace;
+ private String wsdlLocation;
+ private String node;
+ private String version;
+
+ private CustomName jaxwsPackage;
+ private List<Parameter> parameters;
+ private Boolean enableWrapperStyle;
+ private Boolean enableAsyncMapping;
+// private Boolean enableAdditionalHeaderMapping;
+ private Boolean enableMimeContentMapping;
+ private Boolean isProvider;
+ private Exception exception;
+
+ private Set<Element> jaxbBindings;
+
+ // portType className
+ private CustomName className;
+
+ //portType Operation
+ private CustomName methodName;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/jaxws/JAXWSBinding.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/jaxws/JAXWSBindingsConstants.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/jaxws/JAXWSBindingsConstants.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/jaxws/JAXWSBindingsConstants.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,191 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document.jaxws;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.parser.Constants;
+
+
+/**
+ * @author Vivek Pandey
+ *
+ */
+public interface JAXWSBindingsConstants {
+
+ public static String NS_JAXWS_BINDINGS =
"http://java.sun.com/xml/ns/jaxws";
+ public static String NS_JAXB_BINDINGS = "http://java.sun.com/xml/ns/jaxb";
+
+ /**
+ * jaxws:bindings schema component
+ *
+ * <jaxws:bindings wsdlLocation="xs:anyURI"?
node="xs:string"?
+ * version="string"?> binding declarations...
+ * </jaxws:bindings>
+ *
+ * wsdlLocation="xs:anyURI"? node="xs:string"?
version="string"?> binding
+ * declarations... </jaxws:bindings>
+ *
+ * <code>@wsdlLocation</code> A URI pointing to a WSDL file establishing
the scope of the
+ * contents of this binding declaration. It MUST NOT be
+ * present if the binding declaration is used as an extension
+ * inside a WSDL document or if there is an ancestor binding
+ * declaration that contains this attribute.
+ *
+ * <code>@node</code> An XPath expression pointing to the element in the
WSDL file in
+ * scope that this binding declaration is attached to.
+ *
+ * <code>@version</code> A version identifier. It MAY only appear on
jaxws:bindings
+ * elements that don't have any jaxws:bindings ancestors (i.e. on
+ * outermost binding declarations).
+ */
+ public static QName JAXWS_BINDINGS = new QName(NS_JAXWS_BINDINGS,
"bindings");
+ public static String WSDL_LOCATION_ATTR = "wsdlLocation";
+ public static String NODE_ATTR = "node";
+ public static String VERSION_ATTR = "version";
+
+ /*
+ * <jaxws:package name="xs:string">? <jaxws:javadoc>xs:string
+ * </jaxws:javadoc> </jaxws:package>
+ */
+ public static QName PACKAGE = new QName(NS_JAXWS_BINDINGS, "package");
+ public static String NAME_ATTR = "name";
+ public static QName JAVADOC = new QName(NS_JAXWS_BINDINGS, "javadoc");
+
+ /*
+ * <jaxws:enableWrapperStyle>xs:boolean </jaxws:enableWrapperStyle>?
+ */
+ public static QName ENABLE_WRAPPER_STYLE = new QName(NS_JAXWS_BINDINGS,
"enableWrapperStyle");
+
+ /*
+ * <jaxws:enableAsynchronousMapping>xs:boolean
+ * </jaxws:enableAsynchronousMapping>?
+ */
+ public static QName ENABLE_ASYNC_MAPPING = new QName(NS_JAXWS_BINDINGS,
"enableAsyncMapping");
+
+ /*
+ *
<jaxws:enableAdditionalSOAPHeaderMapping>xs:boolean</jaxws:enableAdditionalSOAPHeaderMapping>?
+ */
+ public static QName ENABLE_ADDITIONAL_SOAPHEADER_MAPPING = new
QName(NS_JAXWS_BINDINGS, "enableAdditionalSOAPHeaderMapping");
+
+ /*
+ * <jaxws:enableMIMEContent>xs:boolean</jaxws:enableMIMEContent>?
+ */
+ public static QName ENABLE_MIME_CONTENT = new QName(NS_JAXWS_BINDINGS,
"enableMIMEContent");
+
+ /*
+ * <jaxwsc:provider>xs:boolean</jaxws:provider>?
+ */
+ public static QName PROVIDER = new QName(NS_JAXWS_BINDINGS, "provider");
+
+ /*
+ * PortType
+ *
+ * <jaxws:class name="xs:string">?
+ * <jaxws:javadoc>xs:string</jaxws:javadoc>?
+ * </jaxws:class>
+ *
+ * <jaxws:enableWrapperStyle>
+ * xs:boolean
+ * </jaxws:enableWrapperStyle>?
+ *
+ * <jaxws:enableAsynchronousMapping>
+ * xs:boolean
+ * </jaxws:enableAsynchronousMapping>?
+ *
+ */
+
+ public static QName CLASS = new QName(NS_JAXWS_BINDINGS, "class");
+
+ /*
+ * PortType Operation
+ *
+ * <jaxws:method name="xs:string">?
+ * <jaxws:javadoc>xs:string</jaxws:javadoc>?
+ * </jaxws:method>
+ *
+ * <jaxws:enableWrapperStyle>
+ * xs:boolean
+ * </jaxws:enableWrapperStyle>?
+ *
+ * <jaxws:enableAsyncMapping>
+ * xs:boolean
+ * </jaxws:enableAsyncMapping>?
+ *
+ * <jaxws:parameter part="xs:string"
+ * childElementName="xs:QName"?
+ * name="xs:string"/>*
+ */
+
+
+
+ public static QName METHOD = new QName(NS_JAXWS_BINDINGS, "method");
+ public static QName PARAMETER = new QName(NS_JAXWS_BINDINGS, "parameter");
+ public static String PART_ATTR = "part";
+ public static String ELEMENT_ATTR = "childElementName";
+
+ /*
+ * Binding
+ *
+ * <jaxws:enableAdditionalSOAPHeaderMapping>
+ * xs:boolean
+ * </jaxws:enableAdditionalSOAPHeaderMapping>?
+ *
+ * <jaxws:enableMIMEContent>
+ * xs:boolean
+ * </jaxws:enableMIMEContent>?
+ */
+
+ /*
+ * BindingOperation
+ *
+ * <jaxws:enableAdditionalSOAPHeaderMapping>
+ * xs:boolean
+ * </jaxws:enableAdditionalSOAPHeaderMapping>?
+ *
+ * <jaxws:enableMIMEContent>
+ * xs:boolean
+ * </jaxws:enableMIMEContent>?
+ *
+ * <jaxws:parameter part="xs:string"
+ * element="xs:QName"?
+ * name="xs:string"/>*
+ *
+ * <jaxws:exception part="xs:string">*
+ * <jaxws:class name="xs:string">?
+ * <jaxws:javadoc>xs:string</jaxws:javadoc>?
+ * </jaxws:class>
+ * </jaxws:exception>
+ */
+
+ public static QName EXCEPTION = new QName(NS_JAXWS_BINDINGS, "exception");
+
+
+ /*
+ * jaxb:bindgs QName
+ */
+ public static QName JAXB_BINDINGS = new QName(NS_JAXB_BINDINGS,
"bindings");
+ public static String JAXB_BINDING_VERSION = "1.0";
+ public static QName XSD_APPINFO = new QName(Constants.NS_XSD, "appinfo");
+ public static QName XSD_ANNOTATION = new QName(Constants.NS_XSD,
"annotation");
+}
\ No newline at end of file
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/jaxws/JAXWSBindingsConstants.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/jaxws/Parameter.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/jaxws/Parameter.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/jaxws/Parameter.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,99 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.wsdl.document.jaxws;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @author Vivek Pandey
+ *
+ * class representing jaxws:parameter
+ *
+ */
+public class Parameter {
+ private String part;
+ private QName element;
+ private String name;
+ private String messageName;
+
+ /**
+ * @param part
+ * @param element
+ * @param name
+ */
+ public Parameter(String msgName, String part, QName element, String name) {
+ this.part = part;
+ this.element = element;
+ this.name = name;
+ this.messageName = msgName;
+ }
+
+ public String getMessageName() {
+ return messageName;
+ }
+
+ public void setMessageName(String messageName) {
+ this.messageName = messageName;
+ }
+
+ /**
+ * @return Returns the element.
+ */
+ public QName getElement() {
+ return element;
+ }
+
+ /**
+ * @param element The element to set.
+ */
+ public void setElement(QName element) {
+ this.element = element;
+ }
+
+ /**
+ * @return Returns the name.
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name The name to set.
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * @return Returns the part.
+ */
+ public String getPart() {
+ return part;
+ }
+
+ /**
+ * @param part The part to set.
+ */
+ public void setPart(String part) {
+ this.part = part;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/jaxws/Parameter.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/mime/MIMEConstants.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/mime/MIMEConstants.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/mime/MIMEConstants.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,43 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document.mime;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Interface defining MIME-extension-related constants.
+ *
+ * @author WS Development Team
+ */
+public interface MIMEConstants {
+
+ // namespace URIs
+ public static String NS_WSDL_MIME =
"http://schemas.xmlsoap.org/wsdl/mime/";
+
+ // QNames
+ public static QName QNAME_CONTENT = new QName(NS_WSDL_MIME, "content");
+ public static QName QNAME_MULTIPART_RELATED =
+ new QName(NS_WSDL_MIME, "multipartRelated");
+ public static QName QNAME_PART = new QName(NS_WSDL_MIME, "part");
+ public static QName QNAME_MIME_XML = new QName(NS_WSDL_MIME, "mimeXml");
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/mime/MIMEConstants.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/mime/MIMEContent.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/mime/MIMEContent.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/mime/MIMEContent.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,65 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document.mime;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extension;
+
+
+/**
+ * A MIME content extension.
+ *
+ * @author WS Development Team
+ */
+public class MIMEContent extends Extension {
+
+ public MIMEContent() {
+ }
+
+ public QName getElementName() {
+ return MIMEConstants.QNAME_CONTENT;
+ }
+
+ public String getPart() {
+ return _part;
+ }
+
+ public void setPart(String s) {
+ _part = s;
+ }
+
+ public String getType() {
+ return _type;
+ }
+
+ public void setType(String s) {
+ _type = s;
+ }
+
+ public void validateThis() {
+ }
+
+ private String _part;
+ private String _type;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/mime/MIMEContent.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/mime/MIMEMultipartRelated.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/mime/MIMEMultipartRelated.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/mime/MIMEMultipartRelated.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,77 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document.mime;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.Entity;
+import org.jboss.com.sun.tools.ws.wsdl.framework.EntityAction;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extension;
+import org.jboss.com.sun.tools.ws.wsdl.framework.ExtensionVisitor;
+
+
+/**
+ * A MIME multipartRelated extension.
+ *
+ * @author WS Development Team
+ */
+public class MIMEMultipartRelated extends Extension {
+
+ public MIMEMultipartRelated() {
+ _parts = new ArrayList<MIMEPart>();
+ }
+
+ public QName getElementName() {
+ return MIMEConstants.QNAME_MULTIPART_RELATED;
+ }
+
+ public void add(MIMEPart part) {
+ _parts.add(part);
+ }
+
+ public Iterator<MIMEPart> getParts() {
+ return _parts.iterator();
+ }
+
+ public void withAllSubEntitiesDo(EntityAction action) {
+ super.withAllSubEntitiesDo(action);
+
+ for (Iterator iter = _parts.iterator(); iter.hasNext();) {
+ action.perform((Entity) iter.next());
+ }
+ }
+
+ public void accept(ExtensionVisitor visitor) throws Exception {
+ visitor.preVisit(this);
+ visitor.postVisit(this);
+ }
+
+ public void validateThis() {
+ }
+
+ private List<MIMEPart> _parts;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/mime/MIMEMultipartRelated.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/mime/MIMEPart.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/mime/MIMEPart.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/mime/MIMEPart.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,75 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document.mime;
+
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.EntityAction;
+import org.jboss.com.sun.tools.ws.wsdl.framework.ExtensibilityHelper;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extensible;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extension;
+
+
+/**
+ * A MIME part extension.
+ *
+ * @author WS Development Team
+ */
+public class MIMEPart extends Extension implements Extensible {
+
+ public MIMEPart() {
+ _helper = new ExtensibilityHelper();
+ }
+
+ public QName getElementName() {
+ return MIMEConstants.QNAME_PART;
+ }
+
+ public String getName() {
+ return _name;
+ }
+
+ public void setName(String s) {
+ _name = s;
+ }
+
+ public void addExtension(Extension e) {
+ _helper.addExtension(e);
+ }
+
+ public Iterator extensions() {
+ return _helper.extensions();
+ }
+
+ public void withAllSubEntitiesDo(EntityAction action) {
+ _helper.withAllSubEntitiesDo(action);
+ }
+
+ public void validateThis() {
+ }
+
+ private String _name;
+ private ExtensibilityHelper _helper;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/mime/MIMEPart.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/mime/MIMEXml.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/mime/MIMEXml.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/mime/MIMEXml.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,56 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document.mime;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extension;
+
+
+/**
+ * A MIME mimeXml extension.
+ *
+ * @author WS Development Team
+ */
+public class MIMEXml extends Extension {
+
+ public MIMEXml() {
+ }
+
+ public QName getElementName() {
+ return MIMEConstants.QNAME_MIME_XML;
+ }
+
+ public String getPart() {
+ return _part;
+ }
+
+ public void setPart(String s) {
+ _part = s;
+ }
+
+ public void validateThis() {
+ }
+
+ private String _part;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/mime/MIMEXml.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/schema/BuiltInTypes.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/schema/BuiltInTypes.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/schema/BuiltInTypes.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,83 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document.schema;
+
+import javax.xml.namespace.QName;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public interface BuiltInTypes {
+ public QName STRING = SchemaConstants.QNAME_TYPE_STRING;
+ public QName NORMALIZED_STRING =
+ SchemaConstants.QNAME_TYPE_NORMALIZED_STRING;
+ public QName TOKEN = SchemaConstants.QNAME_TYPE_TOKEN;
+ public QName BYTE = SchemaConstants.QNAME_TYPE_BYTE;
+ public QName UNSIGNED_BYTE = SchemaConstants.QNAME_TYPE_UNSIGNED_BYTE;
+ public QName BASE64_BINARY = SchemaConstants.QNAME_TYPE_BASE64_BINARY;
+ public QName HEX_BINARY = SchemaConstants.QNAME_TYPE_HEX_BINARY;
+ public QName INTEGER = SchemaConstants.QNAME_TYPE_INTEGER;
+ public QName POSITIVE_INTEGER = SchemaConstants.QNAME_TYPE_POSITIVE_INTEGER;
+ public QName NEGATIVE_INTEGER = SchemaConstants.QNAME_TYPE_NEGATIVE_INTEGER;
+ public QName NON_NEGATIVE_INTEGER =
+ SchemaConstants.QNAME_TYPE_NON_NEGATIVE_INTEGER;
+ public QName NON_POSITIVE_INTEGER =
+ SchemaConstants.QNAME_TYPE_NON_POSITIVE_INTEGER;
+ public QName INT = SchemaConstants.QNAME_TYPE_INT;
+ public QName UNSIGNED_INT = SchemaConstants.QNAME_TYPE_UNSIGNED_INT;
+ public QName LONG = SchemaConstants.QNAME_TYPE_LONG;
+ public QName UNSIGNED_LONG = SchemaConstants.QNAME_TYPE_UNSIGNED_LONG;
+ public QName SHORT = SchemaConstants.QNAME_TYPE_SHORT;
+ public QName UNSIGNED_SHORT = SchemaConstants.QNAME_TYPE_UNSIGNED_SHORT;
+ public QName DECIMAL = SchemaConstants.QNAME_TYPE_DECIMAL;
+ public QName FLOAT = SchemaConstants.QNAME_TYPE_FLOAT;
+ public QName DOUBLE = SchemaConstants.QNAME_TYPE_DOUBLE;
+ public QName BOOLEAN = SchemaConstants.QNAME_TYPE_BOOLEAN;
+ public QName TIME = SchemaConstants.QNAME_TYPE_TIME;
+ public QName DATE_TIME = SchemaConstants.QNAME_TYPE_DATE_TIME;
+ public QName DURATION = SchemaConstants.QNAME_TYPE_DURATION;
+ public QName DATE = SchemaConstants.QNAME_TYPE_DATE;
+ public QName G_MONTH = SchemaConstants.QNAME_TYPE_G_MONTH;
+ public QName G_YEAR = SchemaConstants.QNAME_TYPE_G_YEAR;
+ public QName G_YEAR_MONTH = SchemaConstants.QNAME_TYPE_G_YEAR_MONTH;
+ public QName G_DAY = SchemaConstants.QNAME_TYPE_G_DAY;
+ public QName G_MONTH_DAY = SchemaConstants.QNAME_TYPE_G_MONTH_DAY;
+ public QName NAME = SchemaConstants.QNAME_TYPE_NAME;
+ public QName QNAME = SchemaConstants.QNAME_TYPE_QNAME;
+ public QName NCNAME = SchemaConstants.QNAME_TYPE_NCNAME;
+ public QName ANY_URI = SchemaConstants.QNAME_TYPE_ANY_URI;
+ public QName ID = SchemaConstants.QNAME_TYPE_ID;
+ public QName IDREF = SchemaConstants.QNAME_TYPE_IDREF;
+ public QName IDREFS = SchemaConstants.QNAME_TYPE_IDREFS;
+ public QName ENTITY = SchemaConstants.QNAME_TYPE_ENTITY;
+ public QName ENTITIES = SchemaConstants.QNAME_TYPE_ENTITIES;
+ public QName NOTATION = SchemaConstants.QNAME_TYPE_NOTATION;
+ public QName NMTOKEN = SchemaConstants.QNAME_TYPE_NMTOKEN;
+ public QName NMTOKENS = SchemaConstants.QNAME_TYPE_NMTOKENS;
+ public QName LANGUAGE = SchemaConstants.QNAME_TYPE_LANGUAGE;
+ public QName ANY_SIMPLE_URTYPE = SchemaConstants.QNAME_TYPE_SIMPLE_URTYPE;
+
+ //xsd:list
+ public QName LIST = SchemaConstants.QNAME_LIST;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/schema/BuiltInTypes.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/schema/Schema.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/schema/Schema.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/schema/Schema.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,186 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document.schema;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.AbstractDocument;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Defining;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extension;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Kind;
+import org.jboss.com.sun.tools.ws.wsdl.framework.ValidationException;
+import org.jboss.com.sun.tools.ws.wsdl.parser.Constants;
+
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class Schema extends Extension implements Defining {
+
+ public Schema(AbstractDocument document) {
+ _document = document;
+ _nsPrefixes = new HashMap();
+ _definedEntities = new ArrayList();
+ }
+
+ public QName getElementName() {
+ return SchemaConstants.QNAME_SCHEMA;
+ }
+
+ public SchemaElement getContent() {
+ return _content;
+ }
+
+ public void setContent(SchemaElement entity) {
+ _content = entity;
+ _content.setSchema(this);
+ }
+
+ public void setTargetNamespaceURI(String uri) {
+ _targetNamespaceURI = uri;
+ }
+
+ public String getTargetNamespaceURI() {
+ return _targetNamespaceURI;
+ }
+
+ public void addPrefix(String prefix, String uri) {
+ _nsPrefixes.put(prefix, uri);
+ }
+
+ public String getURIForPrefix(String prefix) {
+ return (String) _nsPrefixes.get(prefix);
+ }
+
+ public Iterator prefixes() {
+ return _nsPrefixes.keySet().iterator();
+ }
+
+ public void defineAllEntities() {
+ if (_content == null) {
+ throw new ValidationException(
+ "validation.shouldNotHappen",
+ "missing schema content");
+ }
+
+ for (Iterator iter = _content.children(); iter.hasNext();) {
+ SchemaElement child = (SchemaElement) iter.next();
+ if (child.getQName().equals(SchemaConstants.QNAME_ATTRIBUTE)) {
+ QName name =
+ new QName(
+ _targetNamespaceURI,
+ child.getValueOfMandatoryAttribute(
+ Constants.ATTR_NAME));
+ defineEntity(child, SchemaKinds.XSD_ATTRIBUTE, name);
+ } else if (
+ child.getQName().equals(
+ SchemaConstants.QNAME_ATTRIBUTE_GROUP)) {
+ QName name =
+ new QName(
+ _targetNamespaceURI,
+ child.getValueOfMandatoryAttribute(
+ Constants.ATTR_NAME));
+ defineEntity(child, SchemaKinds.XSD_ATTRIBUTE_GROUP, name);
+ } else if (
+ child.getQName().equals(SchemaConstants.QNAME_ELEMENT)) {
+ QName name =
+ new QName(
+ _targetNamespaceURI,
+ child.getValueOfMandatoryAttribute(
+ Constants.ATTR_NAME));
+ defineEntity(child, SchemaKinds.XSD_ELEMENT, name);
+ } else if (child.getQName().equals(SchemaConstants.QNAME_GROUP)) {
+ QName name =
+ new QName(
+ _targetNamespaceURI,
+ child.getValueOfMandatoryAttribute(
+ Constants.ATTR_NAME));
+ defineEntity(child, SchemaKinds.XSD_GROUP, name);
+ } else if (
+ child.getQName().equals(SchemaConstants.QNAME_COMPLEX_TYPE)) {
+ QName name =
+ new QName(
+ _targetNamespaceURI,
+ child.getValueOfMandatoryAttribute(
+ Constants.ATTR_NAME));
+ defineEntity(child, SchemaKinds.XSD_TYPE, name);
+ } else if (
+ child.getQName().equals(SchemaConstants.QNAME_SIMPLE_TYPE)) {
+ QName name =
+ new QName(
+ _targetNamespaceURI,
+ child.getValueOfMandatoryAttribute(
+ Constants.ATTR_NAME));
+ defineEntity(child, SchemaKinds.XSD_TYPE, name);
+ }
+ }
+ }
+
+ public void defineEntity(SchemaElement element, Kind kind, QName name) {
+ SchemaEntity entity = new SchemaEntity(this, element, kind, name);
+ _document.define(entity);
+ _definedEntities.add(entity);
+ }
+
+ public Iterator definedEntities() {
+ return _definedEntities.iterator();
+ }
+
+ public void validateThis() {
+ if (_content == null) {
+ throw new ValidationException(
+ "validation.shouldNotHappen",
+ "missing schema content");
+ }
+ }
+
+ public String asString(QName name) {
+ if (name.getNamespaceURI().equals("")) {
+ return name.getLocalPart();
+ } else {
+ // look for a prefix
+ for (Iterator iter = prefixes(); iter.hasNext();) {
+ String prefix = (String) iter.next();
+ if (prefix.equals(name.getNamespaceURI())) {
+ return prefix + ":" + name.getLocalPart();
+ }
+ }
+
+ // not found
+ return null;
+ }
+ }
+
+ private AbstractDocument _document;
+ private String _targetNamespaceURI;
+ private SchemaElement _content;
+ private List _definedEntities;
+ private Map _nsPrefixes;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/schema/Schema.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/schema/SchemaAttribute.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/schema/SchemaAttribute.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/schema/SchemaAttribute.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,104 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document.schema;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.WriterContext;
+
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class SchemaAttribute {
+
+ public SchemaAttribute() {
+ }
+
+ public SchemaAttribute(String localName) {
+ _localName = localName;
+ }
+
+ public String getNamespaceURI() {
+ return _nsURI;
+ }
+
+ public void setNamespaceURI(String s) {
+ _nsURI = s;
+ }
+
+ public String getLocalName() {
+ return _localName;
+ }
+
+ public void setLocalName(String s) {
+ _localName = s;
+ }
+
+ public QName getQName() {
+ return new QName(_nsURI, _localName);
+ }
+
+ public String getValue() {
+ if (_qnameValue != null) {
+ if (_parent == null) {
+ throw new IllegalStateException();
+ } else {
+ return _parent.asString(_qnameValue);
+ }
+ } else {
+ return _value;
+ }
+ }
+
+ public String getValue(WriterContext context) {
+ if (_qnameValue != null) {
+ return context.getQNameString(_qnameValue);
+ } else {
+ return _value;
+ }
+ }
+
+ public void setValue(String s) {
+ _value = s;
+ }
+
+ public void setValue(QName name) {
+ _qnameValue = name;
+ }
+
+ public SchemaElement getParent() {
+ return _parent;
+ }
+
+ public void setParent(SchemaElement e) {
+ _parent = e;
+ }
+
+ private String _nsURI;
+ private String _localName;
+ private String _value;
+ private QName _qnameValue;
+ private SchemaElement _parent;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/schema/SchemaAttribute.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/schema/SchemaConstants.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/schema/SchemaConstants.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/schema/SchemaConstants.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,148 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document.schema;
+
+import javax.xml.namespace.QName;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public interface SchemaConstants {
+
+ // namespace URIs
+ public static String NS_XMLNS = "http://www.w3.org/2000/xmlns/";
+ public static String NS_XSD = "http://www.w3.org/2001/XMLSchema";
+ public static String NS_XSI = "http://www.w3.org/2001/XMLSchema-instance";
+
+ // QNames
+ public static QName QNAME_ALL = new QName(NS_XSD, "all");
+ public static QName QNAME_ANNOTATION = new QName(NS_XSD, "annotation");
+ public static QName QNAME_ANY = new QName(NS_XSD, "any");
+ public static QName QNAME_ANY_ATTRIBUTE = new QName(NS_XSD,
"anyAttribute");
+ public static QName QNAME_ATTRIBUTE = new QName(NS_XSD, "attribute");
+ public static QName QNAME_ATTRIBUTE_GROUP =
+ new QName(NS_XSD, "attributeGroup");
+ public static QName QNAME_CHOICE = new QName(NS_XSD, "choice");
+ public static QName QNAME_COMPLEX_CONTENT =
+ new QName(NS_XSD, "complexContent");
+ public static QName QNAME_COMPLEX_TYPE = new QName(NS_XSD, "complexType");
+ public static QName QNAME_ELEMENT = new QName(NS_XSD, "element");
+ public static QName QNAME_ENUMERATION = new QName(NS_XSD, "enumeration");
+ public static QName QNAME_EXTENSION = new QName(NS_XSD, "extension");
+ public static QName QNAME_FIELD = new QName(NS_XSD, "field");
+ public static QName QNAME_FRACTION_DIGITS =
+ new QName(NS_XSD, "fractionDigits");
+ public static QName QNAME_GROUP = new QName(NS_XSD, "group");
+ public static QName QNAME_IMPORT = new QName(NS_XSD, "import");
+ public static QName QNAME_INCLUDE = new QName(NS_XSD, "include");
+ public static QName QNAME_KEY = new QName(NS_XSD, "key");
+ public static QName QNAME_KEYREF = new QName(NS_XSD, "keyref");
+ public static QName QNAME_LENGTH = new QName(NS_XSD, "length");
+ public static QName QNAME_LIST = new QName(NS_XSD, "list");
+ public static QName QNAME_MAX_EXCLUSIVE = new QName(NS_XSD,
"maxExclusive");
+ public static QName QNAME_MAX_INCLUSIVE = new QName(NS_XSD,
"maxInclusive");
+ public static QName QNAME_MAX_LENGTH = new QName(NS_XSD, "maxLength");
+ public static QName QNAME_MIN_EXCLUSIVE = new QName(NS_XSD,
"minExclusive");
+ public static QName QNAME_MIN_INCLUSIVE = new QName(NS_XSD,
"minInclusive");
+ public static QName QNAME_MIN_LENGTH = new QName(NS_XSD, "minLength");
+ public static QName QNAME_NOTATION = new QName(NS_XSD, "notation");
+ public static QName QNAME_RESTRICTION = new QName(NS_XSD, "restriction");
+ public static QName QNAME_PATTERN = new QName(NS_XSD, "pattern");
+ public static QName QNAME_PRECISION = new QName(NS_XSD, "precision");
+ public static QName QNAME_REDEFINE = new QName(NS_XSD, "redefine");
+ public static QName QNAME_SCALE = new QName(NS_XSD, "scale");
+ public static QName QNAME_SCHEMA = new QName(NS_XSD, "schema");
+ public static QName QNAME_SELECTOR = new QName(NS_XSD, "selector");
+ public static QName QNAME_SEQUENCE = new QName(NS_XSD, "sequence");
+ public static QName QNAME_SIMPLE_CONTENT =
+ new QName(NS_XSD, "simpleContent");
+ public static QName QNAME_SIMPLE_TYPE = new QName(NS_XSD, "simpleType");
+ public static QName QNAME_TOTAL_DIGITS = new QName(NS_XSD, "totalDigits");
+ public static QName QNAME_UNIQUE = new QName(NS_XSD, "unique");
+ public static QName QNAME_UNION = new QName(NS_XSD, "union");
+ public static QName QNAME_WHITE_SPACE = new QName(NS_XSD, "whiteSpace");
+
+ // QNames for built-in XSD types
+ public static QName QNAME_TYPE_STRING = new QName(NS_XSD, "string");
+ public static QName QNAME_TYPE_NORMALIZED_STRING =
+ new QName(NS_XSD, "normalizedString");
+ public static QName QNAME_TYPE_TOKEN = new QName(NS_XSD, "token");
+ public static QName QNAME_TYPE_BYTE = new QName(NS_XSD, "byte");
+ public static QName QNAME_TYPE_UNSIGNED_BYTE =
+ new QName(NS_XSD, "unsignedByte");
+ public static QName QNAME_TYPE_BASE64_BINARY =
+ new QName(NS_XSD, "base64Binary");
+ public static QName QNAME_TYPE_HEX_BINARY = new QName(NS_XSD,
"hexBinary");
+ public static QName QNAME_TYPE_INTEGER = new QName(NS_XSD, "integer");
+ public static QName QNAME_TYPE_POSITIVE_INTEGER =
+ new QName(NS_XSD, "positiveInteger");
+ public static QName QNAME_TYPE_NEGATIVE_INTEGER =
+ new QName(NS_XSD, "negativeInteger");
+ public static QName QNAME_TYPE_NON_NEGATIVE_INTEGER =
+ new QName(NS_XSD, "nonNegativeInteger");
+ public static QName QNAME_TYPE_NON_POSITIVE_INTEGER =
+ new QName(NS_XSD, "nonPositiveInteger");
+ public static QName QNAME_TYPE_INT = new QName(NS_XSD, "int");
+ public static QName QNAME_TYPE_UNSIGNED_INT =
+ new QName(NS_XSD, "unsignedInt");
+ public static QName QNAME_TYPE_LONG = new QName(NS_XSD, "long");
+ public static QName QNAME_TYPE_UNSIGNED_LONG =
+ new QName(NS_XSD, "unsignedLong");
+ public static QName QNAME_TYPE_SHORT = new QName(NS_XSD, "short");
+ public static QName QNAME_TYPE_UNSIGNED_SHORT =
+ new QName(NS_XSD, "unsignedShort");
+ public static QName QNAME_TYPE_DECIMAL = new QName(NS_XSD, "decimal");
+ public static QName QNAME_TYPE_FLOAT = new QName(NS_XSD, "float");
+ public static QName QNAME_TYPE_DOUBLE = new QName(NS_XSD, "double");
+ public static QName QNAME_TYPE_BOOLEAN = new QName(NS_XSD, "boolean");
+ public static QName QNAME_TYPE_TIME = new QName(NS_XSD, "time");
+ public static QName QNAME_TYPE_DATE_TIME = new QName(NS_XSD, "dateTime");
+ public static QName QNAME_TYPE_DURATION = new QName(NS_XSD, "duration");
+ public static QName QNAME_TYPE_DATE = new QName(NS_XSD, "date");
+ public static QName QNAME_TYPE_G_MONTH = new QName(NS_XSD, "gMonth");
+ public static QName QNAME_TYPE_G_YEAR = new QName(NS_XSD, "gYear");
+ public static QName QNAME_TYPE_G_YEAR_MONTH =
+ new QName(NS_XSD, "gYearMonth");
+ public static QName QNAME_TYPE_G_DAY = new QName(NS_XSD, "gDay");
+ public static QName QNAME_TYPE_G_MONTH_DAY = new QName(NS_XSD,
"gMonthDay");
+ public static QName QNAME_TYPE_NAME = new QName(NS_XSD, "Name");
+ public static QName QNAME_TYPE_QNAME = new QName(NS_XSD, "QName");
+ public static QName QNAME_TYPE_NCNAME = new QName(NS_XSD, "NCName");
+ public static QName QNAME_TYPE_ANY_URI = new QName(NS_XSD, "anyURI");
+ public static QName QNAME_TYPE_ID = new QName(NS_XSD, "ID");
+ public static QName QNAME_TYPE_IDREF = new QName(NS_XSD, "IDREF");
+ public static QName QNAME_TYPE_IDREFS = new QName(NS_XSD, "IDREFS");
+ public static QName QNAME_TYPE_ENTITY = new QName(NS_XSD, "ENTITY");
+ public static QName QNAME_TYPE_ENTITIES = new QName(NS_XSD, "ENTITIES");
+ public static QName QNAME_TYPE_NOTATION = new QName(NS_XSD, "NOTATION");
+ public static QName QNAME_TYPE_NMTOKEN = new QName(NS_XSD, "NMTOKEN");
+ public static QName QNAME_TYPE_NMTOKENS = new QName(NS_XSD, "NMTOKENS");
+
+ public static QName QNAME_TYPE_LANGUAGE = new QName(NS_XSD, "language");
+
+ // QNames for special types
+ public static QName QNAME_TYPE_URTYPE = new QName(NS_XSD, "anyType");
+ public static QName QNAME_TYPE_SIMPLE_URTYPE =
+ new QName(NS_XSD, "anySimpleType");
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/schema/SchemaConstants.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/schema/SchemaDocument.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/schema/SchemaDocument.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/schema/SchemaDocument.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,124 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document.schema;
+
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.AbstractDocument;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Entity;
+import org.jboss.com.sun.tools.ws.wsdl.framework.EntityAction;
+import org.jboss.com.sun.tools.ws.wsdl.framework.EntityReferenceAction;
+import org.jboss.com.sun.tools.ws.wsdl.framework.EntityReferenceValidator;
+import org.jboss.com.sun.tools.ws.wsdl.framework.GloballyKnown;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Kind;
+import org.jboss.com.sun.tools.ws.wsdl.framework.NoSuchEntityException;
+import org.jboss.com.sun.tools.ws.wsdl.framework.ValidationException;
+
+
+/**
+ * A XML Schema document.
+ *
+ * @author WS Development Team
+ */
+public class SchemaDocument extends AbstractDocument {
+
+ public SchemaDocument() {
+ }
+
+ public Schema getSchema() {
+ return _schema;
+ }
+
+ public void setSchema(Schema s) {
+ _schema = s;
+ }
+
+ public Set collectAllNamespaces() {
+ Set result = super.collectAllNamespaces();
+ if (_schema.getTargetNamespaceURI() != null) {
+ result.add(_schema.getTargetNamespaceURI());
+ }
+ return result;
+ }
+
+ public void validate(EntityReferenceValidator validator) {
+ GloballyValidatingAction action =
+ new GloballyValidatingAction(this, validator);
+ withAllSubEntitiesDo(action);
+ if (action.getException() != null) {
+ throw action.getException();
+ }
+ }
+
+ protected Entity getRoot() {
+ return _schema;
+ }
+
+ private Schema _schema;
+
+ private class GloballyValidatingAction
+ implements EntityAction, EntityReferenceAction {
+ public GloballyValidatingAction(
+ AbstractDocument document,
+ EntityReferenceValidator validator) {
+ _document = document;
+ _validator = validator;
+ }
+
+ public void perform(Entity entity) {
+ try {
+ entity.validateThis();
+ entity.withAllEntityReferencesDo(this);
+ entity.withAllSubEntitiesDo(this);
+ } catch (ValidationException e) {
+ if (_exception == null) {
+ _exception = e;
+ }
+ }
+ }
+
+ public void perform(Kind kind, QName name) {
+ try {
+ GloballyKnown entity = _document.find(kind, name);
+ } catch (NoSuchEntityException e) {
+ // failed to resolve, check with the validator
+ if (_exception == null) {
+ if (_validator == null
+ || !_validator.isValid(kind, name)) {
+ _exception = e;
+ }
+ }
+ }
+ }
+
+ public ValidationException getException() {
+ return _exception;
+ }
+
+ private ValidationException _exception;
+ private AbstractDocument _document;
+ private EntityReferenceValidator _validator;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/schema/SchemaDocument.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/schema/SchemaElement.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/schema/SchemaElement.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/schema/SchemaElement.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,345 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document.schema;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.ValidationException;
+import org.jboss.com.sun.xml.ws.util.NullIterator;
+import org.jboss.com.sun.xml.ws.util.xml.XmlUtil;
+
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class SchemaElement {
+
+ public SchemaElement() {
+ }
+
+ public SchemaElement(String localName) {
+ _localName = localName;
+ }
+
+ public SchemaElement(QName name) {
+ _qname = name;
+ _localName = name.getLocalPart();
+ _nsURI = name.getNamespaceURI();
+ }
+
+ public String getNamespaceURI() {
+ return _nsURI;
+ }
+
+ public void setNamespaceURI(String s) {
+ _nsURI = s;
+ }
+
+ public String getLocalName() {
+ return _localName;
+ }
+
+ public void setLocalName(String s) {
+ _localName = s;
+ }
+
+ public QName getQName() {
+ if (_qname == null) {
+ _qname = new QName(_nsURI, _localName);
+ }
+ return _qname;
+ }
+
+ public SchemaElement getParent() {
+ return _parent;
+ }
+
+ public void setParent(SchemaElement e) {
+ _parent = e;
+ }
+
+ public SchemaElement getRoot() {
+ return _parent == null ? this : _parent.getRoot();
+ }
+
+ public Schema getSchema() {
+ return _parent == null ? _schema : _parent.getSchema();
+ }
+
+ public void setSchema(Schema s) {
+ _schema = s;
+ }
+
+ public void addChild(SchemaElement e) {
+ if (_children == null) {
+ _children = new ArrayList();
+ }
+
+ _children.add(e);
+ e.setParent(this);
+ }
+
+ public void insertChildAtTop(SchemaElement e) {
+ if (_children == null) {
+ _children = new ArrayList();
+ }
+
+ _children.add(0, e);
+ e.setParent(this);
+ }
+
+ public Iterator children() {
+ if (_children == null) {
+ return NullIterator.getInstance();
+ } else {
+ return _children.iterator();
+ }
+ }
+
+ public void addAttribute(SchemaAttribute a) {
+ if (_attributes == null) {
+ _attributes = new ArrayList();
+ }
+
+ _attributes.add(a);
+ a.setParent(this);
+ a.getValue();
+ // this is a hack to force namespace declarations to be added, if needed
+ }
+
+ public void addAttribute(String name, String value) {
+ SchemaAttribute attr = new SchemaAttribute();
+ attr.setLocalName(name);
+ attr.setValue(value);
+ addAttribute(attr);
+ }
+
+ public void addAttribute(String name, QName value) {
+ SchemaAttribute attr = new SchemaAttribute();
+ attr.setLocalName(name);
+ attr.setValue(value);
+ addAttribute(attr);
+ }
+
+ public Iterator attributes() {
+ if (_attributes == null) {
+ return NullIterator.getInstance();
+ } else {
+ return _attributes.iterator();
+ }
+ }
+
+ public SchemaAttribute getAttribute(String localName) {
+ if (_attributes != null) {
+ for (Iterator iter = _attributes.iterator(); iter.hasNext();) {
+ SchemaAttribute attr = (SchemaAttribute) iter.next();
+ if (localName.equals(attr.getLocalName())) {
+ return attr;
+ }
+ }
+ }
+ return null;
+ }
+
+ public String getValueOfMandatoryAttribute(String localName) {
+ SchemaAttribute attr = getAttribute(localName);
+ if (attr == null) {
+ throw new ValidationException(
+ "validation.missingRequiredAttribute",
+ new Object[] { localName, _localName });
+ }
+ return attr.getValue();
+ }
+
+ public String getValueOfAttributeOrNull(String localName) {
+ SchemaAttribute attr = getAttribute(localName);
+ if (attr == null) {
+ return null;
+ } else {
+ return attr.getValue();
+ }
+ }
+
+ public boolean getValueOfBooleanAttributeOrDefault(
+ String localName,
+ boolean defaultValue) {
+ String stringValue = getValueOfAttributeOrNull(localName);
+ if (stringValue == null) {
+ return defaultValue;
+ }
+ if (stringValue.equals("true") || stringValue.equals("1")) {
+ return true;
+ } else if (stringValue.equals("false") ||
stringValue.equals("0")) {
+ return false;
+ } else {
+ throw new ValidationException(
+ "validation.invalidAttributeValue",
+ new Object[] { localName, stringValue });
+ }
+ }
+
+ public int getValueOfIntegerAttributeOrDefault(
+ String localName,
+ int defaultValue) {
+ String stringValue = getValueOfAttributeOrNull(localName);
+ if (stringValue == null) {
+ return defaultValue;
+ }
+ try {
+ return Integer.parseInt(stringValue);
+ } catch (NumberFormatException e) {
+ throw new ValidationException(
+ "validation.invalidAttributeValue",
+ new Object[] { localName, stringValue });
+ }
+ }
+
+ public QName getValueOfQNameAttributeOrNull(String localName) {
+ String stringValue = getValueOfAttributeOrNull(localName);
+ if (stringValue == null)
+ return null;
+
+ String prefix = XmlUtil.getPrefix(stringValue);
+ String uri =
+ (prefix == null ? getURIForPrefix("") : getURIForPrefix(prefix));
+ if (uri == null) {
+ throw new ValidationException(
+ "validation.invalidAttributeValue",
+ new Object[] { localName, stringValue });
+ }
+ return new QName(uri, XmlUtil.getLocalPart(stringValue));
+ }
+
+ public void addPrefix(String prefix, String uri) {
+ if (_nsPrefixes == null) {
+ _nsPrefixes = new HashMap();
+ }
+
+ _nsPrefixes.put(prefix, uri);
+ }
+
+ public String getURIForPrefix(String prefix) {
+ if (_nsPrefixes != null) {
+ String result = (String) _nsPrefixes.get(prefix);
+ if (result != null)
+ return result;
+ }
+ if (_parent != null) {
+ return _parent.getURIForPrefix(prefix);
+ }
+ if (_schema != null) {
+ return _schema.getURIForPrefix(prefix);
+ }
+ // give up
+ return null;
+ }
+
+ public boolean declaresPrefixes() {
+ return _nsPrefixes != null;
+ }
+
+ public Iterator prefixes() {
+ if (_nsPrefixes == null) {
+ return NullIterator.getInstance();
+ } else {
+ return _nsPrefixes.keySet().iterator();
+ }
+ }
+
+ public QName asQName(String s) {
+ String prefix = XmlUtil.getPrefix(s);
+ if (prefix == null) {
+ prefix = "";
+ }
+ String uri = getURIForPrefix(prefix);
+ if (uri == null) {
+ throw new ValidationException("validation.invalidPrefix", prefix);
+ }
+ String localPart = XmlUtil.getLocalPart(s);
+ return new QName(uri, localPart);
+ }
+
+ public String asString(QName name) {
+ if (name.getNamespaceURI().equals("")) {
+ return name.getLocalPart();
+ } else {
+ // look for a prefix
+ for (Iterator iter = prefixes(); iter.hasNext();) {
+ String prefix = (String) iter.next();
+ String uri = getURIForPrefix(prefix);
+ if (uri.equals(name.getNamespaceURI())) {
+ if (prefix.equals("")) {
+ return name.getLocalPart();
+ } else {
+ return prefix + ":" + name.getLocalPart();
+ }
+ }
+ }
+
+ // not found
+ if (_parent != null) {
+ return _parent.asString(name);
+ }
+ if (_schema != null) {
+ String result = _schema.asString(name);
+ if (result != null) {
+ return result;
+ }
+ }
+
+ // not found and no parent
+ String prefix = getNewPrefix();
+ addPrefix(prefix, name.getNamespaceURI());
+ return asString(name);
+ }
+ }
+
+ protected String getNewPrefix() {
+ String base = NEW_NS_PREFIX_BASE;
+ int count = 2;
+ String prefix = null;
+ for (boolean needNewOne = true; needNewOne; ++count) {
+ prefix = base + Integer.toString(count);
+ needNewOne = getURIForPrefix(prefix) != null;
+ }
+ return prefix;
+ }
+
+ private String _nsURI;
+ private String _localName;
+ private List _children;
+ private List _attributes;
+ private Map _nsPrefixes;
+ private SchemaElement _parent;
+ private QName _qname;
+ private Schema _schema;
+
+ private static final String NEW_NS_PREFIX_BASE = "ns";
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/schema/SchemaElement.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/schema/SchemaEntity.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/schema/SchemaEntity.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/schema/SchemaEntity.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,82 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document.schema;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.Defining;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Entity;
+import org.jboss.com.sun.tools.ws.wsdl.framework.GloballyKnown;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Kind;
+
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class SchemaEntity extends Entity implements GloballyKnown {
+
+ public SchemaEntity(
+ Schema parent,
+ SchemaElement element,
+ Kind kind,
+ QName name) {
+ _parent = parent;
+ _element = element;
+ _kind = kind;
+ _name = name;
+ }
+
+ public SchemaElement getElement() {
+ return _element;
+ }
+
+ public QName getElementName() {
+ return _element.getQName();
+ }
+
+ public String getName() {
+ return _name.getLocalPart();
+ }
+
+ public Kind getKind() {
+ return _kind;
+ }
+
+ public Schema getSchema() {
+ return _parent;
+ }
+
+ public Defining getDefining() {
+ return _parent;
+ }
+
+ public void validateThis() {
+ // do nothing
+ }
+
+ private Schema _parent;
+ private SchemaElement _element;
+ private Kind _kind;
+ private QName _name;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/schema/SchemaEntity.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/schema/SchemaKinds.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/schema/SchemaKinds.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/schema/SchemaKinds.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,45 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document.schema;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.Kind;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class SchemaKinds {
+ public static final Kind XSD_ATTRIBUTE = new Kind("xsd:attribute");
+ public static final Kind XSD_ATTRIBUTE_GROUP =
+ new Kind("xsd:attributeGroup");
+ public static final Kind XSD_CONSTRAINT = new Kind("xsd:constraint");
+ public static final Kind XSD_ELEMENT = new Kind("xsd:element");
+ public static final Kind XSD_GROUP = new Kind("xsd:group");
+ public static final Kind XSD_IDENTITY_CONSTRAINT =
+ new Kind("xsd:identityConstraint");
+ public static final Kind XSD_NOTATION = new Kind("xsd:notation");
+ public static final Kind XSD_TYPE = new Kind("xsd:type");
+
+ private SchemaKinds() {
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/schema/SchemaKinds.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAP12Binding.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAP12Binding.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAP12Binding.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,30 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.wsdl.document.soap;
+
+import javax.xml.namespace.QName;
+
+public class SOAP12Binding extends SOAPBinding{
+ @Override public QName getElementName() {
+ return SOAP12Constants.QNAME_BINDING;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAP12Binding.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAP12Constants.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAP12Constants.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAP12Constants.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,235 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.wsdl.document.soap;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Interface defining SOAP1.2-related constants.
+ *
+ * @author WS Development Team
+ */
+public interface SOAP12Constants {
+
+ // namespace URIs
+ public static String NS_WSDL_SOAP =
"http://schemas.xmlsoap.org/wsdl/soap12/";
+ public static String NS_SOAP_ENCODING =
+ "http://schemas.xmlsoap.org/soap/encoding/";
+
+ // other URIs
+ public static String URI_SOAP_TRANSPORT_HTTP =
+ "http://www.w3.org/2003/05/soap/bindings/HTTP/";
+ ;
+
+ // QNames
+ public static QName QNAME_ADDRESS = new QName(NS_WSDL_SOAP, "address");
+ public static QName QNAME_BINDING = new QName(NS_WSDL_SOAP, "binding");
+ public static QName QNAME_BODY = new QName(NS_WSDL_SOAP, "body");
+ public static QName QNAME_FAULT = new QName(NS_WSDL_SOAP, "fault");
+ public static QName QNAME_HEADER = new QName(NS_WSDL_SOAP, "header");
+ public static QName QNAME_HEADERFAULT =
+ new QName(NS_WSDL_SOAP, "headerfault");
+ public static QName QNAME_OPERATION = new QName(NS_WSDL_SOAP,
"operation");
+
+ // SOAP encoding QNames
+ public static QName QNAME_TYPE_ARRAY = new QName(NS_SOAP_ENCODING,
"Array");
+ public static QName QNAME_ATTR_GROUP_COMMON_ATTRIBUTES =
+ new QName(NS_SOAP_ENCODING, "commonAttributes");
+ public static QName QNAME_ATTR_ARRAY_TYPE =
+ new QName(NS_SOAP_ENCODING, "arrayType");
+ public static QName QNAME_ATTR_ITEM_TYPE =
+ new QName(NS_SOAP_ENCODING, "itemType");
+ public static QName QNAME_ATTR_ARRAY_SIZE =
+ new QName(NS_SOAP_ENCODING, "arraySize");
+ public static QName QNAME_ATTR_OFFSET =
+ new QName(NS_SOAP_ENCODING, "offset");
+ public static QName QNAME_ATTR_POSITION =
+ new QName(NS_SOAP_ENCODING, "position");
+
+ public static QName QNAME_TYPE_BASE64 =
+ new QName(NS_SOAP_ENCODING, "base64");
+
+ public static QName QNAME_ELEMENT_STRING =
+ new QName(NS_SOAP_ENCODING, "string");
+ public static QName QNAME_ELEMENT_NORMALIZED_STRING =
+ new QName(NS_SOAP_ENCODING, "normalizedString");
+ public static QName QNAME_ELEMENT_TOKEN =
+ new QName(NS_SOAP_ENCODING, "token");
+ public static QName QNAME_ELEMENT_BYTE =
+ new QName(NS_SOAP_ENCODING, "byte");
+ public static QName QNAME_ELEMENT_UNSIGNED_BYTE =
+ new QName(NS_SOAP_ENCODING, "unsignedByte");
+ public static QName QNAME_ELEMENT_BASE64_BINARY =
+ new QName(NS_SOAP_ENCODING, "base64Binary");
+ public static QName QNAME_ELEMENT_HEX_BINARY =
+ new QName(NS_SOAP_ENCODING, "hexBinary");
+ public static QName QNAME_ELEMENT_INTEGER =
+ new QName(NS_SOAP_ENCODING, "integer");
+ public static QName QNAME_ELEMENT_POSITIVE_INTEGER =
+ new QName(NS_SOAP_ENCODING, "positiveInteger");
+ public static QName QNAME_ELEMENT_NEGATIVE_INTEGER =
+ new QName(NS_SOAP_ENCODING, "negativeInteger");
+ public static QName QNAME_ELEMENT_NON_NEGATIVE_INTEGER =
+ new QName(NS_SOAP_ENCODING, "nonNegativeInteger");
+ public static QName QNAME_ELEMENT_NON_POSITIVE_INTEGER =
+ new QName(NS_SOAP_ENCODING, "nonPositiveInteger");
+ public static QName QNAME_ELEMENT_INT = new QName(NS_SOAP_ENCODING,
"int");
+ public static QName QNAME_ELEMENT_UNSIGNED_INT =
+ new QName(NS_SOAP_ENCODING, "unsignedInt");
+ public static QName QNAME_ELEMENT_LONG =
+ new QName(NS_SOAP_ENCODING, "long");
+ public static QName QNAME_ELEMENT_UNSIGNED_LONG =
+ new QName(NS_SOAP_ENCODING, "unsignedLong");
+ public static QName QNAME_ELEMENT_SHORT =
+ new QName(NS_SOAP_ENCODING, "short");
+ public static QName QNAME_ELEMENT_UNSIGNED_SHORT =
+ new QName(NS_SOAP_ENCODING, "unsignedShort");
+ public static QName QNAME_ELEMENT_DECIMAL =
+ new QName(NS_SOAP_ENCODING, "decimal");
+ public static QName QNAME_ELEMENT_FLOAT =
+ new QName(NS_SOAP_ENCODING, "float");
+ public static QName QNAME_ELEMENT_DOUBLE =
+ new QName(NS_SOAP_ENCODING, "double");
+ public static QName QNAME_ELEMENT_BOOLEAN =
+ new QName(NS_SOAP_ENCODING, "boolean");
+ public static QName QNAME_ELEMENT_TIME =
+ new QName(NS_SOAP_ENCODING, "time");
+ public static QName QNAME_ELEMENT_DATE_TIME =
+ new QName(NS_SOAP_ENCODING, "dateTime");
+ public static QName QNAME_ELEMENT_DURATION =
+ new QName(NS_SOAP_ENCODING, "duration");
+ public static QName QNAME_ELEMENT_DATE =
+ new QName(NS_SOAP_ENCODING, "date");
+ public static QName QNAME_ELEMENT_G_MONTH =
+ new QName(NS_SOAP_ENCODING, "gMonth");
+ public static QName QNAME_ELEMENT_G_YEAR =
+ new QName(NS_SOAP_ENCODING, "gYear");
+ public static QName QNAME_ELEMENT_G_YEAR_MONTH =
+ new QName(NS_SOAP_ENCODING, "gYearMonth");
+ public static QName QNAME_ELEMENT_G_DAY =
+ new QName(NS_SOAP_ENCODING, "gDay");
+ public static QName QNAME_ELEMENT_G_MONTH_DAY =
+ new QName(NS_SOAP_ENCODING, "gMonthDay");
+ public static QName QNAME_ELEMENT_NAME =
+ new QName(NS_SOAP_ENCODING, "Name");
+ public static QName QNAME_ELEMENT_QNAME =
+ new QName(NS_SOAP_ENCODING, "QName");
+ public static QName QNAME_ELEMENT_NCNAME =
+ new QName(NS_SOAP_ENCODING, "NCName");
+ public static QName QNAME_ELEMENT_ANY_URI =
+ new QName(NS_SOAP_ENCODING, "anyURI");
+ public static QName QNAME_ELEMENT_ID = new QName(NS_SOAP_ENCODING, "ID");
+ public static QName QNAME_ELEMENT_IDREF =
+ new QName(NS_SOAP_ENCODING, "IDREF");
+ public static QName QNAME_ELEMENT_IDREFS =
+ new QName(NS_SOAP_ENCODING, "IDREFS");
+ public static QName QNAME_ELEMENT_ENTITY =
+ new QName(NS_SOAP_ENCODING, "ENTITY");
+ public static QName QNAME_ELEMENT_ENTITIES =
+ new QName(NS_SOAP_ENCODING, "ENTITIES");
+ public static QName QNAME_ELEMENT_NOTATION =
+ new QName(NS_SOAP_ENCODING, "NOTATION");
+ public static QName QNAME_ELEMENT_NMTOKEN =
+ new QName(NS_SOAP_ENCODING, "NMTOKEN");
+ public static QName QNAME_ELEMENT_NMTOKENS =
+ new QName(NS_SOAP_ENCODING, "NMTOKENS");
+
+ public static QName QNAME_TYPE_STRING =
+ new QName(NS_SOAP_ENCODING, "string");
+ public static QName QNAME_TYPE_NORMALIZED_STRING =
+ new QName(NS_SOAP_ENCODING, "normalizedString");
+ public static QName QNAME_TYPE_TOKEN = new QName(NS_SOAP_ENCODING,
"token");
+ public static QName QNAME_TYPE_BYTE = new QName(NS_SOAP_ENCODING, "byte");
+ public static QName QNAME_TYPE_UNSIGNED_BYTE =
+ new QName(NS_SOAP_ENCODING, "unsignedByte");
+ public static QName QNAME_TYPE_BASE64_BINARY =
+ new QName(NS_SOAP_ENCODING, "base64Binary");
+ public static QName QNAME_TYPE_HEX_BINARY =
+ new QName(NS_SOAP_ENCODING, "hexBinary");
+ public static QName QNAME_TYPE_INTEGER =
+ new QName(NS_SOAP_ENCODING, "integer");
+ public static QName QNAME_TYPE_POSITIVE_INTEGER =
+ new QName(NS_SOAP_ENCODING, "positiveInteger");
+ public static QName QNAME_TYPE_NEGATIVE_INTEGER =
+ new QName(NS_SOAP_ENCODING, "negativeInteger");
+ public static QName QNAME_TYPE_NON_NEGATIVE_INTEGER =
+ new QName(NS_SOAP_ENCODING, "nonNegativeInteger");
+ public static QName QNAME_TYPE_NON_POSITIVE_INTEGER =
+ new QName(NS_SOAP_ENCODING, "nonPositiveInteger");
+ public static QName QNAME_TYPE_INT = new QName(NS_SOAP_ENCODING, "int");
+ public static QName QNAME_TYPE_UNSIGNED_INT =
+ new QName(NS_SOAP_ENCODING, "unsignedInt");
+ public static QName QNAME_TYPE_LONG = new QName(NS_SOAP_ENCODING, "long");
+ public static QName QNAME_TYPE_UNSIGNED_LONG =
+ new QName(NS_SOAP_ENCODING, "unsignedLong");
+ public static QName QNAME_TYPE_SHORT = new QName(NS_SOAP_ENCODING,
"short");
+ public static QName QNAME_TYPE_UNSIGNED_SHORT =
+ new QName(NS_SOAP_ENCODING, "unsignedShort");
+ public static QName QNAME_TYPE_DECIMAL =
+ new QName(NS_SOAP_ENCODING, "decimal");
+ public static QName QNAME_TYPE_FLOAT = new QName(NS_SOAP_ENCODING,
"float");
+ public static QName QNAME_TYPE_DOUBLE =
+ new QName(NS_SOAP_ENCODING, "double");
+ public static QName QNAME_TYPE_BOOLEAN =
+ new QName(NS_SOAP_ENCODING, "boolean");
+ public static QName QNAME_TYPE_TIME = new QName(NS_SOAP_ENCODING, "time");
+ public static QName QNAME_TYPE_DATE_TIME =
+ new QName(NS_SOAP_ENCODING, "dateTime");
+ public static QName QNAME_TYPE_DURATION =
+ new QName(NS_SOAP_ENCODING, "duration");
+ public static QName QNAME_TYPE_DATE = new QName(NS_SOAP_ENCODING, "date");
+ public static QName QNAME_TYPE_G_MONTH =
+ new QName(NS_SOAP_ENCODING, "gMonth");
+ public static QName QNAME_TYPE_G_YEAR =
+ new QName(NS_SOAP_ENCODING, "gYear");
+ public static QName QNAME_TYPE_G_YEAR_MONTH =
+ new QName(NS_SOAP_ENCODING, "gYearMonth");
+ public static QName QNAME_TYPE_G_DAY = new QName(NS_SOAP_ENCODING,
"gDay");
+ public static QName QNAME_TYPE_G_MONTH_DAY =
+ new QName(NS_SOAP_ENCODING, "gMonthDay");
+ public static QName QNAME_TYPE_NAME = new QName(NS_SOAP_ENCODING, "Name");
+ public static QName QNAME_TYPE_QNAME = new QName(NS_SOAP_ENCODING,
"QName");
+ public static QName QNAME_TYPE_NCNAME =
+ new QName(NS_SOAP_ENCODING, "NCName");
+ public static QName QNAME_TYPE_ANY_URI =
+ new QName(NS_SOAP_ENCODING, "anyURI");
+ public static QName QNAME_TYPE_ID = new QName(NS_SOAP_ENCODING, "ID");
+ public static QName QNAME_TYPE_IDREF = new QName(NS_SOAP_ENCODING,
"IDREF");
+ public static QName QNAME_TYPE_IDREFS =
+ new QName(NS_SOAP_ENCODING, "IDREFS");
+ public static QName QNAME_TYPE_ENTITY =
+ new QName(NS_SOAP_ENCODING, "ENTITY");
+ public static QName QNAME_TYPE_ENTITIES =
+ new QName(NS_SOAP_ENCODING, "ENTITIES");
+ public static QName QNAME_TYPE_NOTATION =
+ new QName(NS_SOAP_ENCODING, "NOTATION");
+ public static QName QNAME_TYPE_NMTOKEN =
+ new QName(NS_SOAP_ENCODING, "NMTOKEN");
+ public static QName QNAME_TYPE_NMTOKENS =
+ new QName(NS_SOAP_ENCODING, "NMTOKENS");
+ public static QName QNAME_TYPE_LANGUAGE =
+ new QName(NS_SOAP_ENCODING, "LANGUAGE");
+
+ // SOAP attributes with non-colonized names
+ public static QName QNAME_ATTR_ID = new QName("", "id");
+ public static QName QNAME_ATTR_HREF = new QName("", "ref");
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAP12Constants.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPAddress.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPAddress.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPAddress.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,59 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document.soap;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extension;
+
+
+/**
+ * A SOAP address extension.
+ *
+ * @author WS Development Team
+ */
+public class SOAPAddress extends Extension {
+
+ public SOAPAddress() {
+ }
+
+ public QName getElementName() {
+ return SOAPConstants.QNAME_ADDRESS;
+ }
+
+ public String getLocation() {
+ return _location;
+ }
+
+ public void setLocation(String s) {
+ _location = s;
+ }
+
+ public void validateThis() {
+ if (_location == null) {
+ failValidation("validation.missingRequiredAttribute",
"location");
+ }
+ }
+
+ private String _location;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPAddress.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPBinding.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPBinding.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPBinding.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,74 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document.soap;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extension;
+
+
+/**
+ * A SOAP binding extension.
+ *
+ * @author WS Development Team
+ */
+public class SOAPBinding extends Extension {
+
+ public SOAPBinding() {
+ _style = SOAPStyle.DOCUMENT;
+ }
+
+ public QName getElementName() {
+ return SOAPConstants.QNAME_BINDING;
+ }
+
+ public String getTransport() {
+ return _transport;
+ }
+
+ public void setTransport(String s) {
+ _transport = s;
+ }
+
+ public SOAPStyle getStyle() {
+ return _style;
+ }
+
+ public void setStyle(SOAPStyle s) {
+ _style = s;
+ }
+
+ public boolean isDocument() {
+ return _style == SOAPStyle.DOCUMENT;
+ }
+
+ public boolean isRPC() {
+ return _style == SOAPStyle.RPC;
+ }
+
+ public void validateThis() {
+ }
+
+ private String _transport;
+ private SOAPStyle _style;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPBinding.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPBody.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPBody.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPBody.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,91 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document.soap;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extension;
+
+
+/**
+ * A SOAP body extension.
+ *
+ * @author WS Development Team
+ */
+public class SOAPBody extends Extension {
+
+ public SOAPBody() {
+ }
+
+ public QName getElementName() {
+ return SOAPConstants.QNAME_BODY;
+ }
+
+ public String getNamespace() {
+ return _namespace;
+ }
+
+ public void setNamespace(String s) {
+ _namespace = s;
+ }
+
+ public SOAPUse getUse() {
+ return _use;
+ }
+
+ public void setUse(SOAPUse u) {
+ _use = u;
+ }
+
+ public boolean isEncoded() {
+ return _use == SOAPUse.ENCODED;
+ }
+
+ public boolean isLiteral() {
+ return _use == SOAPUse.LITERAL;
+ }
+
+ public String getEncodingStyle() {
+ return _encodingStyle;
+ }
+
+ public void setEncodingStyle(String s) {
+ _encodingStyle = s;
+ }
+
+ public String getParts() {
+ return _parts;
+ }
+
+ public void setParts(String s) {
+ _parts = s;
+ }
+
+ public void validateThis() {
+ }
+
+ private String _encodingStyle;
+ private String _namespace;
+ private String _parts;
+ private SOAPUse _use=SOAPUse.LITERAL;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPBody.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPConstants.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPConstants.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPConstants.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,257 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document.soap;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.xml.ws.encoding.soap.streaming.SOAPNamespaceConstants;
+
+
+/**
+ * Interface defining SOAP-related constants.
+ *
+ * @author WS Development Team
+ */
+public interface SOAPConstants {
+
+ // namespace URIs
+ public static final String URI_ENVELOPE = SOAPNamespaceConstants.ENVELOPE;
+ public static final String NS_WSDL_SOAP =
+ "http://schemas.xmlsoap.org/wsdl/soap/";
+ public static final String NS_SOAP_ENCODING =
"http://schemas.xmlsoap.org/soap/encoding/";
+
+ // other URIs
+ public final String URI_SOAP_TRANSPORT_HTTP =
+ "http://schemas.xmlsoap.org/soap/http";
+
+ // QNames
+ public static final QName QNAME_ADDRESS =
+ new QName(NS_WSDL_SOAP, "address");
+ public static final QName QNAME_BINDING =
+ new QName(NS_WSDL_SOAP, "binding");
+ public static final QName QNAME_BODY = new QName(NS_WSDL_SOAP, "body");
+ public static final QName QNAME_FAULT = new QName(NS_WSDL_SOAP, "fault");
+ public static final QName QNAME_HEADER = new QName(NS_WSDL_SOAP,
"header");
+ public static final QName QNAME_HEADERFAULT =
+ new QName(NS_WSDL_SOAP, "headerfault");
+ public static final QName QNAME_OPERATION =
+ new QName(NS_WSDL_SOAP, "operation");
+ public static final QName QNAME_MUSTUNDERSTAND =
+ new QName(URI_ENVELOPE, "mustUnderstand");
+
+
+ // SOAP encoding QNames
+ public static final QName QNAME_TYPE_ARRAY =
+ new QName(NS_SOAP_ENCODING, "Array");
+ public static final QName QNAME_ATTR_GROUP_COMMON_ATTRIBUTES =
+ new QName(NS_SOAP_ENCODING, "commonAttributes");
+ public static final QName QNAME_ATTR_ARRAY_TYPE =
+ new QName(NS_SOAP_ENCODING, "arrayType");
+ public static final QName QNAME_ATTR_OFFSET =
+ new QName(NS_SOAP_ENCODING, "offset");
+ public static final QName QNAME_ATTR_POSITION =
+ new QName(NS_SOAP_ENCODING, "position");
+
+ public static final QName QNAME_TYPE_BASE64 =
+ new QName(NS_SOAP_ENCODING, "base64");
+
+ public static final QName QNAME_ELEMENT_STRING =
+ new QName(NS_SOAP_ENCODING, "string");
+ public static final QName QNAME_ELEMENT_NORMALIZED_STRING =
+ new QName(NS_SOAP_ENCODING, "normalizedString");
+ public static final QName QNAME_ELEMENT_TOKEN =
+ new QName(NS_SOAP_ENCODING, "token");
+ public static final QName QNAME_ELEMENT_BYTE =
+ new QName(NS_SOAP_ENCODING, "byte");
+ public static final QName QNAME_ELEMENT_UNSIGNED_BYTE =
+ new QName(NS_SOAP_ENCODING, "unsignedByte");
+ public static final QName QNAME_ELEMENT_BASE64_BINARY =
+ new QName(NS_SOAP_ENCODING, "base64Binary");
+ public static final QName QNAME_ELEMENT_HEX_BINARY =
+ new QName(NS_SOAP_ENCODING, "hexBinary");
+ public static final QName QNAME_ELEMENT_INTEGER =
+ new QName(NS_SOAP_ENCODING, "integer");
+ public static final QName QNAME_ELEMENT_POSITIVE_INTEGER =
+ new QName(NS_SOAP_ENCODING, "positiveInteger");
+ public static final QName QNAME_ELEMENT_NEGATIVE_INTEGER =
+ new QName(NS_SOAP_ENCODING, "negativeInteger");
+ public static final QName QNAME_ELEMENT_NON_NEGATIVE_INTEGER =
+ new QName(NS_SOAP_ENCODING, "nonNegativeInteger");
+ public static final QName QNAME_ELEMENT_NON_POSITIVE_INTEGER =
+ new QName(NS_SOAP_ENCODING, "nonPositiveInteger");
+ public static final QName QNAME_ELEMENT_INT =
+ new QName(NS_SOAP_ENCODING, "int");
+ public static final QName QNAME_ELEMENT_UNSIGNED_INT =
+ new QName(NS_SOAP_ENCODING, "unsignedInt");
+ public static final QName QNAME_ELEMENT_LONG =
+ new QName(NS_SOAP_ENCODING, "long");
+ public static final QName QNAME_ELEMENT_UNSIGNED_LONG =
+ new QName(NS_SOAP_ENCODING, "unsignedLong");
+ public static final QName QNAME_ELEMENT_SHORT =
+ new QName(NS_SOAP_ENCODING, "short");
+ public static final QName QNAME_ELEMENT_UNSIGNED_SHORT =
+ new QName(NS_SOAP_ENCODING, "unsignedShort");
+ public static final QName QNAME_ELEMENT_DECIMAL =
+ new QName(NS_SOAP_ENCODING, "decimal");
+ public static final QName QNAME_ELEMENT_FLOAT =
+ new QName(NS_SOAP_ENCODING, "float");
+ public static final QName QNAME_ELEMENT_DOUBLE =
+ new QName(NS_SOAP_ENCODING, "double");
+ public static final QName QNAME_ELEMENT_BOOLEAN =
+ new QName(NS_SOAP_ENCODING, "boolean");
+ public static final QName QNAME_ELEMENT_TIME =
+ new QName(NS_SOAP_ENCODING, "time");
+ public static final QName QNAME_ELEMENT_DATE_TIME =
+ new QName(NS_SOAP_ENCODING, "dateTime");
+ public static final QName QNAME_ELEMENT_DURATION =
+ new QName(NS_SOAP_ENCODING, "duration");
+ public static final QName QNAME_ELEMENT_DATE =
+ new QName(NS_SOAP_ENCODING, "date");
+ public static final QName QNAME_ELEMENT_G_MONTH =
+ new QName(NS_SOAP_ENCODING, "gMonth");
+ public static final QName QNAME_ELEMENT_G_YEAR =
+ new QName(NS_SOAP_ENCODING, "gYear");
+ public static final QName QNAME_ELEMENT_G_YEAR_MONTH =
+ new QName(NS_SOAP_ENCODING, "gYearMonth");
+ public static final QName QNAME_ELEMENT_G_DAY =
+ new QName(NS_SOAP_ENCODING, "gDay");
+ public static final QName QNAME_ELEMENT_G_MONTH_DAY =
+ new QName(NS_SOAP_ENCODING, "gMonthDay");
+ public static final QName QNAME_ELEMENT_NAME =
+ new QName(NS_SOAP_ENCODING, "Name");
+ public static final QName QNAME_ELEMENT_QNAME =
+ new QName(NS_SOAP_ENCODING, "QName");
+ public static final QName QNAME_ELEMENT_NCNAME =
+ new QName(NS_SOAP_ENCODING, "NCName");
+ public static final QName QNAME_ELEMENT_ANY_URI =
+ new QName(NS_SOAP_ENCODING, "anyURI");
+ public static final QName QNAME_ELEMENT_ID =
+ new QName(NS_SOAP_ENCODING, "ID");
+ public static final QName QNAME_ELEMENT_IDREF =
+ new QName(NS_SOAP_ENCODING, "IDREF");
+ public static final QName QNAME_ELEMENT_IDREFS =
+ new QName(NS_SOAP_ENCODING, "IDREFS");
+ public static final QName QNAME_ELEMENT_ENTITY =
+ new QName(NS_SOAP_ENCODING, "ENTITY");
+ public static final QName QNAME_ELEMENT_ENTITIES =
+ new QName(NS_SOAP_ENCODING, "ENTITIES");
+ public static final QName QNAME_ELEMENT_NOTATION =
+ new QName(NS_SOAP_ENCODING, "NOTATION");
+ public static final QName QNAME_ELEMENT_NMTOKEN =
+ new QName(NS_SOAP_ENCODING, "NMTOKEN");
+ public static final QName QNAME_ELEMENT_NMTOKENS =
+ new QName(NS_SOAP_ENCODING, "NMTOKENS");
+
+ public static final QName QNAME_TYPE_STRING =
+ new QName(NS_SOAP_ENCODING, "string");
+ public static final QName QNAME_TYPE_NORMALIZED_STRING =
+ new QName(NS_SOAP_ENCODING, "normalizedString");
+ public static final QName QNAME_TYPE_TOKEN =
+ new QName(NS_SOAP_ENCODING, "token");
+ public static final QName QNAME_TYPE_BYTE =
+ new QName(NS_SOAP_ENCODING, "byte");
+ public static final QName QNAME_TYPE_UNSIGNED_BYTE =
+ new QName(NS_SOAP_ENCODING, "unsignedByte");
+ public static final QName QNAME_TYPE_BASE64_BINARY =
+ new QName(NS_SOAP_ENCODING, "base64Binary");
+ public static final QName QNAME_TYPE_HEX_BINARY =
+ new QName(NS_SOAP_ENCODING, "hexBinary");
+ public static final QName QNAME_TYPE_INTEGER =
+ new QName(NS_SOAP_ENCODING, "integer");
+ public static final QName QNAME_TYPE_POSITIVE_INTEGER =
+ new QName(NS_SOAP_ENCODING, "positiveInteger");
+ public static final QName QNAME_TYPE_NEGATIVE_INTEGER =
+ new QName(NS_SOAP_ENCODING, "negativeInteger");
+ public static final QName QNAME_TYPE_NON_NEGATIVE_INTEGER =
+ new QName(NS_SOAP_ENCODING, "nonNegativeInteger");
+ public static final QName QNAME_TYPE_NON_POSITIVE_INTEGER =
+ new QName(NS_SOAP_ENCODING, "nonPositiveInteger");
+ public static final QName QNAME_TYPE_INT =
+ new QName(NS_SOAP_ENCODING, "int");
+ public static final QName QNAME_TYPE_UNSIGNED_INT =
+ new QName(NS_SOAP_ENCODING, "unsignedInt");
+ public static final QName QNAME_TYPE_LONG =
+ new QName(NS_SOAP_ENCODING, "long");
+ public static final QName QNAME_TYPE_UNSIGNED_LONG =
+ new QName(NS_SOAP_ENCODING, "unsignedLong");
+ public static final QName QNAME_TYPE_SHORT =
+ new QName(NS_SOAP_ENCODING, "short");
+ public static final QName QNAME_TYPE_UNSIGNED_SHORT =
+ new QName(NS_SOAP_ENCODING, "unsignedShort");
+ public static final QName QNAME_TYPE_DECIMAL =
+ new QName(NS_SOAP_ENCODING, "decimal");
+ public static final QName QNAME_TYPE_FLOAT =
+ new QName(NS_SOAP_ENCODING, "float");
+ public static final QName QNAME_TYPE_DOUBLE =
+ new QName(NS_SOAP_ENCODING, "double");
+ public static final QName QNAME_TYPE_BOOLEAN =
+ new QName(NS_SOAP_ENCODING, "boolean");
+ public static final QName QNAME_TYPE_TIME =
+ new QName(NS_SOAP_ENCODING, "time");
+ public static final QName QNAME_TYPE_DATE_TIME =
+ new QName(NS_SOAP_ENCODING, "dateTime");
+ public static final QName QNAME_TYPE_DURATION =
+ new QName(NS_SOAP_ENCODING, "duration");
+ public static final QName QNAME_TYPE_DATE =
+ new QName(NS_SOAP_ENCODING, "date");
+ public static final QName QNAME_TYPE_G_MONTH =
+ new QName(NS_SOAP_ENCODING, "gMonth");
+ public static final QName QNAME_TYPE_G_YEAR =
+ new QName(NS_SOAP_ENCODING, "gYear");
+ public static final QName QNAME_TYPE_G_YEAR_MONTH =
+ new QName(NS_SOAP_ENCODING, "gYearMonth");
+ public static final QName QNAME_TYPE_G_DAY =
+ new QName(NS_SOAP_ENCODING, "gDay");
+ public static final QName QNAME_TYPE_G_MONTH_DAY =
+ new QName(NS_SOAP_ENCODING, "gMonthDay");
+ public static final QName QNAME_TYPE_NAME =
+ new QName(NS_SOAP_ENCODING, "Name");
+ public static final QName QNAME_TYPE_QNAME =
+ new QName(NS_SOAP_ENCODING, "QName");
+ public static final QName QNAME_TYPE_NCNAME =
+ new QName(NS_SOAP_ENCODING, "NCName");
+ public static final QName QNAME_TYPE_ANY_URI =
+ new QName(NS_SOAP_ENCODING, "anyURI");
+ public static final QName QNAME_TYPE_ID = new QName(NS_SOAP_ENCODING,
"ID");
+ public static final QName QNAME_TYPE_IDREF =
+ new QName(NS_SOAP_ENCODING, "IDREF");
+ public static final QName QNAME_TYPE_IDREFS =
+ new QName(NS_SOAP_ENCODING, "IDREFS");
+ public static final QName QNAME_TYPE_ENTITY =
+ new QName(NS_SOAP_ENCODING, "ENTITY");
+ public static final QName QNAME_TYPE_ENTITIES =
+ new QName(NS_SOAP_ENCODING, "ENTITIES");
+ public static final QName QNAME_TYPE_NOTATION =
+ new QName(NS_SOAP_ENCODING, "NOTATION");
+ public static final QName QNAME_TYPE_NMTOKEN =
+ new QName(NS_SOAP_ENCODING, "NMTOKEN");
+ public static final QName QNAME_TYPE_NMTOKENS =
+ new QName(NS_SOAP_ENCODING, "NMTOKENS");
+ public static final QName QNAME_TYPE_LANGUAGE =
+ new QName(NS_SOAP_ENCODING, "LANGUAGE");
+
+ // SOAP attributes with non-colonized names
+ public static final QName QNAME_ATTR_ID = new QName("", "id");
+ public static final QName QNAME_ATTR_HREF = new QName("",
"href");
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPConstants.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPFault.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPFault.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPFault.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,92 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document.soap;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extension;
+
+
+/**
+ * A SOAP fault extension.
+ *
+ * @author WS Development Team
+ */
+public class SOAPFault extends Extension {
+
+ public SOAPFault() {
+ _use = SOAPUse.LITERAL;
+ }
+
+ public QName getElementName() {
+ return SOAPConstants.QNAME_FAULT;
+ }
+
+ public String getName() {
+ return _name;
+ }
+
+ public void setName(String s) {
+ _name = s;
+ }
+
+ public String getNamespace() {
+ return _namespace;
+ }
+
+ public void setNamespace(String s) {
+ _namespace = s;
+ }
+
+ public SOAPUse getUse() {
+ return _use;
+ }
+
+ public void setUse(SOAPUse u) {
+ _use = u;
+ }
+
+ public boolean isEncoded() {
+ return _use == SOAPUse.ENCODED;
+ }
+
+ public boolean isLiteral() {
+ return _use == SOAPUse.LITERAL;
+ }
+
+ public String getEncodingStyle() {
+ return _encodingStyle;
+ }
+
+ public void setEncodingStyle(String s) {
+ _encodingStyle = s;
+ }
+
+ public void validateThis() {
+ }
+
+ private String _name;
+ private String _encodingStyle;
+ private String _namespace;
+ private SOAPUse _use = SOAPUse.LITERAL;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPFault.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPHeader.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPHeader.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPHeader.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,152 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document.soap;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.Entity;
+import org.jboss.com.sun.tools.ws.wsdl.framework.EntityAction;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extension;
+import org.jboss.com.sun.tools.ws.wsdl.framework.ExtensionVisitor;
+import org.jboss.com.sun.tools.ws.wsdl.framework.QNameAction;
+
+
+/**
+ * A SOAP header extension.
+ *
+ * @author WS Development Team
+ */
+public class SOAPHeader extends Extension {
+
+ public SOAPHeader() {
+ _faults = new ArrayList();
+ }
+
+ public void add(SOAPHeaderFault fault) {
+ _faults.add(fault);
+ }
+
+ public Iterator faults() {
+ return _faults.iterator();
+ }
+
+ public QName getElementName() {
+ return SOAPConstants.QNAME_HEADER;
+ }
+
+ public String getNamespace() {
+ return _namespace;
+ }
+
+ public void setNamespace(String s) {
+ _namespace = s;
+ }
+
+ public SOAPUse getUse() {
+ return _use;
+ }
+
+ public void setUse(SOAPUse u) {
+ _use = u;
+ }
+
+ public boolean isEncoded() {
+ return _use == SOAPUse.ENCODED;
+ }
+
+ public boolean isLiteral() {
+ return _use == SOAPUse.LITERAL;
+ }
+
+ public String getEncodingStyle() {
+ return _encodingStyle;
+ }
+
+ public void setEncodingStyle(String s) {
+ _encodingStyle = s;
+ }
+
+ public String getPart() {
+ return _part;
+ }
+
+ public void setMessage(QName message) {
+ _message = message;
+ }
+
+ public QName getMessage() {
+ return _message;
+ }
+
+ public void setPart(String s) {
+ _part = s;
+ }
+
+ public void withAllSubEntitiesDo(EntityAction action) {
+ super.withAllSubEntitiesDo(action);
+
+ for (Iterator iter = _faults.iterator(); iter.hasNext();) {
+ action.perform((Entity) iter.next());
+ }
+ }
+
+ public void withAllQNamesDo(QNameAction action) {
+ super.withAllQNamesDo(action);
+
+ if (_message != null) {
+ action.perform(_message);
+ }
+ }
+
+ public void accept(ExtensionVisitor visitor) throws Exception {
+ visitor.preVisit(this);
+ for (Iterator iter = _faults.iterator(); iter.hasNext();) {
+ ((SOAPHeaderFault) iter.next()).accept(visitor);
+ }
+ visitor.postVisit(this);
+ }
+
+ public void validateThis() {
+ if (_message == null) {
+ failValidation("validation.missingRequiredAttribute",
"message");
+ }
+ if (_part == null) {
+ failValidation("validation.missingRequiredAttribute",
"part");
+ }
+ // Fix for bug 4851427
+ // if (_use == null) {
+ // failValidation("validation.missingRequiredAttribute",
"use");
+ // }
+ }
+
+ private String _encodingStyle;
+ private String _namespace;
+ private String _part;
+ private QName _message;
+ private SOAPUse _use=SOAPUse.LITERAL;
+ private List _faults;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPHeader.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPHeaderFault.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPHeaderFault.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPHeaderFault.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,118 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document.soap;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extension;
+import org.jboss.com.sun.tools.ws.wsdl.framework.QNameAction;
+
+
+/**
+ * A SOAP header fault extension.
+ *
+ * @author WS Development Team
+ */
+public class SOAPHeaderFault extends Extension {
+
+ public SOAPHeaderFault() {
+ }
+
+ public QName getElementName() {
+ return SOAPConstants.QNAME_HEADERFAULT;
+ }
+
+ public String getNamespace() {
+ return _namespace;
+ }
+
+ public void setNamespace(String s) {
+ _namespace = s;
+ }
+
+ public SOAPUse getUse() {
+ return _use;
+ }
+
+ public void setUse(SOAPUse u) {
+ _use = u;
+ }
+
+ public boolean isEncoded() {
+ return _use == SOAPUse.ENCODED;
+ }
+
+ public boolean isLiteral() {
+ return _use == SOAPUse.LITERAL;
+ }
+
+ public String getEncodingStyle() {
+ return _encodingStyle;
+ }
+
+ public void setEncodingStyle(String s) {
+ _encodingStyle = s;
+ }
+
+ public String getPart() {
+ return _part;
+ }
+
+ public void setMessage(QName message) {
+ _message = message;
+ }
+
+ public QName getMessage() {
+ return _message;
+ }
+
+ public void setPart(String s) {
+ _part = s;
+ }
+
+ public void withAllQNamesDo(QNameAction action) {
+ super.withAllQNamesDo(action);
+
+ if (_message != null) {
+ action.perform(_message);
+ }
+ }
+
+ public void validateThis() {
+ if (_message == null) {
+ failValidation("validation.missingRequiredAttribute",
"message");
+ }
+ if (_part == null) {
+ failValidation("validation.missingRequiredAttribute",
"part");
+ }
+ if (_use == null) {
+ failValidation("validation.missingRequiredAttribute",
"use");
+ }
+ }
+
+ private String _encodingStyle;
+ private String _namespace;
+ private String _part;
+ private QName _message;
+ private SOAPUse _use=SOAPUse.LITERAL;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPHeaderFault.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPOperation.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPOperation.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPOperation.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,73 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document.soap;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extension;
+
+
+/**
+ * A SOAP operation extension.
+ *
+ * @author WS Development Team
+ */
+public class SOAPOperation extends Extension {
+
+ public SOAPOperation() {
+ }
+
+ public QName getElementName() {
+ return SOAPConstants.QNAME_OPERATION;
+ }
+
+ public String getSOAPAction() {
+ return _soapAction;
+ }
+
+ public void setSOAPAction(String s) {
+ _soapAction = s;
+ }
+
+ public SOAPStyle getStyle() {
+ return _style;
+ }
+
+ public void setStyle(SOAPStyle s) {
+ _style = s;
+ }
+
+ public boolean isDocument() {
+ return _style == SOAPStyle.DOCUMENT;
+ }
+
+ public boolean isRPC() {
+ return _style == SOAPStyle.RPC;
+ }
+
+ public void validateThis() {
+ }
+
+ private String _soapAction;
+ private SOAPStyle _style;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPOperation.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPStyle.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPStyle.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPStyle.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,37 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document.soap;
+
+/**
+ * A SOAP "style" enumeration.
+ *
+ * @author WS Development Team
+ */
+public final class SOAPStyle {
+
+ public static final SOAPStyle RPC = new SOAPStyle();
+ public static final SOAPStyle DOCUMENT = new SOAPStyle();
+
+ private SOAPStyle() {
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPStyle.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPUse.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPUse.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPUse.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,37 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.document.soap;
+
+/**
+ * A SOAP "use" enumeration.
+ *
+ * @author WS Development Team
+ */
+public final class SOAPUse {
+
+ public static final SOAPUse LITERAL = new SOAPUse();
+ public static final SOAPUse ENCODED = new SOAPUse();
+
+ private SOAPUse() {
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/document/soap/SOAPUse.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/AbstractDocument.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/AbstractDocument.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/AbstractDocument.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,257 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.framework;
+
+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;
+
+import javax.xml.namespace.QName;
+
+/**
+ * An abstract class for documents containing entities.
+ *
+ * @author WS Development Team
+ */
+public abstract class AbstractDocument {
+
+ protected AbstractDocument() {
+ _kinds = new HashMap();
+ _identifiables = new HashMap();
+ _importedEntities = new ArrayList();
+ _importedDocuments = new HashSet();
+ _includedEntities = new ArrayList();
+ _includedDocuments = new HashSet();
+ }
+
+ public String getSystemId() {
+ return _systemId;
+ }
+
+ public void setSystemId(String s) {
+ if (_systemId != null && !_systemId.equals(s)) {
+ // avoid redefinition of a system identifier
+ throw new IllegalArgumentException();
+ }
+
+ _systemId = s;
+ if (s != null) {
+ _importedDocuments.add(s);
+ }
+ }
+
+ public void addIncludedDocument(String systemId) {
+ _includedDocuments.add(systemId);
+ }
+
+ public boolean isIncludedDocument(String systemId) {
+ return _includedDocuments.contains(systemId);
+ }
+
+ public void addIncludedEntity(Entity entity) {
+ _includedEntities.add(entity);
+ }
+
+ public void addImportedDocument(String systemId) {
+ _importedDocuments.add(systemId);
+ }
+
+ public boolean isImportedDocument(String systemId) {
+ return _importedDocuments.contains(systemId);
+ }
+
+ public void addImportedEntity(Entity entity) {
+ _importedEntities.add(entity);
+ }
+
+ public void withAllSubEntitiesDo(EntityAction action) {
+ if (getRoot() != null) {
+ action.perform(getRoot());
+ }
+
+ for (Iterator iter = _importedEntities.iterator(); iter.hasNext();) {
+ action.perform((Entity) iter.next());
+ }
+
+ for (Iterator iter = _includedEntities.iterator(); iter.hasNext();) {
+ action.perform((Entity) iter.next());
+ }
+ }
+
+ public Map getMap(Kind k) {
+ Map m = (Map) _kinds.get(k.getName());
+ if (m == null) {
+ m = new HashMap();
+ _kinds.put(k.getName(), m);
+ }
+ return m;
+ }
+
+ public void define(GloballyKnown e) {
+ Map map = getMap(e.getKind());
+ if (e.getName() == null)
+ return;
+ QName name =
+ new QName(e.getDefining().getTargetNamespaceURI(), e.getName());
+
+ if (map.containsKey(name))
+ throw new DuplicateEntityException(e);
+ else
+ map.put(name, e);
+ }
+
+ public void undefine(GloballyKnown e) {
+ Map map = getMap(e.getKind());
+ if (e.getName() == null)
+ return;
+ QName name =
+ new QName(e.getDefining().getTargetNamespaceURI(), e.getName());
+
+ if (map.containsKey(name))
+ throw new NoSuchEntityException(name);
+ else
+ map.remove(name);
+ }
+
+ public GloballyKnown find(Kind k, QName name) {
+ Map map = getMap(k);
+ Object result = map.get(name);
+ if (result == null)
+ throw new NoSuchEntityException(name);
+ return (GloballyKnown) result;
+ }
+
+ public void defineID(Identifiable e) {
+ String id = e.getID();
+ if (id == null)
+ return;
+
+ if (_identifiables.containsKey(id))
+ throw new DuplicateEntityException(e);
+ else
+ _identifiables.put(id, e);
+ }
+
+ public void undefineID(Identifiable e) {
+ String id = e.getID();
+
+ if (id == null)
+ return;
+
+ if (_identifiables.containsKey(id))
+ throw new NoSuchEntityException(id);
+ else
+ _identifiables.remove(id);
+ }
+
+ public Identifiable findByID(String id) {
+ Object result = _identifiables.get(id);
+ if (result == null)
+ throw new NoSuchEntityException(id);
+ return (Identifiable) result;
+ }
+
+ public Set collectAllQNames() {
+ final Set result = new HashSet();
+ EntityAction action = new EntityAction() {
+ public void perform(Entity entity) {
+ entity.withAllQNamesDo(new QNameAction() {
+ public void perform(QName name) {
+ result.add(name);
+ }
+ });
+ entity.withAllSubEntitiesDo(this);
+ }
+ };
+ withAllSubEntitiesDo(action);
+ return result;
+ }
+
+ public Set collectAllNamespaces() {
+ final Set result = new HashSet();
+
+ EntityAction action = new EntityAction() {
+ public void perform(Entity entity) {
+ entity.withAllQNamesDo(new QNameAction() {
+ public void perform(QName name) {
+ result.add(name.getNamespaceURI());
+ }
+ });
+
+ entity.withAllSubEntitiesDo(this);
+ }
+ };
+ withAllSubEntitiesDo(action);
+ return result;
+ }
+
+ public void validateLocally() {
+ LocallyValidatingAction action = new LocallyValidatingAction();
+ withAllSubEntitiesDo(action);
+ if (action.getException() != null) {
+ throw action.getException();
+ }
+ }
+
+ public void validate() {
+ validate(null);
+ }
+
+ public abstract void validate(EntityReferenceValidator validator);
+
+ protected abstract Entity getRoot();
+
+ private Map _kinds;
+ private Map _identifiables;
+ private String _systemId;
+ private Set _importedDocuments;
+ private List _importedEntities;
+ private Set _includedDocuments;
+ private List _includedEntities;
+
+ private class LocallyValidatingAction implements EntityAction {
+ public LocallyValidatingAction() {
+ }
+
+ public void perform(Entity entity) {
+ try {
+ entity.validateThis();
+ entity.withAllSubEntitiesDo(this);
+ } catch (ValidationException e) {
+ if (_exception == null) {
+ _exception = e;
+ }
+ }
+ }
+
+ public ValidationException getException() {
+ return _exception;
+ }
+
+ private ValidationException _exception;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/AbstractDocument.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/Defining.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/Defining.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/Defining.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,32 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.framework;
+
+/**
+ * An interface implemented by entities that define target namespaces.
+ *
+ * @author WS Development Team
+ */
+public interface Defining extends Elemental {
+ public String getTargetNamespaceURI();
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/Defining.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/DuplicateEntityException.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/DuplicateEntityException.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/DuplicateEntityException.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,55 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.framework;
+
+/**
+ * An exception signalling that an entity with the given name/id has already been
defined.
+ *
+ * @author WS Development Team
+ */
+public class DuplicateEntityException extends ValidationException {
+
+ public DuplicateEntityException(GloballyKnown entity) {
+ super(
+ "entity.duplicateWithType",
+ entity.getElementName().getLocalPart(),
+ entity.getName());
+ }
+
+ public DuplicateEntityException(Identifiable entity) {
+ super(
+ "entity.duplicateWithType",
+ entity.getElementName().getLocalPart(),
+ entity.getID());
+ }
+
+ public DuplicateEntityException(Entity entity, String name) {
+ super(
+ "entity.duplicateWithType",
+ entity.getElementName().getLocalPart(), name);
+ }
+
+ public String getResourceBundleName() {
+ return "org.jboss.com.sun.tools.ws.resources.wsdl";
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/DuplicateEntityException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/Elemental.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/Elemental.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/Elemental.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,34 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.framework;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Interface implemented by classes that are mappable to XML elements.
+ *
+ * @author WS Development Team
+ */
+public interface Elemental {
+ public QName getElementName();
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/Elemental.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/Entity.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/Entity.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/Entity.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,87 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.framework;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * An entity, typically corresponding to an XML element.
+ *
+ * @author WS Development Team
+ */
+public abstract class Entity implements Elemental {
+
+ public Entity() {
+ }
+
+ public Object getProperty(String key) {
+ if (_properties == null)
+ return null;
+ return _properties.get(key);
+ }
+
+ public void setProperty(String key, Object value) {
+ if (value == null) {
+ removeProperty(key);
+ return;
+ }
+
+ if (_properties == null) {
+ _properties = new HashMap();
+ }
+ _properties.put(key, value);
+ }
+
+ public void removeProperty(String key) {
+ if (_properties != null) {
+ _properties.remove(key);
+ }
+ }
+
+ public void withAllSubEntitiesDo(EntityAction action) {
+ // no-op by default
+ }
+
+ public void withAllQNamesDo(QNameAction action) {
+ action.perform(getElementName());
+ }
+
+ public void withAllEntityReferencesDo(EntityReferenceAction action) {
+ // no-op by default
+ }
+
+ public abstract void validateThis();
+
+ protected void failValidation(String key) {
+ throw new ValidationException(key, getElementName().getLocalPart());
+ }
+
+ protected void failValidation(String key, String arg) {
+ throw new ValidationException(
+ key,
+ new Object[] { arg, getElementName().getLocalPart()});
+ }
+
+ private Map _properties;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/Entity.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/EntityAction.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/EntityAction.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/EntityAction.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,32 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.framework;
+
+/**
+ * An action operating on an entity.
+ *
+ * @author WS Development Team
+ */
+public interface EntityAction {
+ public void perform(Entity entity);
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/EntityAction.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/EntityReferenceAction.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/EntityReferenceAction.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/EntityReferenceAction.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,34 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.framework;
+
+import javax.xml.namespace.QName;
+
+/**
+ * An action operating on an entity reference composed of a kind and a QName.
+ *
+ * @author WS Development Team
+ */
+public interface EntityReferenceAction {
+ public void perform(Kind kind, QName name);
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/EntityReferenceAction.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/EntityReferenceValidator.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/EntityReferenceValidator.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/EntityReferenceValidator.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,35 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.framework;
+
+import javax.xml.namespace.QName;
+
+/**
+ * An interface implemented by a class that is capable of validating
+ * a QName/Kind pair referring to an external entity.
+ *
+ * @author WS Development Team
+ */
+public interface EntityReferenceValidator {
+ public boolean isValid(Kind kind, QName name);
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/EntityReferenceValidator.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/ExtensibilityHelper.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/ExtensibilityHelper.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/ExtensibilityHelper.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,84 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.framework;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.NoSuchElementException;
+
+/**
+ * A helper class for extensible entities.
+ *
+ * @author WS Development Team
+ */
+public class ExtensibilityHelper {
+
+ public ExtensibilityHelper() {
+ }
+
+ public void addExtension(Extension e) {
+ if (_extensions == null) {
+ _extensions = new ArrayList();
+ }
+ _extensions.add(e);
+ }
+
+ public Iterator extensions() {
+ if (_extensions == null) {
+ return new Iterator() {
+ public boolean hasNext() {
+ return false;
+ }
+
+ public Object next() {
+ throw new NoSuchElementException();
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+ };
+ } else {
+ return _extensions.iterator();
+ }
+ }
+
+ public void withAllSubEntitiesDo(EntityAction action) {
+ if (_extensions != null) {
+ for (Iterator iter = _extensions.iterator(); iter.hasNext();) {
+ action.perform((Entity) iter.next());
+ }
+ }
+ }
+
+ public void accept(ExtensionVisitor visitor) throws Exception {
+ if (_extensions != null) {
+ for (Iterator iter = _extensions.iterator(); iter.hasNext();) {
+ ((Extension) iter.next()).accept(visitor);
+ }
+ }
+ }
+
+ private List _extensions;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/ExtensibilityHelper.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/Extensible.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/Extensible.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/Extensible.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,35 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.framework;
+
+import java.util.Iterator;
+
+/**
+ * An entity that can be extended.
+ *
+ * @author WS Development Team
+ */
+public interface Extensible extends Elemental {
+ public void addExtension(Extension e);
+ public Iterator extensions();
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/Extensible.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/Extension.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/Extension.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/Extension.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,49 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.framework;
+
+/**
+ * An entity extending another entity.
+ *
+ * @author WS Development Team
+ */
+public abstract class Extension extends Entity {
+
+ public Extension() {
+ }
+
+ public Extensible getParent() {
+ return _parent;
+ }
+
+ public void setParent(Extensible parent) {
+ _parent = parent;
+ }
+
+ public void accept(ExtensionVisitor visitor) throws Exception {
+ visitor.preVisit(this);
+ visitor.postVisit(this);
+ }
+
+ private Extensible _parent;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/Extension.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/ExtensionVisitor.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/ExtensionVisitor.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/ExtensionVisitor.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,33 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.framework;
+
+/**
+ * A visitor working on extension entities.
+ *
+ * @author WS Development Team
+ */
+public interface ExtensionVisitor {
+ public void preVisit(Extension extension) throws Exception;
+ public void postVisit(Extension extension) throws Exception;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/ExtensionVisitor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/ExtensionVisitorBase.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/ExtensionVisitorBase.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/ExtensionVisitorBase.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,38 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.framework;
+
+/**
+ * A base class for extension visitors.
+ *
+ * @author WS Development Team
+ */
+public class ExtensionVisitorBase implements ExtensionVisitor {
+ public ExtensionVisitorBase() {
+ }
+
+ public void preVisit(Extension extension) throws Exception {
+ }
+ public void postVisit(Extension extension) throws Exception {
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/ExtensionVisitorBase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/ExternalEntityReference.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/ExternalEntityReference.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/ExternalEntityReference.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,62 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.framework;
+
+import javax.xml.namespace.QName;
+
+/**
+ * A reference to a globally known entity in a document.
+ *
+ * @author WS Development Team
+ */
+public class ExternalEntityReference {
+
+ public ExternalEntityReference(
+ AbstractDocument document,
+ Kind kind,
+ QName name) {
+ _document = document;
+ _kind = kind;
+ _name = name;
+ }
+
+ public AbstractDocument getDocument() {
+ return _document;
+ }
+
+ public Kind getKind() {
+ return _kind;
+ }
+
+ public QName getName() {
+ return _name;
+ }
+
+ public GloballyKnown resolve() {
+ return _document.find(_kind, _name);
+ }
+
+ private AbstractDocument _document;
+ private Kind _kind;
+ private QName _name;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/ExternalEntityReference.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/GlobalEntity.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/GlobalEntity.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/GlobalEntity.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,52 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.framework;
+
+/**
+ * An entity that can be defined in a target namespace.
+ *
+ * @author WS Development Team
+ */
+public abstract class GlobalEntity extends Entity implements GloballyKnown {
+
+ public GlobalEntity(Defining defining) {
+ _defining = defining;
+ }
+
+ public String getName() {
+ return _name;
+ }
+
+ public void setName(String name) {
+ _name = name;
+ }
+
+ public abstract Kind getKind();
+
+ public Defining getDefining() {
+ return _defining;
+ }
+
+ private Defining _defining;
+ private String _name;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/GlobalEntity.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/GloballyKnown.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/GloballyKnown.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/GloballyKnown.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,34 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.framework;
+
+/**
+ * An interface implemented by entities which can be defined in a target namespace.
+ *
+ * @author WS Development Team
+ */
+public interface GloballyKnown extends Elemental {
+ public String getName();
+ public Kind getKind();
+ public Defining getDefining();
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/GloballyKnown.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/Identifiable.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/Identifiable.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/Identifiable.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,32 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.framework;
+
+/**
+ * An interface implemented by entities which have an ID.
+ *
+ * @author WS Development Team
+ */
+public interface Identifiable extends Elemental {
+ public String getID();
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/Identifiable.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/Kind.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/Kind.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/Kind.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,41 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.framework;
+
+/**
+ * A kind of entity.
+ *
+ * @author WS Development Team
+ */
+public final class Kind {
+
+ public Kind(String s) {
+ _name = s;
+ }
+
+ public String getName() {
+ return _name;
+ }
+
+ private String _name;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/Kind.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/NoSuchEntityException.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/NoSuchEntityException.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/NoSuchEntityException.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,47 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.framework;
+
+import javax.xml.namespace.QName;
+
+/**
+ * An exception signalling that an entity with the given name/id does not exist.
+ *
+ * @author WS Development Team
+ */
+public class NoSuchEntityException extends ValidationException {
+
+ public NoSuchEntityException(QName name) {
+ super(
+ "entity.notFoundByQName",
+ name.getLocalPart(), name.getNamespaceURI());
+ }
+
+ public NoSuchEntityException(String id) {
+ super("entity.notFoundByID", id);
+ }
+
+ public String getResourceBundleName() {
+ return "org.jboss.com.sun.tools.ws.resources.wsdl";
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/NoSuchEntityException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/ParseException.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/ParseException.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/ParseException.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,46 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.framework;
+
+import org.jboss.com.sun.xml.ws.util.exception.JAXWSExceptionBase;
+import org.jboss.com.sun.xml.ws.util.localization.Localizable;
+
+/**
+ * An exception signalling a parsing error.
+ *
+ * @author WS Development Team
+ */
+public class ParseException extends JAXWSExceptionBase {
+
+ public ParseException(String key, Object... args) {
+ super(key, args);
+ }
+
+ public ParseException(Throwable throwable) {
+ super(throwable);
+ }
+
+ public String getResourceBundleName() {
+ return "org.jboss.com.sun.tools.ws.resources.wsdl";
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/ParseException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/ParserContext.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/ParserContext.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/ParserContext.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,182 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.framework;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.xml.ws.util.NamespaceSupport;
+import org.jboss.com.sun.xml.ws.util.xml.XmlUtil;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+
+
+/**
+ * The context used by parser classes.
+ *
+ * @author WS Development Team
+ */
+public class ParserContext {
+
+ private final static String PREFIX_XMLNS = "xmlns";
+
+ public ParserContext(AbstractDocument doc, ArrayList listeners) {
+ _document = doc;
+ _listeners = listeners;
+ _nsSupport = new NamespaceSupport();
+ _wsdlLocation = new WSDLLocation();
+ }
+
+ public AbstractDocument getDocument() {
+ return _document;
+ }
+
+ public boolean getFollowImports() {
+ return _followImports;
+ }
+
+ public void setFollowImports(boolean b) {
+ _followImports = b;
+ }
+
+ public void push() {
+ _nsSupport.pushContext();
+ }
+
+ public void pop() {
+ _nsSupport.popContext();
+ }
+
+ public String getNamespaceURI(String prefix) {
+ return _nsSupport.getURI(prefix);
+ }
+
+ public Iterator getPrefixes() {
+ return _nsSupport.getPrefixes();
+ }
+
+ public String getDefaultNamespaceURI() {
+ return getNamespaceURI("");
+ }
+
+ public void registerNamespaces(Element e) {
+ for (Iterator iter = XmlUtil.getAllAttributes(e); iter.hasNext();) {
+ Attr a = (Attr) iter.next();
+ if (a.getName().equals(PREFIX_XMLNS)) {
+ // default namespace declaration
+ _nsSupport.declarePrefix("", a.getValue());
+ } else {
+ String prefix = XmlUtil.getPrefix(a.getName());
+ if (prefix != null && prefix.equals(PREFIX_XMLNS)) {
+ String nsPrefix = XmlUtil.getLocalPart(a.getName());
+ String uri = a.getValue();
+ _nsSupport.declarePrefix(nsPrefix, uri);
+ }
+ }
+ }
+ }
+
+ public QName translateQualifiedName(String s) {
+ if (s == null)
+ return null;
+
+ String prefix = XmlUtil.getPrefix(s);
+ String uri = null;
+
+ if (prefix == null) {
+ uri = getDefaultNamespaceURI();
+ } else {
+ uri = getNamespaceURI(prefix);
+ if (uri == null) {
+ throw new ParseException(
+ "parsing.unknownNamespacePrefix",
+ prefix);
+ }
+ }
+
+ return new QName(uri, XmlUtil.getLocalPart(s));
+ }
+
+ public void fireIgnoringExtension(QName name, QName parent) {
+ List _targets = null;
+
+ synchronized (this) {
+ if (_listeners != null) {
+ _targets = (List) _listeners.clone();
+ }
+ }
+
+ if (_targets != null) {
+ for (Iterator iter = _targets.iterator(); iter.hasNext();) {
+ ParserListener l = (ParserListener) iter.next();
+ l.ignoringExtension(name, parent);
+ }
+ }
+ }
+
+ public void fireDoneParsingEntity(QName element, Entity entity) {
+ List _targets = null;
+
+ synchronized (this) {
+ if (_listeners != null) {
+ _targets = (List) _listeners.clone();
+ }
+ }
+
+ if (_targets != null) {
+ for (Iterator iter = _targets.iterator(); iter.hasNext();) {
+ ParserListener l = (ParserListener) iter.next();
+ l.doneParsingEntity(element, entity);
+ }
+ }
+ }
+
+ //bug fix: 4856674, WSDLLocation context maintainence
+ //and utility funcitons
+ public void pushWSDLLocation() {
+ _wsdlLocation.push();
+ }
+
+ public void popWSDLLocation() {
+ _wsdlLocation.pop();
+ }
+
+ public void setWSDLLocation(String loc) {
+ _wsdlLocation.setLocation(loc);
+ }
+
+ public String getWSDLLocation() {
+ return _wsdlLocation.getLocation();
+ }
+
+ private boolean _followImports;
+ private AbstractDocument _document;
+ private NamespaceSupport _nsSupport;
+ private ArrayList _listeners;
+ //bug fix:4856674
+ private WSDLLocation _wsdlLocation;
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/ParserContext.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/ParserListener.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/ParserListener.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/ParserListener.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,35 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.framework;
+
+import javax.xml.namespace.QName;
+
+/**
+ * A listener for parsing-related events.
+ *
+ * @author WS Development Team
+ */
+public interface ParserListener {
+ public void ignoringExtension(QName name, QName parent);
+ public void doneParsingEntity(QName element, Entity entity);
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/ParserListener.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/QNameAction.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/QNameAction.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/QNameAction.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,34 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.framework;
+
+import javax.xml.namespace.QName;
+
+/**
+ * An action operating on a QName.
+ *
+ * @author WS Development Team
+ */
+public interface QNameAction {
+ public void perform(QName name);
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/QNameAction.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/ValidationException.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/ValidationException.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/ValidationException.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,46 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.framework;
+
+import org.jboss.com.sun.xml.ws.util.exception.JAXWSExceptionBase;
+import org.jboss.com.sun.xml.ws.util.localization.Localizable;
+
+/**
+ * An exception signalling that validation of an entity failed.
+ *
+ * @author WS Development Team
+ */
+public class ValidationException extends JAXWSExceptionBase {
+
+ public ValidationException(String key, Object... args) {
+ super(key, args);
+ }
+
+ public ValidationException(Throwable throwable) {
+ super(throwable);
+ }
+
+ public String getResourceBundleName() {
+ return "org.jboss.com.sun.tools.ws.resources.wsdl";
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/ValidationException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/WSDLLocation.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/WSDLLocation.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/WSDLLocation.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,98 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.wsdl.framework;
+
+/**
+ *
+ * Maintains wsdl:location context. This is used with
+ * ParserContext, where one each WSDL being imported its location is pushed, this will be
used
+ * latter to resolve relative imports of schema in SchemaParser.
+ *
+ * @author WS Development Team
+ */
+public class WSDLLocation {
+ WSDLLocation() {
+ reset();
+ }
+
+ public void push() {
+ int max = contexts.length;
+ idPos++;
+ if (idPos >= max) {
+ LocationContext newContexts[] = new LocationContext[max * 2];
+ System.arraycopy(contexts, 0, newContexts, 0, max);
+ max *= 2;
+ contexts = newContexts;
+ }
+ currentContext = contexts[idPos];
+ if (currentContext == null) {
+ contexts[idPos] = currentContext = new LocationContext();
+ }
+ if (idPos > 0) {
+ currentContext.setParent(contexts[idPos - 1]);
+ }
+
+ }
+
+ public void pop() {
+ idPos--;
+ if (idPos >= 0) {
+ currentContext = contexts[idPos];
+ }
+ }
+
+ public void reset() {
+ contexts = new LocationContext[32];
+ idPos = 0;
+ contexts[idPos] = currentContext = new LocationContext();
+ }
+
+ public String getLocation() {
+ return currentContext.getLocation();
+ }
+
+ public void setLocation(String loc) {
+ currentContext.setLocation(loc);
+ }
+
+ private LocationContext[] contexts;
+ private int idPos;
+ private LocationContext currentContext;
+
+ // LocationContext - inner class
+ private static class LocationContext {
+ void setLocation(String loc) {
+ location = loc;
+ }
+
+ String getLocation() {
+ return location;
+ }
+
+ void setParent(LocationContext parent) {
+ parentLocation = parent;
+ }
+
+ private String location;
+ private LocationContext parentLocation;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/WSDLLocation.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/WriterContext.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/WriterContext.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/WriterContext.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,210 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.framework;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.util.xml.PrettyPrintingXmlWriter;
+import org.jboss.com.sun.xml.ws.util.NamespaceSupport;
+
+
+/**
+ * The context used by writer classes.
+ *
+ * @author WS Development Team
+ */
+public class WriterContext {
+
+ public WriterContext(OutputStream os) throws IOException {
+ _writer = new PrettyPrintingXmlWriter(os);
+ _nsSupport = new NamespaceSupport();
+ _newPrefixCount = 2;
+ }
+
+ public void flush() throws IOException {
+ _writer.flush();
+ }
+
+ public void close() throws IOException {
+ _writer.close();
+ }
+
+ public void push() {
+ if (_pendingNamespaceDeclarations != null) {
+ throw new IllegalStateException("prefix declarations are
pending");
+ }
+ _nsSupport.pushContext();
+ }
+
+ public void pop() {
+ _nsSupport.popContext();
+ _pendingNamespaceDeclarations = null;
+ }
+
+ public String getNamespaceURI(String prefix) {
+ return _nsSupport.getURI(prefix);
+ }
+
+ public Iterator getPrefixes() {
+ return _nsSupport.getPrefixes();
+ }
+
+ public String getDefaultNamespaceURI() {
+ return getNamespaceURI("");
+ }
+
+ public void declarePrefix(String prefix, String uri) {
+ _nsSupport.declarePrefix(prefix, uri);
+ if (_pendingNamespaceDeclarations == null) {
+ _pendingNamespaceDeclarations = new ArrayList();
+ }
+ _pendingNamespaceDeclarations.add(new String[] { prefix, uri });
+ }
+
+ public String getPrefixFor(String uri) {
+ if ((getDefaultNamespaceURI() != null &&
getDefaultNamespaceURI().equals(uri))
+ || uri.equals("")) {
+ return "";
+ } else {
+ return _nsSupport.getPrefix(uri);
+ }
+ }
+
+ public String findNewPrefix(String base) {
+ return base + Integer.toString(_newPrefixCount++);
+ }
+
+ public String getTargetNamespaceURI() {
+ return _targetNamespaceURI;
+ }
+
+ public void setTargetNamespaceURI(String uri) {
+ _targetNamespaceURI = uri;
+ }
+
+ public void writeStartTag(QName name) throws IOException {
+ _writer.start(getQNameString(name));
+ }
+
+ public void writeEndTag(QName name) throws IOException {
+ _writer.end(getQNameString(name));
+ }
+
+ public void writeAttribute(String name, String value) throws IOException {
+ if (value != null) {
+ _writer.attribute(name, value);
+ }
+ }
+
+ public void writeAttribute(String name, QName value) throws IOException {
+ if (value != null) {
+ _writer.attribute(name, getQNameString(value));
+ }
+ }
+
+ public void writeAttribute(String name, boolean value) throws IOException {
+ writeAttribute(name, value ? "true" : "false");
+ }
+
+ public void writeAttribute(String name, Boolean value) throws IOException {
+ if (value != null) {
+ writeAttribute(name, value.booleanValue());
+ }
+ }
+
+ public void writeAttribute(String name, int value) throws IOException {
+ writeAttribute(name, Integer.toString(value));
+ }
+
+ public void writeAttribute(String name, Object value, Map valueToXmlMap)
+ throws IOException {
+ String actualValue = (String) valueToXmlMap.get(value);
+ writeAttribute(name, actualValue);
+ }
+
+ public void writeNamespaceDeclaration(String prefix, String uri)
+ throws IOException {
+ _writer.attribute(getNamespaceDeclarationAttributeName(prefix), uri);
+ }
+
+ public void writeAllPendingNamespaceDeclarations() throws IOException {
+ if (_pendingNamespaceDeclarations != null) {
+ for (Iterator iter = _pendingNamespaceDeclarations.iterator();
+ iter.hasNext();
+ ) {
+ String[] pair = (String[]) iter.next();
+ writeNamespaceDeclaration(pair[0], pair[1]);
+ }
+ }
+ _pendingNamespaceDeclarations = null;
+ }
+
+ private String getNamespaceDeclarationAttributeName(String prefix) {
+ if (prefix.equals("")) {
+ return "xmlns";
+ } else {
+ return "xmlns:" + prefix;
+ }
+ }
+
+ public void writeTag(QName name, String value) throws IOException {
+ _writer.leaf(getQNameString(name), value);
+ }
+
+ public String getQNameString(QName name) {
+ String nsURI = name.getNamespaceURI();
+ String prefix = getPrefixFor(nsURI);
+ if (prefix == null) {
+ throw new IllegalArgumentException();
+ } else if (prefix.equals("")) {
+ return name.getLocalPart();
+ } else {
+ return prefix + ":" + name.getLocalPart();
+ }
+ }
+
+ public String getQNameStringWithTargetNamespaceCheck(QName name) {
+ if (name.getNamespaceURI().equals(_targetNamespaceURI)) {
+ return name.getLocalPart();
+ } else {
+ return getQNameString(name);
+ }
+ }
+
+ public void writeChars(String chars) throws IOException {
+ _writer.chars(chars);
+ }
+
+ private PrettyPrintingXmlWriter _writer;
+ private NamespaceSupport _nsSupport;
+ private String _targetNamespaceURI;
+ private int _newPrefixCount;
+ private List _pendingNamespaceDeclarations;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/framework/WriterContext.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/Constants.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/Constants.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/Constants.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,142 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.parser;
+
+/**
+ * An interface defining constants needed to read and write WSDL documents.
+ *
+ * @author WS Development Team
+ */
+public interface Constants {
+ // WSDL element tags
+ public static String TAG_BINDING = "binding";
+ public static String TAG_DEFINITIONS = "definitions";
+ public static String TAG_DOCUMENTATION = "documentation";
+ public static String TAG_MESSAGE = "message";
+ public static String TAG_PART = "part";
+ public static String TAG_PORT_TYPE = "portType";
+ public static String TAG_TYPES = "types";
+ public static String TAG_OPERATION = "operation";
+ public static String TAG_INPUT = "input";
+ public static String TAG_OUTPUT = "output";
+ public static String TAG_FAULT = "fault";
+ public static String TAG_SERVICE = "service";
+ public static String TAG_PORT = "port";
+ public static String TAG_ = "";
+
+ // WSDL attribute names
+ public static String ATTR_ELEMENT = "element";
+ public static String ATTR_NAME = "name";
+ public static String ATTR_REQUIRED = "required";
+ public static String ATTR_TARGET_NAMESPACE = "targetNamespace";
+ public static String ATTR_TYPE = "type";
+ public static String ATTR_MESSAGE = "message";
+ public static String ATTR_BINDING = "binding";
+ public static String ATTR_LOCATION = "location";
+ public static String ATTR_TRANSPORT = "transport";
+ public static String ATTR_STYLE = "style";
+ public static String ATTR_USE = "use";
+ public static String ATTR_NAMESPACE = "namespace";
+ public static String ATTR_ENCODING_STYLE = "encodingStyle";
+ public static String ATTR_PART = "part";
+ public static String ATTR_PARTS = "parts";
+ public static String ATTR_SOAP_ACTION = "soapAction";
+ public static String ATTR_PARAMETER_ORDER = "parameterOrder";
+ public static String ATTR_VERB = "verb";
+
+ // schema attribute names
+ public static String ATTR_ID = "id";
+ public static String ATTR_VERSION = "version";
+ public static String ATTR_ATTRIBUTE_FORM_DEFAULT = "attributeFormDefault";
+ public static String ATTR_BLOCK_DEFAULT = "blockDefault";
+ public static String ATTR_ELEMENT_FORM_DEFAULT = "elementFormDefault";
+ public static String ATTR_FINAL_DEFAULT = "finalDefault";
+ public static String ATTR_ABSTRACT = "abstract";
+ public static String ATTR_NILLABLE = "nillable";
+ public static String ATTR_DEFAULT = "default";
+ public static String ATTR_FIXED = "fixed";
+ public static String ATTR_FORM = "form";
+ public static String ATTR_BLOCK = "block";
+ public static String ATTR_FINAL = "final";
+ public static String ATTR_REF = "ref";
+ public static String ATTR_SUBSTITUTION_GROUP = "substitutionGroup";
+ public static String ATTR_MIN_OCCURS = "minOccurs";
+ public static String ATTR_MAX_OCCURS = "maxOccurs";
+ public static String ATTR_PROCESS_CONTENTS = "processContents";
+ public static String ATTR_MIXED = "mixed";
+ public static String ATTR_BASE = "base";
+ public static String ATTR_VALUE = "value";
+ public static String ATTR_XPATH = "xpath";
+ public static String ATTR_SCHEMA_LOCATION = "schemaLocation";
+ public static String ATTR_REFER = "refer";
+ public static String ATTR_ITEM_TYPE = "itemType";
+ public static String ATTR_PUBLIC = "public";
+ public static String ATTR_SYSTEM = "system";
+ public static String ATTR_MEMBER_TYPES = "memberTypes";
+ public static String ATTR_ = "";
+
+ // WSDL attribute values
+ public static String ATTRVALUE_RPC = "rpc";
+ public static String ATTRVALUE_DOCUMENT = "document";
+ public static String ATTRVALUE_LITERAL = "literal";
+ public static String ATTRVALUE_ENCODED = "encoded";
+
+ // schema attribute values
+ public static String ATTRVALUE_QUALIFIED = "qualified";
+ public static String ATTRVALUE_UNQUALIFIED = "unqualified";
+ public static String ATTRVALUE_ALL = "#all";
+ public static String ATTRVALUE_SUBSTITUTION = "substitution";
+ public static String ATTRVALUE_EXTENSION = "extension";
+ public static String ATTRVALUE_RESTRICTION = "restriction";
+ public static String ATTRVALUE_LIST = "list";
+ public static String ATTRVALUE_UNION = "union";
+ public static String ATTRVALUE_UNBOUNDED = "unbounded";
+ public static String ATTRVALUE_PROHIBITED = "prohibited";
+ public static String ATTRVALUE_OPTIONAL = "optional";
+ public static String ATTRVALUE_REQUIRED = "required";
+ public static String ATTRVALUE_LAX = "lax";
+ public static String ATTRVALUE_SKIP = "skip";
+ public static String ATTRVALUE_STRICT = "strict";
+ public static String ATTRVALUE_ANY = "##any";
+ public static String ATTRVALUE_LOCAL = "##local";
+ public static String ATTRVALUE_OTHER = "##other";
+ public static String ATTRVALUE_TARGET_NAMESPACE = "##targetNamespace";
+ public static String ATTRVALUE_ = "";
+
+ // namespace URIs
+ public static String NS_XML = "http://www.w3.org/XML/1998/namespace";
+ public static String NS_XMLNS = "http://www.w3.org/2000/xmlns/";
+ public static String NS_WSDL = "http://schemas.xmlsoap.org/wsdl/";
+ public static String NS_WSDL_SOAP =
"http://schemas.xmlsoap.org/wsdl/soap/";
+ public static String NS_WSDL_SOAP12 =
"http://schemas.xmlsoap.org/wsdl/soap12/";
+ public static String NS_WSDL_HTTP =
"http://schemas.xmlsoap.org/wsdl/http/";
+ public static String NS_WSDL_MIME =
"http://schemas.xmlsoap.org/wsdl/mime/";
+ public static String NS_XSD = "http://www.w3.org/2001/XMLSchema";
+ public static String NS_XSI = "http://www.w3.org/2001/XMLSchema-instance";
+ public static String NS_ = "";
+
+ // other constants
+ public static String XMLNS = "xmlns";
+ public static String TRUE = "true";
+ public static String FALSE = "false";
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/Constants.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/ExtensionHandler.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/ExtensionHandler.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/ExtensionHandler.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,63 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.parser;
+
+import java.io.IOException;
+import java.util.Map;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extensible;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extension;
+import org.jboss.com.sun.tools.ws.wsdl.framework.ParserContext;
+import org.jboss.com.sun.tools.ws.wsdl.framework.WriterContext;
+import org.w3c.dom.Element;
+
+
+/**
+ * A handler for extensions elements definined in one namespace.
+ *
+ * @author WS Development Team
+ */
+public abstract class ExtensionHandler {
+
+ protected ExtensionHandler() {
+ }
+
+ public abstract String getNamespaceURI();
+
+ public void setExtensionHandlers(Map m) {
+ _extensionHandlers = m;
+ }
+
+ public boolean doHandleExtension(
+ ParserContext context,
+ Extensible parent,
+ Element e) {
+ return false;
+ }
+
+ public void doHandleExtension(WriterContext context, Extension extension)
+ throws IOException {
+ }
+
+ protected Map _extensionHandlers;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/ExtensionHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/ExtensionHandlerBase.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/ExtensionHandlerBase.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/ExtensionHandlerBase.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,127 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.parser;
+
+import org.jboss.com.sun.tools.ws.wsdl.document.WSDLConstants;
+import org.jboss.com.sun.tools.ws.wsdl.document.mime.MIMEConstants;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extensible;
+import org.jboss.com.sun.tools.ws.wsdl.framework.ParserContext;
+import org.w3c.dom.Element;
+
+/**
+ * A base class for WSDL extension handlers.
+ *
+ * @author WS Development Team
+ */
+public abstract class ExtensionHandlerBase extends ExtensionHandler {
+
+ protected ExtensionHandlerBase() {
+ }
+
+ public boolean doHandleExtension(
+ ParserContext context,
+ Extensible parent,
+ Element e) {
+ if (parent.getElementName().equals(WSDLConstants.QNAME_DEFINITIONS)) {
+ return handleDefinitionsExtension(context, parent, e);
+ } else if (parent.getElementName().equals(WSDLConstants.QNAME_TYPES)) {
+ return handleTypesExtension(context, parent, e);
+ } else if (parent.getElementName().equals(WSDLConstants.QNAME_PORT_TYPE)) {
+ return handlePortTypeExtension(context, parent, e);
+ } else if (
+ parent.getElementName().equals(WSDLConstants.QNAME_BINDING)) {
+ return handleBindingExtension(context, parent, e);
+ } else if (
+ parent.getElementName().equals(WSDLConstants.QNAME_OPERATION)) {
+ return handleOperationExtension(context, parent, e);
+ } else if (parent.getElementName().equals(WSDLConstants.QNAME_INPUT)) {
+ return handleInputExtension(context, parent, e);
+ } else if (
+ parent.getElementName().equals(WSDLConstants.QNAME_OUTPUT)) {
+ return handleOutputExtension(context, parent, e);
+ } else if (parent.getElementName().equals(WSDLConstants.QNAME_FAULT)) {
+ return handleFaultExtension(context, parent, e);
+ } else if (
+ parent.getElementName().equals(WSDLConstants.QNAME_SERVICE)) {
+ return handleServiceExtension(context, parent, e);
+ } else if (parent.getElementName().equals(WSDLConstants.QNAME_PORT)) {
+ return handlePortExtension(context, parent, e);
+ } else if (parent.getElementName().equals(MIMEConstants.QNAME_PART)) {
+ return handleMIMEPartExtension(context, parent, e);
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * @param context
+ * @param parent
+ * @param e
+ * @return true if the PortTypeExtension should be handled
+ */
+ protected abstract boolean handlePortTypeExtension(
+ ParserContext context,
+ Extensible parent,
+ Element e);
+
+ protected abstract boolean handleDefinitionsExtension(
+ ParserContext context,
+ Extensible parent,
+ Element e);
+ protected abstract boolean handleTypesExtension(
+ ParserContext context,
+ Extensible parent,
+ Element e);
+ protected abstract boolean handleBindingExtension(
+ ParserContext context,
+ Extensible parent,
+ Element e);
+ protected abstract boolean handleOperationExtension(
+ ParserContext context,
+ Extensible parent,
+ Element e);
+ protected abstract boolean handleInputExtension(
+ ParserContext context,
+ Extensible parent,
+ Element e);
+ protected abstract boolean handleOutputExtension(
+ ParserContext context,
+ Extensible parent,
+ Element e);
+ protected abstract boolean handleFaultExtension(
+ ParserContext context,
+ Extensible parent,
+ Element e);
+ protected abstract boolean handleServiceExtension(
+ ParserContext context,
+ Extensible parent,
+ Element e);
+ protected abstract boolean handlePortExtension(
+ ParserContext context,
+ Extensible parent,
+ Element e);
+ protected abstract boolean handleMIMEPartExtension(
+ ParserContext context,
+ Extensible parent,
+ Element e);
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/ExtensionHandlerBase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/HTTPExtensionHandler.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/HTTPExtensionHandler.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/HTTPExtensionHandler.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,265 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.parser;
+
+import java.io.IOException;
+
+import org.jboss.com.sun.tools.ws.util.xml.XmlUtil;
+import org.jboss.com.sun.tools.ws.wsdl.document.http.HTTPAddress;
+import org.jboss.com.sun.tools.ws.wsdl.document.http.HTTPBinding;
+import org.jboss.com.sun.tools.ws.wsdl.document.http.HTTPConstants;
+import org.jboss.com.sun.tools.ws.wsdl.document.http.HTTPOperation;
+import org.jboss.com.sun.tools.ws.wsdl.document.http.HTTPUrlEncoded;
+import org.jboss.com.sun.tools.ws.wsdl.document.http.HTTPUrlReplacement;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extensible;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extension;
+import org.jboss.com.sun.tools.ws.wsdl.framework.ParserContext;
+import org.jboss.com.sun.tools.ws.wsdl.framework.WriterContext;
+import org.w3c.dom.Element;
+
+
+/**
+ * The HTTP extension handler for WSDL.
+ *
+ * @author WS Development Team
+ */
+public class HTTPExtensionHandler extends ExtensionHandlerBase {
+
+ public HTTPExtensionHandler() {
+ }
+
+ public String getNamespaceURI() {
+ return Constants.NS_WSDL_HTTP;
+ }
+
+ protected boolean handleDefinitionsExtension(
+ ParserContext context,
+ Extensible parent,
+ Element e) {
+ Util.fail(
+ "parsing.invalidExtensionElement",
+ e.getTagName(),
+ e.getNamespaceURI());
+ return false; // keep compiler happy
+ }
+
+ protected boolean handleTypesExtension(
+ ParserContext context,
+ Extensible parent,
+ Element e) {
+ Util.fail(
+ "parsing.invalidExtensionElement",
+ e.getTagName(),
+ e.getNamespaceURI());
+ return false; // keep compiler happy
+ }
+
+ protected boolean handleBindingExtension(
+ ParserContext context,
+ Extensible parent,
+ Element e) {
+ if (XmlUtil.matchesTagNS(e, HTTPConstants.QNAME_BINDING)) {
+ context.push();
+ context.registerNamespaces(e);
+
+ HTTPBinding binding = new HTTPBinding();
+
+ String verb = Util.getRequiredAttribute(e, Constants.ATTR_VERB);
+ binding.setVerb(verb);
+
+ parent.addExtension(binding);
+ context.pop();
+ context.fireDoneParsingEntity(HTTPConstants.QNAME_BINDING, binding);
+ return true;
+ } else {
+ Util.fail(
+ "parsing.invalidExtensionElement",
+ e.getTagName(),
+ e.getNamespaceURI());
+ return false; // keep compiler happy
+ }
+ }
+
+ protected boolean handleOperationExtension(
+ ParserContext context,
+ Extensible parent,
+ Element e) {
+ if (XmlUtil.matchesTagNS(e, HTTPConstants.QNAME_OPERATION)) {
+ context.push();
+ context.registerNamespaces(e);
+
+ HTTPOperation operation = new HTTPOperation();
+
+ String location =
+ Util.getRequiredAttribute(e, Constants.ATTR_LOCATION);
+ operation.setLocation(location);
+
+ parent.addExtension(operation);
+ context.pop();
+ context.fireDoneParsingEntity(
+ HTTPConstants.QNAME_OPERATION,
+ operation);
+ return true;
+ } else {
+ Util.fail(
+ "parsing.invalidExtensionElement",
+ e.getTagName(),
+ e.getNamespaceURI());
+ return false; // keep compiler happy
+ }
+ }
+
+ protected boolean handleInputExtension(
+ ParserContext context,
+ Extensible parent,
+ Element e) {
+ if (XmlUtil.matchesTagNS(e, HTTPConstants.QNAME_URL_ENCODED)) {
+ parent.addExtension(new HTTPUrlEncoded());
+ return true;
+ } else if (
+ XmlUtil.matchesTagNS(e, HTTPConstants.QNAME_URL_REPLACEMENT)) {
+ parent.addExtension(new HTTPUrlReplacement());
+ return true;
+ } else {
+ Util.fail(
+ "parsing.invalidExtensionElement",
+ e.getTagName(),
+ e.getNamespaceURI());
+ return false; // keep compiler happy
+ }
+ }
+
+ protected boolean handleOutputExtension(
+ ParserContext context,
+ Extensible parent,
+ Element e) {
+ Util.fail(
+ "parsing.invalidExtensionElement",
+ e.getTagName(),
+ e.getNamespaceURI());
+ return false; // keep compiler happy
+ }
+
+ protected boolean handleFaultExtension(
+ ParserContext context,
+ Extensible parent,
+ Element e) {
+ Util.fail(
+ "parsing.invalidExtensionElement",
+ e.getTagName(),
+ e.getNamespaceURI());
+ return false; // keep compiler happy
+ }
+
+ protected boolean handleServiceExtension(
+ ParserContext context,
+ Extensible parent,
+ Element e) {
+ Util.fail(
+ "parsing.invalidExtensionElement",
+ e.getTagName(),
+ e.getNamespaceURI());
+ return false; // keep compiler happy
+ }
+
+ protected boolean handlePortExtension(
+ ParserContext context,
+ Extensible parent,
+ Element e) {
+ if (XmlUtil.matchesTagNS(e, HTTPConstants.QNAME_ADDRESS)) {
+ context.push();
+ context.registerNamespaces(e);
+
+ HTTPAddress address = new HTTPAddress();
+
+ String location =
+ Util.getRequiredAttribute(e, Constants.ATTR_LOCATION);
+ address.setLocation(location);
+
+ parent.addExtension(address);
+ context.pop();
+ context.fireDoneParsingEntity(HTTPConstants.QNAME_ADDRESS, address);
+ return true;
+ } else {
+ Util.fail(
+ "parsing.invalidExtensionElement",
+ e.getTagName(),
+ e.getNamespaceURI());
+ return false; // keep compiler happy
+ }
+ }
+
+ protected boolean handleMIMEPartExtension(
+ ParserContext context,
+ Extensible parent,
+ Element e) {
+ Util.fail(
+ "parsing.invalidExtensionElement",
+ e.getTagName(),
+ e.getNamespaceURI());
+ return false; // keep compiler happy
+ }
+
+ public void doHandleExtension(WriterContext context, Extension extension)
+ throws IOException {
+ if (extension instanceof HTTPAddress) {
+ HTTPAddress address = (HTTPAddress) extension;
+ context.writeStartTag(address.getElementName());
+ context.writeAttribute(
+ Constants.ATTR_LOCATION,
+ address.getLocation());
+ context.writeEndTag(address.getElementName());
+ } else if (extension instanceof HTTPBinding) {
+ HTTPBinding binding = (HTTPBinding) extension;
+ context.writeStartTag(binding.getElementName());
+ context.writeAttribute(Constants.ATTR_VERB, binding.getVerb());
+ context.writeEndTag(binding.getElementName());
+ } else if (extension instanceof HTTPOperation) {
+ HTTPOperation operation = (HTTPOperation) extension;
+ context.writeStartTag(operation.getElementName());
+ context.writeAttribute(
+ Constants.ATTR_LOCATION,
+ operation.getLocation());
+ context.writeEndTag(operation.getElementName());
+ } else if (extension instanceof HTTPUrlEncoded) {
+ context.writeStartTag(extension.getElementName());
+ context.writeEndTag(extension.getElementName());
+ } else if (extension instanceof HTTPUrlReplacement) {
+ context.writeStartTag(extension.getElementName());
+ context.writeEndTag(extension.getElementName());
+ } else {
+ throw new IllegalArgumentException();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see ExtensionHandlerBase#handlePortTypeExtension(ParserContext, Extensible,
org.w3c.dom.Element)
+ */
+ protected boolean handlePortTypeExtension(ParserContext context, Extensible parent,
Element e) {
+ Util.fail(
+ "parsing.invalidExtensionElement",
+ e.getTagName(),
+ e.getNamespaceURI());
+ return false; // keep compiler happy
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/HTTPExtensionHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/Internalizer.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/Internalizer.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/Internalizer.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,534 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.wsdl.parser;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLDecoder;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.io.UnsupportedEncodingException;
+
+import javax.xml.namespace.QName;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
+import org.jboss.com.sun.tools.ws.processor.util.ProcessorEnvironment;
+import org.jboss.com.sun.tools.ws.util.xml.XmlUtil;
+import org.jboss.com.sun.tools.ws.wsdl.document.jaxws.JAXWSBindingsConstants;
+import org.jboss.com.sun.xml.ws.util.JAXWSUtils;
+import org.jboss.com.sun.xml.ws.util.localization.Localizable;
+import org.jboss.com.sun.xml.ws.util.localization.LocalizableMessageFactory;
+import org.w3c.dom.Attr;
+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 com.sun.tools.xjc.util.DOMUtils;
+
+
+/**
+ * Internalizes external binding declarations.
+ * @author Vivek Pandey
+ */
+public class Internalizer {
+ private Map<String, Document> wsdlDocuments;
+ private Map<String, Document> jaxwsBindings;
+ private static final XPathFactory xpf = XPathFactory.newInstance();
+ private final XPath xpath = xpf.newXPath();
+ private final LocalizableMessageFactory messageFactory = new
LocalizableMessageFactory("org.jboss.com.sun.tools.ws.resources.wsdl");;
+ private ProcessorEnvironment env;
+ public void transform(Map<String, Document> jaxwsBindings, Map<String,
Document> wsdlDocuments, ProcessorEnvironment env) {
+ if(jaxwsBindings == null)
+ return;
+ this.env = env;
+ this.wsdlDocuments = wsdlDocuments;
+ this.jaxwsBindings = jaxwsBindings;
+ Map targetNodes = new HashMap<Element, Node>();
+
+ // identify target nodes for all <JAXWS:bindings>
+ for(Map.Entry<String, Document> jaxwsBinding : jaxwsBindings.entrySet()) {
+ Element e = jaxwsBinding.getValue().getDocumentElement();
+ // initially, the inherited context is itself
+ buildTargetNodeMap( e, e, targetNodes );
+ }
+
+ // then move them to their respective positions.
+ for(Map.Entry<String, Document> jaxwsBinding : jaxwsBindings.entrySet()) {
+ Element e = jaxwsBinding.getValue().getDocumentElement();
+ move( e, targetNodes );
+ }
+
+ }
+
+ /**
+ * Validates attributes of a <JAXWS:bindings> element.
+ */
+ private void validate( Element bindings ) {
+ NamedNodeMap atts = bindings.getAttributes();
+ for( int i=0; i<atts.getLength(); i++ ) {
+ Attr a = (Attr)atts.item(i);
+ if( a.getNamespaceURI()!=null )
+ continue; // all foreign namespace OK.
+ if( a.getLocalName().equals("node") )
+ continue;
+ if( a.getLocalName().equals("wsdlLocation"))
+ continue;
+
+ // TODO: flag error for this undefined attribute
+ }
+ }
+
+ /**
+ * Gets the DOM tree associated with the specified system ID,
+ * or null if none is found.
+ */
+ public Document get( String systemId ) {
+ Document doc = wsdlDocuments.get(systemId);
+
+ if( doc==null && systemId.startsWith("file:/") &&
!systemId.startsWith("file://") ) {
+ // As of JDK1.4, java.net.URL.toExternal method returns URLs like
+ // "file:/abc/def/ghi" which is an incorrect file protocol URL
according to RFC1738.
+ // Some other correctly functioning parts return the correct URLs
("file:///abc/def/ghi"),
+ // and this descripancy breaks DOM look up by system ID.
+
+ // this extra check solves this problem.
+ doc = wsdlDocuments.get( "file://"+systemId.substring(5) );
+ }
+
+ if( doc==null && systemId.startsWith("file:") ) {
+ // on Windows, filenames are case insensitive.
+ // perform case-insensitive search for improved user experience
+ String systemPath = getPath(systemId);
+ for (String key : wsdlDocuments.keySet()) {
+ if(key.startsWith("file:") &&
getPath(key).equalsIgnoreCase(systemPath)) {
+ doc = wsdlDocuments.get(key);
+ break;
+ }
+ }
+ }
+ return doc;
+ }
+
+ /**
+ * Strips off the leading 'file:///' portion from an URL.
+ */
+ private String getPath(String key) {
+ key = key.substring(5); // skip 'file:'
+ while(key.length()>0 && key.charAt(0)=='/')
+ key = key.substring(1);
+ return key;
+ }
+
+ /**
+ * Determines the target node of the "bindings" element
+ * by using the inherited target node, then put
+ * the result into the "result" map.
+ */
+ private void buildTargetNodeMap( Element bindings, Node inheritedTarget,
Map<Element, Node> result ) {
+ // start by the inherited target
+ Node target = inheritedTarget;
+
+ validate(bindings); // validate this node
+
+ // look for @wsdlLocation
+ if( bindings.getAttributeNode("wsdlLocation")!=null ) {
+ String wsdlLocation = bindings.getAttribute("wsdlLocation");
+
+ try {
+ // absolutize this URI.
+ // TODO: use the URI class
+ // TODO: honor xml:base
+ wsdlLocation = new URL(new
URL(getSystemId(bindings.getOwnerDocument())),
+ wsdlLocation ).toExternalForm();
+ } catch( MalformedURLException e ) {
+ wsdlLocation =
JAXWSUtils.absolutize(JAXWSUtils.getFileOrURLName(wsdlLocation));
+ }
+
+ target = get(wsdlLocation);
+ if(target==null) {
+ error("internalizer.targetNotFound", new
Object[]{wsdlLocation});
+ return; // abort processing this <JAXWS:bindings>
+ }
+ }
+
+ boolean hasNode = true;
+ if(isJAXWSBindings(bindings) &&
bindings.getAttributeNode("node")!=null ) {
+ target = evaluateXPathNode(target, bindings.getAttribute("node"),
new NamespaceContextImpl(bindings));
+ }else if(isJAXWSBindings(bindings) &&
(bindings.getAttributeNode("node")==null) &&
!isTopLevelBinding(bindings)) {
+ hasNode = false;
+ }else if(isGlobalBinding(bindings) && !isWSDLDefinition(target)
&& isTopLevelBinding(bindings.getParentNode())){
+ target = getWSDLDefintionNode(target);
+ }
+
+ //if target is null it means the xpath evaluation has some problem,
+ // just return
+ if(target == null)
+ return;
+
+ // update the result map
+ if(hasNode)
+ result.put( bindings, target );
+
+ // look for child <JAXWS:bindings> and process them recursively
+ Element[] children = getChildElements( bindings,
JAXWSBindingsConstants.NS_JAXWS_BINDINGS);
+ for( int i=0; i<children.length; i++ )
+ buildTargetNodeMap( children[i], target, result );
+ }
+
+ private Node getWSDLDefintionNode(Node target){
+ return evaluateXPathNode(target, "wsdl:definitions",
+ new javax.xml.namespace.NamespaceContext(){
+ public String getNamespaceURI(String prefix){
+ return "http://schemas.xmlsoap.org/wsdl/";
+ }
+ public String getPrefix(String nsURI){
+ throw new UnsupportedOperationException();
+ }
+ public Iterator getPrefixes(String namespaceURI) {
+ throw new UnsupportedOperationException();
+ }});
+ }
+
+ private boolean isWSDLDefinition(Node target){
+ if(target == null)
+ return false;
+ String localName = target.getLocalName();
+ String nsURI = target.getNamespaceURI();
+ if(((localName != null) && localName.equals("definitions"))
&&
+ (nsURI != null &&
nsURI.equals("http://schemas.xmlsoap.org/wsdl/")))
+ return true;
+ return false;
+
+ }
+
+ private boolean isTopLevelBinding(Node node){
+ if(node instanceof Document)
+ node = ((Document)node).getDocumentElement();
+ return ((node != null) &&
(((Element)node).getAttributeNode("wsdlLocation") != null));
+ }
+
+ private boolean isJAXWSBindings(Node bindings){
+ return
(bindings.getNamespaceURI().equals(JAXWSBindingsConstants.NS_JAXWS_BINDINGS) &&
bindings.getLocalName().equals("bindings"));
+ }
+
+ private boolean isGlobalBinding(Node bindings){
+ if((bindings.getNamespaceURI() == null)){
+ warn("invalid.customization.namespace", new
Object[]{bindings.getLocalName()});
+ return false;
+ }
+ return
(bindings.getNamespaceURI().equals(JAXWSBindingsConstants.NS_JAXWS_BINDINGS) &&
+ (bindings.getLocalName().equals("package") ||
+ bindings.getLocalName().equals("enableAsyncMapping") ||
+
bindings.getLocalName().equals("enableAdditionalSOAPHeaderMapping") ||
+ bindings.getLocalName().equals("enableWrapperStyle") ||
+ bindings.getLocalName().equals("enableMIMEContent")));
+ }
+
+ private static Element[] getChildElements(Element parent, String nsUri) {
+ ArrayList a = new ArrayList();
+ NodeList children = parent.getChildNodes();
+ for( int i=0; i<children.getLength(); i++ ) {
+ Node item = children.item(i);
+ if(!(item instanceof Element )) continue;
+
+ if(nsUri.equals(item.getNamespaceURI()))
+ a.add(item);
+ }
+ return (Element[]) a.toArray(new Element[a.size()]);
+ }
+
+ private Node evaluateXPathNode(Node target, String expression, NamespaceContext
namespaceContext) {
+ NodeList nlst;
+ try {
+ xpath.setNamespaceContext(namespaceContext);
+ nlst = (NodeList)xpath.evaluate(expression, target, XPathConstants.NODESET);
+ } catch (XPathExpressionException e) {
+ error("internalizer.XPathEvaluationError", new
Object[]{e.getMessage()});
+ if(env.verbose())
+ e.printStackTrace();
+ return null; // abort processing this <jaxb:bindings>
+ }
+
+ if( nlst.getLength()==0 ) {
+ error("internalizer.XPathEvaluatesToNoTarget", new
Object[]{expression});
+ return null; // abort
+ }
+
+ if( nlst.getLength()!=1 ) {
+ error("internalizer.XPathEvaulatesToTooManyTargets", new
Object[]{expression, nlst.getLength()});
+ return null; // abort
+ }
+
+ Node rnode = nlst.item(0);
+ if(!(rnode instanceof Element )) {
+ error("internalizer.XPathEvaluatesToNonElement", new
Object[]{expression});
+ return null; // abort
+ }
+ return (Element)rnode;
+ }
+
+ /**
+ * Moves JAXWS customizations under their respective target nodes.
+ */
+ private void move( Element bindings, Map<Element, Node> targetNodes ) {
+ Node target = targetNodes.get(bindings);
+ if(target==null)
+ // this must be the result of an error on the external binding.
+ // recover from the error by ignoring this node
+ return;
+
+ Element[] children = DOMUtils.getChildElements(bindings);
+
+ for (Element item : children) {
+ if ("bindings".equals(item.getLocalName())){
+ // process child <jaxws:bindings> recursively
+ move(item, targetNodes);
+ }else if(isGlobalBinding(item)){
+ target = targetNodes.get(item);
+ moveUnder(item,(Element)target);
+ }else {
+ if (!(target instanceof Element)) {
+ return; // abort
+ }
+ // move this node under the target
+ moveUnder(item,(Element)target);
+ }
+ }
+ }
+
+ private boolean isJAXBBindingElement(Element e){
+ if((e.getNamespaceURI() != null ) &&
e.getNamespaceURI().equals(JAXWSBindingsConstants.NS_JAXB_BINDINGS))
+ return true;
+ return false;
+ }
+
+ private boolean isJAXWSBindingElement(Element e){
+ if((e.getNamespaceURI() != null ) &&
e.getNamespaceURI().equals(JAXWSBindingsConstants.NS_JAXWS_BINDINGS))
+ return true;
+ return false;
+ }
+
+ /**
+ * Moves the "decl" node under the "target" node.
+ *
+ * @param decl
+ * A JAXWS customization element (e.g., <JAXWS:class>)
+ *
+ * @param target
+ * XML wsdl element under which the declaration should move.
+ * For example, <xs:element>
+ */
+ private void moveUnder( Element decl, Element target ) {
+
+ //if there is @node on decl and has a child element jaxb:bindings, move it under
the target
+ //Element jaxb = getJAXBBindingElement(decl);
+ if(isJAXBBindingElement(decl)){
+ //add jaxb namespace declaration
+ if(!target.hasAttributeNS(Constants.NS_XMLNS, "jaxb")){
+ target.setAttributeNS(Constants.NS_XMLNS, "xmlns:jaxb",
JAXWSBindingsConstants.NS_JAXB_BINDINGS);
+ }
+
+ //add jaxb:bindings version info. Lets put it to 1.0, may need to change
latter
+ if(!target.hasAttributeNS(JAXWSBindingsConstants.NS_JAXB_BINDINGS,
"version")){
+ target.setAttributeNS(JAXWSBindingsConstants.NS_JAXB_BINDINGS,
"jaxb:version", JAXWSBindingsConstants.JAXB_BINDING_VERSION);
+ }
+
+ //insert xs:annotation/xs:appinfo where in jaxb:binding will be put
+ target = refineSchemaTarget(target);
+ copyInscopeNSAttributes(decl);
+ }else if(isJAXWSBindingElement(decl)){
+ //add jaxb namespace declaration
+ if(!target.hasAttributeNS(Constants.NS_XMLNS, "JAXWS")){
+ target.setAttributeNS(Constants.NS_XMLNS, "xmlns:JAXWS",
JAXWSBindingsConstants.NS_JAXWS_BINDINGS);
+ }
+
+ //insert xs:annotation/xs:appinfo where in jaxb:binding will be put
+ target = refineWSDLTarget(target);
+ copyInscopeNSAttributes(decl);
+ }else{
+ return;
+ }
+
+ // finally move the declaration to the target node.
+ if( target.getOwnerDocument()!=decl.getOwnerDocument() ) {
+ // if they belong to different DOM documents, we need to clone them
+ Element original = decl;
+ decl = (Element)target.getOwnerDocument().importNode(decl,true);
+
+ }
+
+ target.appendChild( decl );
+ }
+
+ /**
+ * Copy in-scope namespace declarations of the decl node
+ * to the decl node itself so that this move won't change
+ * the in-scope namespace bindings.
+ */
+ private void copyInscopeNSAttributes(Element e){
+ Element p = e;
+ Set inscopes = new HashSet();
+ while(true) {
+ NamedNodeMap atts = p.getAttributes();
+ for( int i=0; i<atts.getLength(); i++ ) {
+ Attr a = (Attr)atts.item(i);
+ if( Constants.NS_XMLNS.equals(a.getNamespaceURI()) ) {
+ String prefix;
+ if( a.getName().indexOf(':')==-1 ) prefix = "";
+ else prefix = a.getLocalName();
+
+ if( inscopes.add(prefix) && p!=e ) {
+ // if this is the first time we see this namespace bindings,
+ // copy the declaration.
+ // if p==decl, there's no need to. Note that
+ // we want to add prefix to inscopes even if p==Decl
+
+ e.setAttributeNodeNS( (Attr)a.cloneNode(true) );
+ }
+ }
+ }
+
+ if( p.getParentNode() instanceof Document )
+ break;
+
+ p = (Element)p.getParentNode();
+ }
+
+ if( !inscopes.contains("") ) {
+ // if the default namespace was undeclared in the context of decl,
+ // it must be explicitly set to "" since the new environment might
+ // have a different default namespace URI.
+ e.setAttributeNS(Constants.NS_XMLNS,"xmlns","");
+ }
+ }
+
+ public Element refineSchemaTarget(Element target) {
+ // look for existing xs:annotation
+ Element annotation = DOMUtils.getFirstChildElement(target, Constants.NS_XSD,
"annotation");
+ if(annotation==null)
+ // none exists. need to make one
+ annotation = insertXMLSchemaElement( target, "annotation" );
+
+ // then look for appinfo
+ Element appinfo = DOMUtils.getFirstChildElement(annotation, Constants.NS_XSD,
"appinfo" );
+ if(appinfo==null)
+ // none exists. need to make one
+ appinfo = insertXMLSchemaElement( annotation, "appinfo" );
+
+ return appinfo;
+ }
+
+ public Element refineWSDLTarget(Element target) {
+ // look for existing xs:annotation
+ Element JAXWSBindings = DOMUtils.getFirstChildElement(target,
JAXWSBindingsConstants.NS_JAXWS_BINDINGS, "bindings");
+ if(JAXWSBindings==null)
+ // none exists. need to make one
+ JAXWSBindings = insertJAXWSBindingsElement(target, "bindings" );
+ return JAXWSBindings;
+ }
+
+ /**
+ * Creates a new XML Schema element of the given local name
+ * and insert it as the first child of the given parent node.
+ *
+ * @return
+ * Newly create element.
+ */
+ private Element insertXMLSchemaElement( Element parent, String localName ) {
+ // use the same prefix as the parent node to avoid modifying
+ // the namespace binding.
+ String qname = parent.getTagName();
+ int idx = qname.indexOf(':');
+ if(idx==-1) qname = localName;
+ else qname = qname.substring(0,idx+1)+localName;
+
+ Element child = parent.getOwnerDocument().createElementNS( Constants.NS_XSD,
qname );
+
+ NodeList children = parent.getChildNodes();
+
+ if( children.getLength()==0 )
+ parent.appendChild(child);
+ else
+ parent.insertBefore( child, children.item(0) );
+
+ return child;
+ }
+
+ private Element insertJAXWSBindingsElement( Element parent, String localName ) {
+ String qname = "JAXWS:"+localName;
+
+ Element child =
parent.getOwnerDocument().createElementNS(JAXWSBindingsConstants.NS_JAXWS_BINDINGS, qname
);
+
+ NodeList children = parent.getChildNodes();
+
+ if( children.getLength()==0 )
+ parent.appendChild(child);
+ else
+ parent.insertBefore( child, children.item(0) );
+
+ return child;
+ }
+
+ private String getSystemId(Document doc){
+ for(Map.Entry<String, Document> e:jaxwsBindings.entrySet()){
+ if (e.getValue() == doc)
+ return e.getKey();
+ }
+ return null;
+ }
+
+ protected void warn(Localizable msg) {
+ env.warn(msg);
+ }
+
+
+ protected void error(String key, Object[] args) {
+ env.error(messageFactory.getMessage(key, args));
+ }
+
+ protected void warn(String key) {
+ env.warn(messageFactory.getMessage(key));
+ }
+
+ protected void warn(String key, Object[] args) {
+ env.warn(messageFactory.getMessage(key, args));
+ }
+
+ protected void info(String key) {
+ env.info(messageFactory.getMessage(key));
+ }
+
+ protected void info(String key, String arg) {
+ env.info(messageFactory.getMessage(key, arg));
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/Internalizer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/JAXWSBindingExtensionHandler.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/JAXWSBindingExtensionHandler.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/JAXWSBindingExtensionHandler.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,752 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.wsdl.parser;
+
+import java.util.Iterator;
+import java.io.IOException;
+
+import javax.xml.namespace.QName;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.xpath.XPathFactory;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpressionException;
+
+import org.jboss.com.sun.tools.ws.util.xml.XmlUtil;
+import org.jboss.com.sun.tools.ws.wsdl.document.*;
+import org.jboss.com.sun.tools.ws.wsdl.document.jaxws.CustomName;
+import org.jboss.com.sun.tools.ws.wsdl.document.jaxws.JAXWSBinding;
+import org.jboss.com.sun.tools.ws.wsdl.document.jaxws.JAXWSBindingsConstants;
+import org.jboss.com.sun.tools.ws.wsdl.document.jaxws.Parameter;
+import org.jboss.com.sun.tools.ws.wsdl.document.schema.SchemaKinds;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extensible;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extension;
+import org.jboss.com.sun.tools.ws.wsdl.framework.ParserContext;
+import org.jboss.com.sun.tools.ws.wsdl.framework.WriterContext;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+
+
+/**
+ * @author Vivek Pandey
+ *
+ * jaxws:bindings exension handler.
+ *
+ */
+public class JAXWSBindingExtensionHandler extends ExtensionHandlerBase {
+
+ private static final XPathFactory xpf = XPathFactory.newInstance();
+ private final XPath xpath = xpf.newXPath();
+
+ /**
+ *
+ */
+ public JAXWSBindingExtensionHandler() {
+ }
+
+ /* (non-Javadoc)
+ * @see ExtensionHandler#getNamespaceURI()
+ */
+ public String getNamespaceURI() {
+ return JAXWSBindingsConstants.NS_JAXWS_BINDINGS;
+ }
+
+ /**
+ * @param context
+ * @param parent
+ * @param e
+ */
+ private boolean parseGlobalJAXWSBindings(ParserContext context, Extensible parent,
Element e) {
+ context.push();
+ context.registerNamespaces(e);
+
+ JAXWSBinding jaxwsBinding = getJAXWSExtension(parent);
+ if(jaxwsBinding == null)
+ jaxwsBinding = new JAXWSBinding();
+ String attr = XmlUtil.getAttributeOrNull(e,
JAXWSBindingsConstants.WSDL_LOCATION_ATTR);
+ if (attr != null) {
+ jaxwsBinding.setWsdlLocation(attr);
+ }
+
+ attr = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.NODE_ATTR);
+ if (attr != null) {
+ jaxwsBinding.setNode(attr);
+ }
+
+ attr = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.VERSION_ATTR);
+ if (attr != null) {
+ jaxwsBinding.setVersion(attr);
+ }
+
+ for(Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();){
+ Element e2 = Util.nextElement(iter);
+ if (e2 == null)
+ break;
+
+ if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.PACKAGE)){
+ parsePackage(context, jaxwsBinding, e2);
+ if((jaxwsBinding.getJaxwsPackage() != null) &&
(jaxwsBinding.getJaxwsPackage().getJavaDoc() != null)){
+ ((Definitions)parent).setDocumentation(new
Documentation(jaxwsBinding.getJaxwsPackage().getJavaDoc()));
+ }
+ }else if(XmlUtil.matchesTagNS(e2,
JAXWSBindingsConstants.ENABLE_WRAPPER_STYLE)){
+ parseWrapperStyle(context, jaxwsBinding, e2);
+ }else if(XmlUtil.matchesTagNS(e2,
JAXWSBindingsConstants.ENABLE_ASYNC_MAPPING)){
+ parseAsynMapping(context, jaxwsBinding, e2);
+ }
+// else if(XmlUtil.matchesTagNS(e2,
JAXWSBindingsConstants.ENABLE_ADDITIONAL_SOAPHEADER_MAPPING)){
+// parseAdditionalSOAPHeaderMapping(context, jaxwsBinding, e2);
+// }
+ else if(XmlUtil.matchesTagNS(e2,
JAXWSBindingsConstants.ENABLE_MIME_CONTENT)){
+ parseMimeContent(context, jaxwsBinding, e2);
+ }else{
+ Util.fail(
+ "parsing.invalidExtensionElement",
+ e2.getTagName(),
+ e2.getNamespaceURI());
+ return false;
+ }
+ }
+ parent.addExtension(jaxwsBinding);
+ context.pop();
+ context.fireDoneParsingEntity(
+ JAXWSBindingsConstants.JAXWS_BINDINGS,
+ jaxwsBinding);
+ return true;
+ }
+
+ private static JAXWSBinding getJAXWSExtension(Extensible extensible) {
+ for (Iterator iter = extensible.extensions(); iter.hasNext();) {
+ Extension extension = (Extension)iter.next();
+ if (extension.getClass().equals(JAXWSBinding.class)) {
+ return (JAXWSBinding)extension;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * @param context
+ * @param parent
+ * @param e
+ */
+ private void parseProvider(ParserContext context, Extensible parent, Element e) {
+ String val = e.getTextContent();
+ if(val == null)
+ return;
+ if(val.equals("false") || val.equals("0")){
+ ((JAXWSBinding)parent).setProvider(Boolean.FALSE);
+ }else if(val.equals("true") || val.equals("1")){
+ ((JAXWSBinding)parent).setProvider(Boolean.TRUE);
+ }
+
+ }
+
+ /**
+ *
+ * @param context
+ * @param parent
+ * @param e
+ */
+ private void parseJAXBBindings(ParserContext context, Extensible parent, Element e)
{
+ JAXWSBinding binding = (JAXWSBinding)parent;
+ binding.addJaxbBindings(e);
+ }
+
+ /**
+ * @param context
+ * @param parent
+ * @param e
+ */
+ private void parsePackage(ParserContext context, Extensible parent, Element e) {
+ //System.out.println("In handlePackageExtension: " + e.getNodeName());
+ String packageName = XmlUtil.getAttributeOrNull(e,
JAXWSBindingsConstants.NAME_ATTR);
+ JAXWSBinding binding = (JAXWSBinding)parent;
+ binding.setJaxwsPackage(new CustomName(packageName, getJavaDoc(e)));
+ }
+
+ /**
+ * @param context
+ * @param parent
+ * @param e
+ */
+ private void parseWrapperStyle(ParserContext context, Extensible parent, Element e)
{
+ //System.out.println("In handleWrapperStyleExtension: " +
e.getNodeName());
+ String val = e.getTextContent();
+ if(val == null)
+ return;
+ if(val.equals("false") || val.equals("0")){
+ ((JAXWSBinding)parent).setEnableWrapperStyle(Boolean.FALSE);
+ }else if(val.equals("true") || val.equals("1")){
+ ((JAXWSBinding)parent).setEnableWrapperStyle(Boolean.TRUE);
+ }
+ }
+
+ /**
+ * @param context
+ * @param parent
+ * @param e
+ */
+// private void parseAdditionalSOAPHeaderMapping(ParserContext context, Extensible
parent, Element e) {
+// //System.out.println("In handleAdditionalSOAPHeaderExtension: " +
e.getNodeName());
+// String val = e.getTextContent();
+// if(val == null)
+// return;
+// if(val.equals("false") || val.equals("0")){
+// ((JAXWSBinding)parent).setEnableAdditionalHeaderMapping(Boolean.FALSE);
+// }else if(val.equals("true") || val.equals("1")){
+// ((JAXWSBinding)parent).setEnableAdditionalHeaderMapping(Boolean.TRUE);
+// }
+// }
+
+ /**
+ * @param context
+ * @param parent
+ * @param e
+ */
+ private void parseAsynMapping(ParserContext context, Extensible parent, Element e) {
+ //System.out.println("In handleAsynMappingExtension: " +
e.getNodeName());
+ String val = e.getTextContent();
+ if(val == null)
+ return;
+ if(val.equals("false") || val.equals("0")){
+ ((JAXWSBinding)parent).setEnableAsyncMapping(Boolean.FALSE);
+ }else if(val.equals("true") || val.equals("1")){
+ ((JAXWSBinding)parent).setEnableAsyncMapping(Boolean.TRUE);
+ }
+ }
+
+ /**
+ * @param context
+ * @param parent
+ * @param e
+ */
+ private void parseMimeContent(ParserContext context, Extensible parent, Element e) {
+ //System.out.println("In handleMimeContentExtension: " +
e.getNodeName());
+ String val = e.getTextContent();
+ if(val == null)
+ return;
+ if(val.equals("false") || val.equals("0")){
+ ((JAXWSBinding)parent).setEnableMimeContentMapping(Boolean.FALSE);
+ }else if(val.equals("true") || val.equals("1")){
+ ((JAXWSBinding)parent).setEnableMimeContentMapping(Boolean.TRUE);
+ }
+ }
+
+ /**
+ * @param context
+ * @param jaxwsBinding
+ * @param e
+ */
+ private void parseMethod(ParserContext context, JAXWSBinding jaxwsBinding, Element e)
{
+ String methodName = XmlUtil.getAttributeOrNull(e,
JAXWSBindingsConstants.NAME_ATTR);
+ String javaDoc = getJavaDoc(e);
+ CustomName name = new CustomName(methodName, javaDoc);
+ jaxwsBinding.setMethodName(name);
+ }
+
+ /**
+ * @param context
+ * @param jaxwsBinding
+ * @param e
+ */
+ private void parseParameter(ParserContext context, JAXWSBinding jaxwsBinding, Element
e) {
+ String part = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.PART_ATTR);
+ Element msgPartElm = evaluateXPathNode(e.getOwnerDocument(), part, new
NamespaceContextImpl(e));
+ Node msgElm = msgPartElm.getParentNode();
+ //MessagePart msgPart = new MessagePart();
+
+ String partName = XmlUtil.getAttributeOrNull(msgPartElm, "name");
+ String msgName = XmlUtil.getAttributeOrNull((Element)msgElm, "name");
+ if((partName == null) || (msgName == null))
+ return;
+
+ String val = XmlUtil.getAttributeOrNull(msgPartElm, "element");
+
+ String element = XmlUtil.getAttributeOrNull(e,
JAXWSBindingsConstants.ELEMENT_ATTR);
+ String name = XmlUtil.getAttributeOrNull(e, JAXWSBindingsConstants.NAME_ATTR);
+
+ QName elementName = null;
+ if(element != null){
+ String uri = e.lookupNamespaceURI(XmlUtil.getPrefix(element));
+ elementName = (uri == null)?null:new QName(uri,
XmlUtil.getLocalPart(element));
+ }
+
+ jaxwsBinding.addParameter(new Parameter(msgName, partName, elementName, name));
+ }
+
+ private Element evaluateXPathNode(Node target, String expression, NamespaceContext
namespaceContext) {
+ NodeList nlst;
+ try {
+ xpath.setNamespaceContext(namespaceContext);
+ nlst = (NodeList)xpath.evaluate(expression, target, XPathConstants.NODESET);
+ } catch (XPathExpressionException e) {
+ Util.fail("internalizer.XPathEvaluationError", e.getMessage());
+ return null; // abort processing this <jaxb:bindings>
+ }
+
+ if( nlst.getLength()==0 ) {
+ Util.fail("internalizer.XPathEvaluatesToNoTarget", new
Object[]{expression});
+ return null; // abort
+ }
+
+ if( nlst.getLength()!=1 ) {
+ Util.fail("internalizer.XPathEvaulatesToTooManyTargets", new
Object[]{expression, nlst.getLength()});
+ return null; // abort
+ }
+
+ Node rnode = nlst.item(0);
+ if(!(rnode instanceof Element )) {
+ Util.fail("internalizer.XPathEvaluatesToNonElement", new
Object[]{expression});
+ return null; // abort
+ }
+ return (Element)rnode;
+ }
+
+ /**
+ * @param context
+ * @param jaxwsBinding
+ * @param e
+ */
+ private void parseClass(ParserContext context, JAXWSBinding jaxwsBinding, Element e)
{
+ String className = XmlUtil.getAttributeOrNull(e,
JAXWSBindingsConstants.NAME_ATTR);
+ String javaDoc = getJavaDoc(e);
+ jaxwsBinding.setClassName(new CustomName(className, javaDoc));
+ }
+
+
+ /**
+ * @param context
+ * @param jaxwsBinding
+ * @param e
+ */
+ private void parseException(ParserContext context, JAXWSBinding jaxwsBinding, Element
e) {
+ for(Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();){
+ Element e2 = Util.nextElement(iter);
+ if (e2 == null)
+ break;
+ if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.CLASS)){
+ String className = XmlUtil.getAttributeOrNull(e2,
JAXWSBindingsConstants.NAME_ATTR);
+ String javaDoc = getJavaDoc(e2);
+ jaxwsBinding.setException(new
org.jboss.com.sun.tools.ws.wsdl.document.jaxws.Exception(new CustomName(className,
javaDoc)));
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see ExtensionHandlerBase#handleDefinitionsExtension(ParserContext, Extensible,
org.w3c.dom.Element)
+ */
+ protected boolean handleDefinitionsExtension(ParserContext context, Extensible
parent, Element e) {
+ return parseGlobalJAXWSBindings(context, parent, e);
+ }
+
+ /* (non-Javadoc)
+ * @see ExtensionHandlerBase#handleTypesExtension(ParserContext, Extensible,
org.w3c.dom.Element)
+ */
+ protected boolean handleTypesExtension(ParserContext context, Extensible parent,
Element e) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see ExtensionHandlerBase#handlePortTypeExtension(ParserContext, Extensible,
org.w3c.dom.Element)
+ */
+ protected boolean handlePortTypeExtension(ParserContext context, Extensible parent,
Element e) {
+ if(XmlUtil.matchesTagNS(e, JAXWSBindingsConstants.JAXWS_BINDINGS)){
+ context.push();
+ context.registerNamespaces(e);
+ JAXWSBinding jaxwsBinding = new JAXWSBinding();
+
+ for(Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();){
+ Element e2 = Util.nextElement(iter);
+ if (e2 == null)
+ break;
+
+ if(XmlUtil.matchesTagNS(e2,
JAXWSBindingsConstants.ENABLE_WRAPPER_STYLE)){
+ parseWrapperStyle(context, jaxwsBinding, e2);
+ }else if(XmlUtil.matchesTagNS(e2,
JAXWSBindingsConstants.ENABLE_ASYNC_MAPPING)){
+ parseAsynMapping(context, jaxwsBinding, e2);
+ }else if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.CLASS)){
+ parseClass(context, jaxwsBinding, e2);
+ if((jaxwsBinding.getClassName() != null) &&
(jaxwsBinding.getClassName().getJavaDoc() != null)){
+ ((PortType)parent).setDocumentation(new
Documentation(jaxwsBinding.getClassName().getJavaDoc()));
+ }
+ }else{
+ Util.fail(
+ "parsing.invalidExtensionElement",
+ e2.getTagName(),
+ e2.getNamespaceURI());
+ return false;
+ }
+ }
+ parent.addExtension(jaxwsBinding);
+ context.pop();
+ context.fireDoneParsingEntity(
+ JAXWSBindingsConstants.JAXWS_BINDINGS,
+ jaxwsBinding);
+ return true;
+ }else {
+ Util.fail(
+ "parsing.invalidExtensionElement",
+ e.getTagName(),
+ e.getNamespaceURI());
+ return false;
+ }
+ }
+
+
+
+ /* (non-Javadoc)
+ * @see ExtensionHandlerBase#handleOperationExtension(ParserContext, Extensible,
org.w3c.dom.Element)
+ */
+ protected boolean handleOperationExtension(ParserContext context, Extensible parent,
Element e) {
+ if(XmlUtil.matchesTagNS(e, JAXWSBindingsConstants.JAXWS_BINDINGS)){
+ if(parent instanceof Operation){
+ return handlePortTypeOperation(context, (Operation)parent, e);
+ }else if(parent instanceof BindingOperation){
+ return handleBindingOperation(context, (BindingOperation)parent, e);
+ }
+ }else {
+ Util.fail(
+ "parsing.invalidExtensionElement",
+ e.getTagName(),
+ e.getNamespaceURI());
+ return false;
+ }
+ return false;
+ }
+
+ /**
+ * @param context
+ * @param operation
+ * @param e
+ * @return
+ */
+ private boolean handleBindingOperation(ParserContext context, BindingOperation
operation, Element e) {
+ if(XmlUtil.matchesTagNS(e, JAXWSBindingsConstants.JAXWS_BINDINGS)){
+ context.push();
+ context.registerNamespaces(e);
+ JAXWSBinding jaxwsBinding = new JAXWSBinding();
+
+ for(Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();){
+ Element e2 = Util.nextElement(iter);
+ if (e2 == null)
+ break;
+
+// if(XmlUtil.matchesTagNS(e2,
JAXWSBindingsConstants.ENABLE_ADDITIONAL_SOAPHEADER_MAPPING)){
+// parseAdditionalSOAPHeaderMapping(context, jaxwsBinding, e2);
+// }else
+ if(XmlUtil.matchesTagNS(e2,
JAXWSBindingsConstants.ENABLE_MIME_CONTENT)){
+ parseMimeContent(context, jaxwsBinding, e2);
+ }else if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.PARAMETER)){
+ parseParameter(context, jaxwsBinding, e2);
+ }else{
+ Util.fail(
+ "parsing.invalidExtensionElement",
+ e2.getTagName(),
+ e2.getNamespaceURI());
+ return false;
+ }
+ }
+ operation.addExtension(jaxwsBinding);
+ context.pop();
+ context.fireDoneParsingEntity(
+ JAXWSBindingsConstants.JAXWS_BINDINGS,
+ jaxwsBinding);
+ return true;
+ }else {
+ Util.fail(
+ "parsing.invalidExtensionElement",
+ e.getTagName(),
+ e.getNamespaceURI());
+ return false;
+ }
+ }
+
+ /**
+ * @param context
+ * @param parent
+ * @param e
+ * @return
+ */
+ private boolean handlePortTypeOperation(ParserContext context, Operation parent,
Element e) {
+ context.push();
+ context.registerNamespaces(e);
+ JAXWSBinding jaxwsBinding = new JAXWSBinding();
+
+ for(Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();){
+ Element e2 = Util.nextElement(iter);
+ if (e2 == null)
+ break;
+
+ if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.ENABLE_WRAPPER_STYLE)){
+ parseWrapperStyle(context, jaxwsBinding, e2);
+ }else if(XmlUtil.matchesTagNS(e2,
JAXWSBindingsConstants.ENABLE_ASYNC_MAPPING)){
+ parseAsynMapping(context, jaxwsBinding, e2);
+ }else if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.METHOD)){
+ parseMethod(context, jaxwsBinding, e2);
+ if((jaxwsBinding.getMethodName() != null) &&
(jaxwsBinding.getMethodName().getJavaDoc() != null)){
+ parent.setDocumentation(new
Documentation(jaxwsBinding.getMethodName().getJavaDoc()));
+ }
+ }else if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.PARAMETER)){
+ parseParameter(context, jaxwsBinding, e2);
+ }else{
+ Util.fail(
+ "parsing.invalidExtensionElement",
+ e2.getTagName(),
+ e2.getNamespaceURI());
+ return false;
+ }
+ }
+ parent.addExtension(jaxwsBinding);
+ context.pop();
+ context.fireDoneParsingEntity(
+ JAXWSBindingsConstants.JAXWS_BINDINGS,
+ jaxwsBinding);
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see ExtensionHandlerBase#handleBindingExtension(ParserContext, Extensible,
org.w3c.dom.Element)
+ */
+ protected boolean handleBindingExtension(ParserContext context, Extensible parent,
Element e) {
+ if(XmlUtil.matchesTagNS(e, JAXWSBindingsConstants.JAXWS_BINDINGS)){
+ context.push();
+ context.registerNamespaces(e);
+ JAXWSBinding jaxwsBinding = new JAXWSBinding();
+
+ for(Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();){
+ Element e2 = Util.nextElement(iter);
+ if (e2 == null)
+ break;
+
+// if(XmlUtil.matchesTagNS(e2,
JAXWSBindingsConstants.ENABLE_ADDITIONAL_SOAPHEADER_MAPPING)){
+// parseAdditionalSOAPHeaderMapping(context, jaxwsBinding, e2);
+// }else
+ if(XmlUtil.matchesTagNS(e2,
JAXWSBindingsConstants.ENABLE_MIME_CONTENT)){
+ parseMimeContent(context, jaxwsBinding, e2);
+ }else{
+ Util.fail(
+ "parsing.invalidExtensionElement",
+ e2.getTagName(),
+ e2.getNamespaceURI());
+ return false;
+ }
+ }
+ parent.addExtension(jaxwsBinding);
+ context.pop();
+ context.fireDoneParsingEntity(
+ JAXWSBindingsConstants.JAXWS_BINDINGS,
+ jaxwsBinding);
+ return true;
+ }else {
+ Util.fail(
+ "parsing.invalidExtensionElement",
+ e.getTagName(),
+ e.getNamespaceURI());
+ return false;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see ExtensionHandlerBase#handleInputExtension(ParserContext, Extensible,
org.w3c.dom.Element)
+ */
+ protected boolean handleInputExtension(ParserContext context, Extensible parent,
Element e) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see ExtensionHandlerBase#handleOutputExtension(ParserContext, Extensible,
org.w3c.dom.Element)
+ */
+ protected boolean handleOutputExtension(ParserContext context, Extensible parent,
Element e) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see ExtensionHandlerBase#handleFaultExtension(ParserContext, Extensible,
org.w3c.dom.Element)
+ */
+ protected boolean handleFaultExtension(ParserContext context, Extensible parent,
Element e) {
+ if(XmlUtil.matchesTagNS(e, JAXWSBindingsConstants.JAXWS_BINDINGS)){
+ context.push();
+ context.registerNamespaces(e);
+ JAXWSBinding jaxwsBinding = new JAXWSBinding();
+
+ for(Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();){
+ Element e2 = Util.nextElement(iter);
+ if (e2 == null)
+ break;
+ if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.CLASS)){
+ parseClass(context, jaxwsBinding, e2);
+ if((jaxwsBinding.getClassName() != null) &&
(jaxwsBinding.getClassName().getJavaDoc() != null)){
+ ((Fault)parent).setDocumentation(new
Documentation(jaxwsBinding.getClassName().getJavaDoc()));
+ }
+ }else{
+ Util.fail(
+ "parsing.invalidExtensionElement",
+ e2.getTagName(),
+ e2.getNamespaceURI());
+ return false;
+ }
+ }
+ parent.addExtension(jaxwsBinding);
+ context.pop();
+ context.fireDoneParsingEntity(
+ JAXWSBindingsConstants.JAXWS_BINDINGS,
+ jaxwsBinding);
+ return true;
+ }else {
+ Util.fail(
+ "parsing.invalidExtensionElement",
+ e.getTagName(),
+ e.getNamespaceURI());
+ return false;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see ExtensionHandlerBase#handleServiceExtension(ParserContext, Extensible,
org.w3c.dom.Element)
+ */
+ protected boolean handleServiceExtension(ParserContext context, Extensible parent,
Element e) {
+ if(XmlUtil.matchesTagNS(e, JAXWSBindingsConstants.JAXWS_BINDINGS)){
+ context.push();
+ context.registerNamespaces(e);
+ JAXWSBinding jaxwsBinding = new JAXWSBinding();
+
+ for(Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();){
+ Element e2 = Util.nextElement(iter);
+ if (e2 == null)
+ break;
+ if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.CLASS)){
+ parseClass(context, jaxwsBinding, e2);
+ if((jaxwsBinding.getClassName() != null) &&
(jaxwsBinding.getClassName().getJavaDoc() != null)){
+ ((Service)parent).setDocumentation(new
Documentation(jaxwsBinding.getClassName().getJavaDoc()));
+ }
+ }else{
+ Util.fail(
+ "parsing.invalidExtensionElement",
+ e2.getTagName(),
+ e2.getNamespaceURI());
+ return false;
+ }
+ }
+ parent.addExtension(jaxwsBinding);
+ context.pop();
+ context.fireDoneParsingEntity(
+ JAXWSBindingsConstants.JAXWS_BINDINGS,
+ jaxwsBinding);
+ return true;
+ }else {
+ Util.fail(
+ "parsing.invalidExtensionElement",
+ e.getTagName(),
+ e.getNamespaceURI());
+ return false;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see ExtensionHandlerBase#handlePortExtension(ParserContext, Extensible,
org.w3c.dom.Element)
+ */
+ protected boolean handlePortExtension(ParserContext context, Extensible parent,
Element e) {
+ if(XmlUtil.matchesTagNS(e, JAXWSBindingsConstants.JAXWS_BINDINGS)){
+ context.push();
+ context.registerNamespaces(e);
+ JAXWSBinding jaxwsBinding = new JAXWSBinding();
+
+ for(Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();){
+ Element e2 = Util.nextElement(iter);
+ if (e2 == null)
+ break;
+
+ if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.PROVIDER)){
+ parseProvider(context, jaxwsBinding, e2);
+ }else if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.METHOD)){
+ parseMethod(context, jaxwsBinding, e2);
+ if((jaxwsBinding.getMethodName() != null) &&
(jaxwsBinding.getMethodName().getJavaDoc() != null)){
+ ((Port)parent).setDocumentation(new
Documentation(jaxwsBinding.getMethodName().getJavaDoc()));
+ }
+ }else{
+ Util.fail(
+ "parsing.invalidExtensionElement",
+ e2.getTagName(),
+ e2.getNamespaceURI());
+ return false;
+ }
+ }
+ parent.addExtension(jaxwsBinding);
+ context.pop();
+ context.fireDoneParsingEntity(
+ JAXWSBindingsConstants.JAXWS_BINDINGS,
+ jaxwsBinding);
+ return true;
+ }else {
+ Util.fail(
+ "parsing.invalidExtensionElement",
+ e.getTagName(),
+ e.getNamespaceURI());
+ return false;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see ExtensionHandlerBase#handleMIMEPartExtension(ParserContext, Extensible,
org.w3c.dom.Element)
+ */
+ protected boolean handleMIMEPartExtension(ParserContext context, Extensible parent,
Element e) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ private String getJavaDoc(Element e){
+ for(Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();){
+ Element e2 = Util.nextElement(iter);
+ if (e2 == null)
+ break;
+ if(XmlUtil.matchesTagNS(e2, JAXWSBindingsConstants.JAVADOC)){
+ return XmlUtil.getTextForNode(e2);
+ }
+ }
+ return null;
+ }
+
+ public void doHandleExtension(WriterContext context, Extension extension)
+ throws IOException {
+ //System.out.println("JAXWSBindingExtensionHandler doHandleExtension:
"+extension);
+ // NOTE - this ugliness can be avoided by moving all the XML parsing/writing
code
+ // into the document classes themselves
+ if (extension instanceof JAXWSBinding) {
+ JAXWSBinding binding = (JAXWSBinding) extension;
+ System.out.println("binding.getElementName:
"+binding.getElementName());
+ context.writeStartTag(binding.getElementName());
+ context.writeStartTag(JAXWSBindingsConstants.ENABLE_WRAPPER_STYLE);
+ context.writeChars(binding.isEnableWrapperStyle().toString());
+ context.writeEndTag(JAXWSBindingsConstants.ENABLE_WRAPPER_STYLE);
+ context.writeEndTag(binding.getElementName());
+ } else {
+ throw new IllegalArgumentException();
+ }
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/JAXWSBindingExtensionHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/MIMEExtensionHandler.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/MIMEExtensionHandler.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/MIMEExtensionHandler.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,271 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.parser;
+
+import java.io.IOException;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.util.xml.XmlUtil;
+import org.jboss.com.sun.tools.ws.wsdl.document.WSDLConstants;
+import org.jboss.com.sun.tools.ws.wsdl.document.mime.MIMEConstants;
+import org.jboss.com.sun.tools.ws.wsdl.document.mime.MIMEContent;
+import org.jboss.com.sun.tools.ws.wsdl.document.mime.MIMEMultipartRelated;
+import org.jboss.com.sun.tools.ws.wsdl.document.mime.MIMEPart;
+import org.jboss.com.sun.tools.ws.wsdl.document.mime.MIMEXml;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extensible;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extension;
+import org.jboss.com.sun.tools.ws.wsdl.framework.ParserContext;
+import org.jboss.com.sun.tools.ws.wsdl.framework.WriterContext;
+import org.w3c.dom.Element;
+
+
+/**
+ * The MIME extension handler for WSDL.
+ *
+ * @author WS Development Team
+ */
+public class MIMEExtensionHandler extends ExtensionHandler {
+
+ public MIMEExtensionHandler() {
+ }
+
+ public String getNamespaceURI() {
+ return Constants.NS_WSDL_MIME;
+ }
+
+ public boolean doHandleExtension(
+ ParserContext context,
+ Extensible parent,
+ Element e) {
+ if (parent.getElementName().equals(WSDLConstants.QNAME_OUTPUT)) {
+ return handleInputOutputExtension(context, parent, e);
+ } else if (parent.getElementName().equals(WSDLConstants.QNAME_INPUT)) {
+ return handleInputOutputExtension(context, parent, e);
+ } else if (parent.getElementName().equals(MIMEConstants.QNAME_PART)) {
+ return handleMIMEPartExtension(context, parent, e);
+ } else {
+ context.fireIgnoringExtension(
+ new QName(e.getNamespaceURI(), e.getLocalName()),
+ parent.getElementName());
+ return false;
+ }
+ }
+
+ protected boolean handleInputOutputExtension(
+ ParserContext context,
+ Extensible parent,
+ Element e) {
+ if (XmlUtil.matchesTagNS(e, MIMEConstants.QNAME_MULTIPART_RELATED)) {
+ context.push();
+ context.registerNamespaces(e);
+
+ MIMEMultipartRelated mpr = new MIMEMultipartRelated();
+
+ for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) {
+ Element e2 = Util.nextElement(iter);
+ if (e2 == null)
+ break;
+
+ if (XmlUtil.matchesTagNS(e2, MIMEConstants.QNAME_PART)) {
+ context.push();
+ context.registerNamespaces(e2);
+
+ MIMEPart part = new MIMEPart();
+
+ String name =
+ XmlUtil.getAttributeOrNull(e2, Constants.ATTR_NAME);
+ if (name != null) {
+ part.setName(name);
+ }
+
+ for (Iterator iter2 = XmlUtil.getAllChildren(e2);
+ iter2.hasNext();
+ ) {
+ Element e3 = Util.nextElement(iter2);
+ if (e3 == null)
+ break;
+
+ ExtensionHandler h =
+ (ExtensionHandler) _extensionHandlers.get(
+ e3.getNamespaceURI());
+ boolean handled = false;
+ if (h != null) {
+ handled = h.doHandleExtension(context, part, e3);
+ }
+
+ if (!handled) {
+ String required =
+ XmlUtil.getAttributeNSOrNull(
+ e3,
+ Constants.ATTR_REQUIRED,
+ Constants.NS_WSDL);
+ if (required != null
+ && required.equals(Constants.TRUE)) {
+ Util.fail(
+ "parsing.requiredExtensibilityElement",
+ e3.getTagName(),
+ e3.getNamespaceURI());
+ } else {
+ context.fireIgnoringExtension(
+ new QName(
+ e3.getNamespaceURI(),
+ e3.getLocalName()),
+ part.getElementName());
+ }
+ }
+ }
+
+ mpr.add(part);
+ context.pop();
+ context.fireDoneParsingEntity(
+ MIMEConstants.QNAME_PART,
+ part);
+ } else {
+ Util.fail(
+ "parsing.invalidElement",
+ e2.getTagName(),
+ e2.getNamespaceURI());
+ }
+ }
+
+ parent.addExtension(mpr);
+ context.pop();
+ context.fireDoneParsingEntity(
+ MIMEConstants.QNAME_MULTIPART_RELATED,
+ mpr);
+ return true;
+ } else if (XmlUtil.matchesTagNS(e, MIMEConstants.QNAME_CONTENT)) {
+ MIMEContent content = parseMIMEContent(context, e);
+ parent.addExtension(content);
+ return true;
+ } else if (XmlUtil.matchesTagNS(e, MIMEConstants.QNAME_MIME_XML)) {
+ MIMEXml mimeXml = parseMIMEXml(context, e);
+ parent.addExtension(mimeXml);
+ return true;
+ } else {
+ Util.fail(
+ "parsing.invalidExtensionElement",
+ e.getTagName(),
+ e.getNamespaceURI());
+ return false; // keep compiler happy
+ }
+ }
+
+ protected boolean handleMIMEPartExtension(
+ ParserContext context,
+ Extensible parent,
+ Element e) {
+ if (XmlUtil.matchesTagNS(e, MIMEConstants.QNAME_CONTENT)) {
+ MIMEContent content = parseMIMEContent(context, e);
+ parent.addExtension(content);
+ return true;
+ } else if (XmlUtil.matchesTagNS(e, MIMEConstants.QNAME_MIME_XML)) {
+ MIMEXml mimeXml = parseMIMEXml(context, e);
+ parent.addExtension(mimeXml);
+ return true;
+ } else {
+ Util.fail(
+ "parsing.invalidExtensionElement",
+ e.getTagName(),
+ e.getNamespaceURI());
+ return false; // keep compiler happy
+ }
+ }
+
+ protected MIMEContent parseMIMEContent(ParserContext context, Element e) {
+ context.push();
+ context.registerNamespaces(e);
+
+ MIMEContent content = new MIMEContent();
+
+ String part = XmlUtil.getAttributeOrNull(e, Constants.ATTR_PART);
+ if (part != null) {
+ content.setPart(part);
+ }
+
+ String type = XmlUtil.getAttributeOrNull(e, Constants.ATTR_TYPE);
+ if (type != null) {
+ content.setType(type);
+ }
+
+ context.pop();
+ context.fireDoneParsingEntity(MIMEConstants.QNAME_CONTENT, content);
+ return content;
+ }
+
+ protected MIMEXml parseMIMEXml(ParserContext context, Element e) {
+ context.push();
+ context.registerNamespaces(e);
+
+ MIMEXml mimeXml = new MIMEXml();
+
+ String part = XmlUtil.getAttributeOrNull(e, Constants.ATTR_PART);
+ if (part != null) {
+ mimeXml.setPart(part);
+ }
+
+ context.pop();
+ context.fireDoneParsingEntity(MIMEConstants.QNAME_MIME_XML, mimeXml);
+ return mimeXml;
+ }
+
+ public void doHandleExtension(WriterContext context, Extension extension)
+ throws IOException {
+ // NOTE - this ugliness can be avoided by moving all the XML parsing/writing
code
+ // into the document classes themselves
+ if (extension instanceof MIMEContent) {
+ MIMEContent content = (MIMEContent) extension;
+ context.writeStartTag(content.getElementName());
+ context.writeAttribute(Constants.ATTR_PART, content.getPart());
+ context.writeAttribute(Constants.ATTR_TYPE, content.getType());
+ context.writeEndTag(content.getElementName());
+ } else if (extension instanceof MIMEXml) {
+ MIMEXml mimeXml = (MIMEXml) extension;
+ context.writeStartTag(mimeXml.getElementName());
+ context.writeAttribute(Constants.ATTR_PART, mimeXml.getPart());
+ context.writeEndTag(mimeXml.getElementName());
+ } else if (extension instanceof MIMEMultipartRelated) {
+ MIMEMultipartRelated mpr = (MIMEMultipartRelated) extension;
+ context.writeStartTag(mpr.getElementName());
+ for (Iterator iter = mpr.getParts(); iter.hasNext();) {
+ MIMEPart part = (MIMEPart) iter.next();
+ context.writeStartTag(part.getElementName());
+ for (Iterator iter2 = part.extensions(); iter2.hasNext();) {
+ Extension e = (Extension) iter2.next();
+ ExtensionHandler h =
+ (ExtensionHandler) _extensionHandlers.get(
+ e.getElementName().getNamespaceURI());
+ if (h != null) {
+ h.doHandleExtension(context, e);
+ }
+ }
+ context.writeEndTag(part.getElementName());
+ }
+ context.writeEndTag(mpr.getElementName());
+ } else {
+ throw new IllegalArgumentException();
+ }
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/MIMEExtensionHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/NamespaceContextImpl.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/NamespaceContextImpl.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/NamespaceContextImpl.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,106 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.wsdl.parser;
+
+import java.util.Iterator;
+
+import javax.xml.namespace.NamespaceContext;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+import com.sun.xml.bind.v2.WellKnownNamespace;
+
+public class NamespaceContextImpl implements NamespaceContext {
+
+ private final Element e;
+
+ public NamespaceContextImpl(Element e) {
+ this.e = e;
+ }
+
+ /*
+ * Copyright 1999-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.
+ */
+ public String getNamespaceURI(String prefix) {
+ Node parent = e;
+ String namespace = null;
+
+ if (prefix.equals("xml")) {
+ namespace = WellKnownNamespace.XML_NAMESPACE_URI;
+ } else {
+ int type;
+
+ while ((null != parent) && (null == namespace)
+ && (((type = parent.getNodeType()) == Node.ELEMENT_NODE)
+ || (type == Node.ENTITY_REFERENCE_NODE))) {
+ if (type == Node.ELEMENT_NODE) {
+ if (parent.getNodeName().indexOf(prefix + ':') == 0)
+ return parent.getNamespaceURI();
+ NamedNodeMap nnm = parent.getAttributes();
+
+ for (int i = 0; i < nnm.getLength(); i++) {
+ Node attr = nnm.item(i);
+ String aname = attr.getNodeName();
+ boolean isPrefix = aname.startsWith("xmlns:");
+
+ if (isPrefix || aname.equals("xmlns")) {
+ int index = aname.indexOf(':');
+ String p = isPrefix ? aname.substring(index + 1) :
"";
+
+ if (p.equals(prefix)) {
+ namespace = attr.getNodeValue();
+
+ break;
+ }
+ }
+ }
+ }
+
+ parent = parent.getParentNode();
+ }
+ }
+
+ return namespace;
+ }
+
+ public String getPrefix(String namespaceURI) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Iterator getPrefixes(String namespaceURI) {
+ throw new UnsupportedOperationException();
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/NamespaceContextImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/SOAP12ExtensionHandler.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/SOAP12ExtensionHandler.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/SOAP12ExtensionHandler.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,101 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.tools.ws.wsdl.parser;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.document.soap.SOAP12Binding;
+import org.jboss.com.sun.tools.ws.wsdl.document.soap.SOAP12Constants;
+import org.jboss.com.sun.tools.ws.wsdl.document.soap.SOAPBinding;
+
+
+
+public class SOAP12ExtensionHandler extends SOAPExtensionHandler {
+
+ /*
+ * @see SOAPExtensionHandler#getNamespaceURI()
+ */
+ @Override
+ public String getNamespaceURI() {
+ return Constants.NS_WSDL_SOAP12;
+ }
+
+ /*
+ * @see SOAPExtensionHandler#getAddressQName()
+ */
+ @Override
+ protected QName getAddressQName() {
+ return SOAP12Constants.QNAME_ADDRESS;
+ }
+
+ /*
+ * @see SOAPExtensionHandler#getBindingQName()
+ */
+ @Override
+ protected QName getBindingQName() {
+ return SOAP12Constants.QNAME_BINDING;
+ }
+
+ @Override protected SOAPBinding getSOAPBinding() {
+ return new SOAP12Binding();
+ }
+
+ /*
+ * @see SOAPExtensionHandler#getBodyQName()
+ */
+ @Override
+ protected QName getBodyQName() {
+ return SOAP12Constants.QNAME_BODY;
+ }
+
+ /*
+ * @see SOAPExtensionHandler#getFaultQName()
+ */
+ @Override
+ protected QName getFaultQName() {
+ return SOAP12Constants.QNAME_FAULT;
+ }
+
+ /*
+ * @see SOAPExtensionHandler#getHeaderfaultQName()
+ */
+ @Override
+ protected QName getHeaderfaultQName() {
+ return SOAP12Constants.QNAME_HEADERFAULT;
+ }
+
+ /*
+ * @see SOAPExtensionHandler#getHeaderQName()
+ */
+ @Override
+ protected QName getHeaderQName() {
+ return SOAP12Constants.QNAME_HEADER;
+ }
+
+ /*
+ * @see SOAPExtensionHandler#getOperationQName()
+ */
+ @Override
+ protected QName getOperationQName() {
+ return SOAP12Constants.QNAME_OPERATION;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/SOAP12ExtensionHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/SOAPEntityReferenceValidator.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/SOAPEntityReferenceValidator.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/SOAPEntityReferenceValidator.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,216 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.parser;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.document.schema.SchemaConstants;
+import org.jboss.com.sun.tools.ws.wsdl.document.schema.SchemaKinds;
+import org.jboss.com.sun.tools.ws.wsdl.document.soap.SOAPConstants;
+import org.jboss.com.sun.tools.ws.wsdl.framework.EntityReferenceValidator;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Kind;
+
+
+/**
+ * An interface implemented by a class that is capable of validating
+ * a QName/Kind pair referring to an external entity.
+ *
+ * @author WS Development Team
+ */
+public class SOAPEntityReferenceValidator implements EntityReferenceValidator {
+ public SOAPEntityReferenceValidator() {
+ }
+
+ public boolean isValid(Kind kind, QName name) {
+
+ // just let all "xml:" QNames through
+ if (name.getNamespaceURI().equals(Constants.NS_XML))
+ return true;
+
+ if (kind == SchemaKinds.XSD_TYPE) {
+ return _validTypes.contains(name);
+ } else if (kind == SchemaKinds.XSD_ELEMENT) {
+ return _validElements.contains(name);
+ } else if (kind == SchemaKinds.XSD_ATTRIBUTE) {
+ return _validAttributes.contains(name);
+ } else {
+ // no luck
+ return false;
+ }
+ }
+
+ private static final Set _validTypes;
+ private static final Set _validElements;
+ private static final Set _validAttributes;
+
+ static {
+ // add all XML Schema and SOAP types
+ _validTypes = new HashSet();
+ _validTypes.add(SOAPConstants.QNAME_TYPE_ARRAY);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_STRING);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_NORMALIZED_STRING);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_TOKEN);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_BYTE);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_UNSIGNED_BYTE);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_BASE64_BINARY);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_HEX_BINARY);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_INTEGER);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_POSITIVE_INTEGER);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_NEGATIVE_INTEGER);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_NON_NEGATIVE_INTEGER);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_NON_POSITIVE_INTEGER);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_INT);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_UNSIGNED_INT);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_LONG);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_UNSIGNED_LONG);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_SHORT);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_UNSIGNED_SHORT);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_DECIMAL);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_FLOAT);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_DOUBLE);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_BOOLEAN);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_TIME);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_DATE_TIME);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_DURATION);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_DATE);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_G_MONTH);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_G_YEAR);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_G_YEAR_MONTH);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_G_DAY);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_G_MONTH_DAY);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_NAME);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_QNAME);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_NCNAME);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_ANY_URI);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_ID);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_IDREF);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_IDREFS);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_ENTITY);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_ENTITIES);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_NOTATION);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_NMTOKEN);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_NMTOKENS);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_URTYPE);
+ _validTypes.add(SchemaConstants.QNAME_TYPE_SIMPLE_URTYPE);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_STRING);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_NORMALIZED_STRING);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_TOKEN);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_BYTE);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_UNSIGNED_BYTE);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_BASE64_BINARY);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_HEX_BINARY);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_INTEGER);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_POSITIVE_INTEGER);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_NEGATIVE_INTEGER);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_NON_NEGATIVE_INTEGER);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_NON_POSITIVE_INTEGER);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_INT);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_UNSIGNED_INT);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_LONG);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_UNSIGNED_LONG);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_SHORT);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_UNSIGNED_SHORT);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_DECIMAL);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_FLOAT);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_DOUBLE);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_BOOLEAN);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_TIME);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_DATE_TIME);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_DURATION);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_DATE);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_G_MONTH);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_G_YEAR);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_G_YEAR_MONTH);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_G_DAY);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_G_MONTH_DAY);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_NAME);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_QNAME);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_NCNAME);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_ANY_URI);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_ID);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_IDREF);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_IDREFS);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_ENTITY);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_ENTITIES);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_NOTATION);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_NMTOKEN);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_NMTOKENS);
+ _validTypes.add(SOAPConstants.QNAME_TYPE_BASE64);
+ // New types 12/3/02
+ _validTypes.add(SchemaConstants.QNAME_TYPE_LANGUAGE);
+
+ // add all SOAP encoding elements
+ _validElements = new HashSet();
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_STRING);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_NORMALIZED_STRING);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_TOKEN);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_BYTE);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_UNSIGNED_BYTE);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_BASE64_BINARY);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_HEX_BINARY);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_INTEGER);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_POSITIVE_INTEGER);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_NEGATIVE_INTEGER);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_NON_NEGATIVE_INTEGER);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_NON_POSITIVE_INTEGER);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_INT);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_UNSIGNED_INT);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_LONG);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_UNSIGNED_LONG);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_SHORT);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_UNSIGNED_SHORT);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_DECIMAL);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_FLOAT);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_DOUBLE);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_BOOLEAN);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_TIME);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_DATE_TIME);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_DURATION);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_DATE);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_G_MONTH);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_G_YEAR);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_G_YEAR_MONTH);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_G_DAY);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_G_MONTH_DAY);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_NAME);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_QNAME);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_NCNAME);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_ANY_URI);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_ID);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_IDREF);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_IDREFS);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_ENTITY);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_ENTITIES);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_NOTATION);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_NMTOKEN);
+ _validElements.add(SOAPConstants.QNAME_ELEMENT_NMTOKENS);
+
+ _validAttributes = new HashSet();
+ _validAttributes.add(SOAPConstants.QNAME_ATTR_ARRAY_TYPE);
+ _validAttributes.add(SOAPConstants.QNAME_ATTR_OFFSET);
+ _validAttributes.add(SOAPConstants.QNAME_ATTR_POSITION);
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/SOAPEntityReferenceValidator.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/SOAPExtensionHandler.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/SOAPExtensionHandler.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/SOAPExtensionHandler.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,611 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.parser;
+
+import java.io.IOException;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.util.xml.XmlUtil;
+import org.jboss.com.sun.tools.ws.wsdl.document.soap.SOAPAddress;
+import org.jboss.com.sun.tools.ws.wsdl.document.soap.SOAPBinding;
+import org.jboss.com.sun.tools.ws.wsdl.document.soap.SOAPBody;
+import org.jboss.com.sun.tools.ws.wsdl.document.soap.SOAPConstants;
+import org.jboss.com.sun.tools.ws.wsdl.document.soap.SOAPFault;
+import org.jboss.com.sun.tools.ws.wsdl.document.soap.SOAPHeader;
+import org.jboss.com.sun.tools.ws.wsdl.document.soap.SOAPHeaderFault;
+import org.jboss.com.sun.tools.ws.wsdl.document.soap.SOAPOperation;
+import org.jboss.com.sun.tools.ws.wsdl.document.soap.SOAPStyle;
+import org.jboss.com.sun.tools.ws.wsdl.document.soap.SOAPUse;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extensible;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extension;
+import org.jboss.com.sun.tools.ws.wsdl.framework.ParserContext;
+import org.jboss.com.sun.tools.ws.wsdl.framework.WriterContext;
+import org.w3c.dom.Element;
+
+
+/**
+ * The SOAP extension handler for WSDL.
+ *
+ * @author WS Development Team
+ */
+public class SOAPExtensionHandler extends ExtensionHandlerBase {
+
+ public SOAPExtensionHandler() {
+ }
+
+ public String getNamespaceURI() {
+ return Constants.NS_WSDL_SOAP;
+ }
+
+ protected boolean handleDefinitionsExtension(
+ ParserContext context,
+ Extensible parent,
+ Element e) {
+ Util.fail(
+ "parsing.invalidExtensionElement",
+ e.getTagName(),
+ e.getNamespaceURI());
+ return false; // keep compiler happy
+ }
+
+ protected boolean handleTypesExtension(
+ ParserContext context,
+ Extensible parent,
+ Element e) {
+ Util.fail(
+ "parsing.invalidExtensionElement",
+ e.getTagName(),
+ e.getNamespaceURI());
+ return false; // keep compiler happy
+ }
+
+ protected SOAPBinding getSOAPBinding(){
+ return new SOAPBinding();
+ }
+
+ protected boolean handleBindingExtension(
+ ParserContext context,
+ Extensible parent,
+ Element e) {
+ if (XmlUtil.matchesTagNS(e, getBindingQName())) {
+ context.push();
+ context.registerNamespaces(e);
+
+ SOAPBinding binding = getSOAPBinding();
+
+ // NOTE - the "transport" attribute is required according to
section 3.3 of the WSDL 1.1 spec,
+ // but optional according to the schema in appendix A 4.2 of the same
document!
+ String transport =
+ Util.getRequiredAttribute(e, Constants.ATTR_TRANSPORT);
+ binding.setTransport(transport);
+
+ String style = XmlUtil.getAttributeOrNull(e, Constants.ATTR_STYLE);
+ if (style != null) {
+ if (style.equals(Constants.ATTRVALUE_RPC)) {
+ binding.setStyle(SOAPStyle.RPC);
+ } else if (style.equals(Constants.ATTRVALUE_DOCUMENT)) {
+ binding.setStyle(SOAPStyle.DOCUMENT);
+ } else {
+ Util.fail(
+ "parsing.invalidAttributeValue",
+ Constants.ATTR_STYLE,
+ style);
+ }
+ }
+ parent.addExtension(binding);
+ context.pop();
+ context.fireDoneParsingEntity(getBindingQName(), binding);
+ return true;
+ } else {
+ Util.fail(
+ "parsing.invalidExtensionElement",
+ e.getTagName(),
+ e.getNamespaceURI());
+ return false; // keep compiler happy
+ }
+ }
+
+ protected boolean handleOperationExtension(
+ ParserContext context,
+ Extensible parent,
+ Element e) {
+ if (XmlUtil.matchesTagNS(e, getOperationQName())) {
+ context.push();
+ context.registerNamespaces(e);
+
+ SOAPOperation operation = new SOAPOperation();
+
+ String soapAction =
+ XmlUtil.getAttributeOrNull(e, Constants.ATTR_SOAP_ACTION);
+ if (soapAction != null) {
+ operation.setSOAPAction(soapAction);
+ }
+
+ String style = XmlUtil.getAttributeOrNull(e, Constants.ATTR_STYLE);
+ if (style != null) {
+ if (style.equals(Constants.ATTRVALUE_RPC)) {
+ operation.setStyle(SOAPStyle.RPC);
+ } else if (style.equals(Constants.ATTRVALUE_DOCUMENT)) {
+ operation.setStyle(SOAPStyle.DOCUMENT);
+ } else {
+ Util.fail(
+ "parsing.invalidAttributeValue",
+ Constants.ATTR_STYLE,
+ style);
+ }
+ }
+ parent.addExtension(operation);
+ context.pop();
+ context.fireDoneParsingEntity(
+ getOperationQName(),
+ operation);
+ return true;
+ } else {
+ Util.fail(
+ "parsing.invalidExtensionElement",
+ e.getTagName(),
+ e.getNamespaceURI());
+ return false; // keep compiler happy
+ }
+ }
+
+ protected boolean handleInputExtension(
+ ParserContext context,
+ Extensible parent,
+ Element e) {
+ return handleInputOutputExtension(context, parent, e);
+ }
+ protected boolean handleOutputExtension(
+ ParserContext context,
+ Extensible parent,
+ Element e) {
+ return handleInputOutputExtension(context, parent, e);
+ }
+
+ protected boolean handleMIMEPartExtension(
+ ParserContext context,
+ Extensible parent,
+ Element e) {
+ return handleInputOutputExtension(context, parent, e);
+ }
+
+ protected boolean handleInputOutputExtension(
+ ParserContext context,
+ Extensible parent,
+ Element e) {
+ if (XmlUtil.matchesTagNS(e, getBodyQName())) {
+ context.push();
+ context.registerNamespaces(e);
+
+ SOAPBody body = new SOAPBody();
+
+ String use = XmlUtil.getAttributeOrNull(e, Constants.ATTR_USE);
+ if (use != null) {
+ if (use.equals(Constants.ATTRVALUE_LITERAL)) {
+ body.setUse(SOAPUse.LITERAL);
+ } else if (use.equals(Constants.ATTRVALUE_ENCODED)) {
+ body.setUse(SOAPUse.ENCODED);
+ } else {
+ Util.fail(
+ "parsing.invalidAttributeValue",
+ Constants.ATTR_USE,
+ use);
+ }
+ }
+
+ String namespace =
+ XmlUtil.getAttributeOrNull(e, Constants.ATTR_NAMESPACE);
+ if (namespace != null) {
+ body.setNamespace(namespace);
+ }
+
+ String encodingStyle =
+ XmlUtil.getAttributeOrNull(e, Constants.ATTR_ENCODING_STYLE);
+ if (encodingStyle != null) {
+ body.setEncodingStyle(encodingStyle);
+ }
+
+ String parts = XmlUtil.getAttributeOrNull(e, Constants.ATTR_PARTS);
+ if (parts != null) {
+ body.setParts(parts);
+ }
+
+ parent.addExtension(body);
+ context.pop();
+ context.fireDoneParsingEntity(getBodyQName(), body);
+ return true;
+ } else if (XmlUtil.matchesTagNS(e, getHeaderQName())) {
+ context.push();
+ context.registerNamespaces(e);
+
+ SOAPHeader header = new SOAPHeader();
+
+ String use = XmlUtil.getAttributeOrNull(e, Constants.ATTR_USE);
+ if (use != null) {
+ if (use.equals(Constants.ATTRVALUE_LITERAL)) {
+ header.setUse(SOAPUse.LITERAL);
+ } else if (use.equals(Constants.ATTRVALUE_ENCODED)) {
+ header.setUse(SOAPUse.ENCODED);
+ } else {
+ Util.fail(
+ "parsing.invalidAttributeValue",
+ Constants.ATTR_USE,
+ use);
+ }
+ }
+
+ String namespace =
+ XmlUtil.getAttributeOrNull(e, Constants.ATTR_NAMESPACE);
+ if (namespace != null) {
+ header.setNamespace(namespace);
+ }
+
+ String encodingStyle =
+ XmlUtil.getAttributeOrNull(e, Constants.ATTR_ENCODING_STYLE);
+ if (encodingStyle != null) {
+ header.setEncodingStyle(encodingStyle);
+ }
+
+ String part = XmlUtil.getAttributeOrNull(e, Constants.ATTR_PART);
+ if (part != null) {
+ header.setPart(part);
+ }
+
+ String messageAttr =
+ XmlUtil.getAttributeOrNull(e, Constants.ATTR_MESSAGE);
+ if (messageAttr != null) {
+ header.setMessage(context.translateQualifiedName(messageAttr));
+ }
+
+ for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) {
+ Element e2 = Util.nextElement(iter);
+ if (e2 == null)
+ break;
+
+ if (XmlUtil
+ .matchesTagNS(e2, getHeaderfaultQName())) {
+ context.push();
+ context.registerNamespaces(e);
+
+ SOAPHeaderFault headerfault = new SOAPHeaderFault();
+
+ String use2 =
+ XmlUtil.getAttributeOrNull(e2, Constants.ATTR_USE);
+ if (use2 != null) {
+ if (use2.equals(Constants.ATTRVALUE_LITERAL)) {
+ headerfault.setUse(SOAPUse.LITERAL);
+ } else if (use.equals(Constants.ATTRVALUE_ENCODED)) {
+ headerfault.setUse(SOAPUse.ENCODED);
+ } else {
+ Util.fail(
+ "parsing.invalidAttributeValue",
+ Constants.ATTR_USE,
+ use2);
+ }
+ }
+
+ String namespace2 =
+ XmlUtil.getAttributeOrNull(
+ e2,
+ Constants.ATTR_NAMESPACE);
+ if (namespace2 != null) {
+ headerfault.setNamespace(namespace2);
+ }
+
+ String encodingStyle2 =
+ XmlUtil.getAttributeOrNull(
+ e2,
+ Constants.ATTR_ENCODING_STYLE);
+ if (encodingStyle2 != null) {
+ headerfault.setEncodingStyle(encodingStyle2);
+ }
+
+ String part2 =
+ XmlUtil.getAttributeOrNull(e2, Constants.ATTR_PART);
+ if (part2 != null) {
+ headerfault.setPart(part2);
+ }
+
+ String messageAttr2 =
+ XmlUtil.getAttributeOrNull(e2, Constants.ATTR_MESSAGE);
+ if (messageAttr2 != null) {
+ headerfault.setMessage(
+ context.translateQualifiedName(messageAttr2));
+ }
+
+ header.add(headerfault);
+ context.pop();
+ } else {
+ Util.fail(
+ "parsing.invalidElement",
+ e2.getTagName(),
+ e2.getNamespaceURI());
+ }
+ }
+
+ parent.addExtension(header);
+ context.pop();
+ context.fireDoneParsingEntity(getHeaderQName(), header);
+ return true;
+ } else {
+ Util.fail(
+ "parsing.invalidExtensionElement",
+ e.getTagName(),
+ e.getNamespaceURI());
+ return false; // keep compiler happy
+ }
+ }
+
+ protected boolean handleFaultExtension(
+ ParserContext context,
+ Extensible parent,
+ Element e) {
+ if (XmlUtil.matchesTagNS(e, getFaultQName())) {
+ context.push();
+ context.registerNamespaces(e);
+
+ SOAPFault fault = new SOAPFault();
+
+ String name = XmlUtil.getAttributeOrNull(e, Constants.ATTR_NAME);
+ if (name != null) {
+ fault.setName(name);
+ }
+
+ String use = XmlUtil.getAttributeOrNull(e, Constants.ATTR_USE);
+ if (use != null) {
+ if (use.equals(Constants.ATTRVALUE_LITERAL)) {
+ fault.setUse(SOAPUse.LITERAL);
+ } else if (use.equals(Constants.ATTRVALUE_ENCODED)) {
+ fault.setUse(SOAPUse.ENCODED);
+ } else {
+ Util.fail(
+ "parsing.invalidAttributeValue",
+ Constants.ATTR_USE,
+ use);
+ }
+ }
+
+ String namespace =
+ XmlUtil.getAttributeOrNull(e, Constants.ATTR_NAMESPACE);
+ if (namespace != null) {
+ fault.setNamespace(namespace);
+ }
+
+ String encodingStyle =
+ XmlUtil.getAttributeOrNull(e, Constants.ATTR_ENCODING_STYLE);
+ if (encodingStyle != null) {
+ fault.setEncodingStyle(encodingStyle);
+ }
+
+ parent.addExtension(fault);
+ context.pop();
+ context.fireDoneParsingEntity(getFaultQName(), fault);
+ return true;
+ } else {
+ Util.fail(
+ "parsing.invalidExtensionElement",
+ e.getTagName(),
+ e.getNamespaceURI());
+ return false; // keep compiler happy
+ }
+ }
+
+ protected boolean handleServiceExtension(
+ ParserContext context,
+ Extensible parent,
+ Element e) {
+ Util.fail(
+ "parsing.invalidExtensionElement",
+ e.getTagName(),
+ e.getNamespaceURI());
+ return false; // keep compiler happy
+ }
+
+ protected boolean handlePortExtension(
+ ParserContext context,
+ Extensible parent,
+ Element e) {
+ if (XmlUtil.matchesTagNS(e, getAddressQName())) {
+ context.push();
+ context.registerNamespaces(e);
+
+ SOAPAddress address = new SOAPAddress();
+
+ String location =
+ Util.getRequiredAttribute(e, Constants.ATTR_LOCATION);
+ address.setLocation(location);
+
+ parent.addExtension(address);
+ context.pop();
+ context.fireDoneParsingEntity(getAddressQName(), address);
+ return true;
+ } else {
+ Util.fail(
+ "parsing.invalidExtensionElement",
+ e.getTagName(),
+ e.getNamespaceURI());
+ return false; // keep compiler happy
+ }
+ }
+
+ public void doHandleExtension(WriterContext context, Extension extension)
+ throws IOException {
+ // NOTE - this ugliness can be avoided by moving all the XML parsing/writing
code
+ // into the document classes themselves
+ if (extension instanceof SOAPAddress) {
+ SOAPAddress address = (SOAPAddress) extension;
+ context.writeStartTag(address.getElementName());
+ context.writeAttribute(
+ Constants.ATTR_LOCATION,
+ address.getLocation());
+ context.writeEndTag(address.getElementName());
+ } else if (extension instanceof SOAPBinding) {
+ SOAPBinding binding = (SOAPBinding) extension;
+ context.writeStartTag(binding.getElementName());
+ context.writeAttribute(
+ Constants.ATTR_TRANSPORT,
+ binding.getTransport());
+ String style =
+ (binding.getStyle() == null
+ ? null
+ : (binding.getStyle() == SOAPStyle.DOCUMENT
+ ? Constants.ATTRVALUE_DOCUMENT
+ : Constants.ATTRVALUE_RPC));
+ context.writeAttribute(Constants.ATTR_STYLE, style);
+ context.writeEndTag(binding.getElementName());
+ } else if (extension instanceof SOAPBody) {
+ SOAPBody body = (SOAPBody) extension;
+ context.writeStartTag(body.getElementName());
+ context.writeAttribute(
+ Constants.ATTR_ENCODING_STYLE,
+ body.getEncodingStyle());
+ context.writeAttribute(Constants.ATTR_PARTS, body.getParts());
+ String use =
+ (body.getUse() == null
+ ? null
+ : (body.getUse() == SOAPUse.LITERAL
+ ? Constants.ATTRVALUE_LITERAL
+ : Constants.ATTRVALUE_ENCODED));
+ context.writeAttribute(Constants.ATTR_USE, use);
+ context.writeAttribute(
+ Constants.ATTR_NAMESPACE,
+ body.getNamespace());
+ context.writeEndTag(body.getElementName());
+ } else if (extension instanceof SOAPFault) {
+ SOAPFault fault = (SOAPFault) extension;
+ context.writeStartTag(fault.getElementName());
+ context.writeAttribute(Constants.ATTR_NAME, fault.getName());
+ context.writeAttribute(
+ Constants.ATTR_ENCODING_STYLE,
+ fault.getEncodingStyle());
+ String use =
+ (fault.getUse() == null
+ ? null
+ : (fault.getUse() == SOAPUse.LITERAL
+ ? Constants.ATTRVALUE_LITERAL
+ : Constants.ATTRVALUE_ENCODED));
+ context.writeAttribute(Constants.ATTR_USE, use);
+ context.writeAttribute(
+ Constants.ATTR_NAMESPACE,
+ fault.getNamespace());
+ context.writeEndTag(fault.getElementName());
+ } else if (extension instanceof SOAPHeader) {
+ SOAPHeader header = (SOAPHeader) extension;
+ context.writeStartTag(header.getElementName());
+ context.writeAttribute(Constants.ATTR_MESSAGE, header.getMessage());
+ context.writeAttribute(Constants.ATTR_PART, header.getPart());
+ context.writeAttribute(
+ Constants.ATTR_ENCODING_STYLE,
+ header.getEncodingStyle());
+ String use =
+ (header.getUse() == null
+ ? null
+ : (header.getUse() == SOAPUse.LITERAL
+ ? Constants.ATTRVALUE_LITERAL
+ : Constants.ATTRVALUE_ENCODED));
+ context.writeAttribute(Constants.ATTR_USE, use);
+ context.writeAttribute(
+ Constants.ATTR_NAMESPACE,
+ header.getNamespace());
+ context.writeEndTag(header.getElementName());
+ } else if (extension instanceof SOAPHeaderFault) {
+ SOAPHeaderFault headerfault = (SOAPHeaderFault) extension;
+ context.writeStartTag(headerfault.getElementName());
+ context.writeAttribute(
+ Constants.ATTR_MESSAGE,
+ headerfault.getMessage());
+ context.writeAttribute(Constants.ATTR_PART, headerfault.getPart());
+ context.writeAttribute(
+ Constants.ATTR_ENCODING_STYLE,
+ headerfault.getEncodingStyle());
+ String use =
+ (headerfault.getUse() == null
+ ? null
+ : (headerfault.getUse() == SOAPUse.LITERAL
+ ? Constants.ATTRVALUE_LITERAL
+ : Constants.ATTRVALUE_ENCODED));
+ context.writeAttribute(Constants.ATTR_USE, use);
+ context.writeAttribute(
+ Constants.ATTR_NAMESPACE,
+ headerfault.getNamespace());
+ context.writeEndTag(headerfault.getElementName());
+ } else if (extension instanceof SOAPOperation) {
+ SOAPOperation operation = (SOAPOperation) extension;
+ context.writeStartTag(operation.getElementName());
+ context.writeAttribute(
+ Constants.ATTR_SOAP_ACTION,
+ operation.getSOAPAction());
+ String style =
+ (operation.getStyle() == null
+ ? null
+ : (operation.isDocument()
+ ? Constants.ATTRVALUE_DOCUMENT
+ : Constants.ATTRVALUE_RPC));
+ context.writeAttribute(Constants.ATTR_STYLE, style);
+ context.writeEndTag(operation.getElementName());
+ } else {
+ throw new IllegalArgumentException();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see ExtensionHandlerBase#handlePortTypeExtension(ParserContext, Extensible,
org.w3c.dom.Element)
+ */
+ protected boolean handlePortTypeExtension(ParserContext context, Extensible parent,
Element e) {
+ Util.fail(
+ "parsing.invalidExtensionElement",
+ e.getTagName(),
+ e.getNamespaceURI());
+ return false; // keep compiler happy
+ }
+
+ protected QName getBodyQName(){
+ return SOAPConstants.QNAME_BODY;
+ }
+
+ protected QName getHeaderQName(){
+ return SOAPConstants.QNAME_HEADER;
+ }
+
+ protected QName getHeaderfaultQName(){
+ return SOAPConstants.QNAME_HEADERFAULT;
+ }
+
+ protected QName getOperationQName(){
+ return SOAPConstants.QNAME_OPERATION;
+ }
+
+ protected QName getFaultQName(){
+ return SOAPConstants.QNAME_FAULT;
+ }
+
+ protected QName getAddressQName(){
+ return SOAPConstants.QNAME_ADDRESS;
+ }
+
+ protected QName getBindingQName(){
+ return SOAPConstants.QNAME_BINDING;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/SOAPExtensionHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/SchemaExtensionHandler.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/SchemaExtensionHandler.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/SchemaExtensionHandler.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,74 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.parser;
+
+import java.io.IOException;
+
+import org.jboss.com.sun.tools.ws.util.xml.XmlUtil;
+import org.jboss.com.sun.tools.ws.wsdl.document.schema.Schema;
+import org.jboss.com.sun.tools.ws.wsdl.document.schema.SchemaConstants;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extensible;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extension;
+import org.jboss.com.sun.tools.ws.wsdl.framework.ParserContext;
+import org.jboss.com.sun.tools.ws.wsdl.framework.WriterContext;
+import org.w3c.dom.Element;
+
+
+/**
+ * The XML Schema extension handler for WSDL.
+ *
+ * @author WS Development Team
+ */
+public class SchemaExtensionHandler extends ExtensionHandler {
+
+ public SchemaExtensionHandler() {
+ }
+
+ public String getNamespaceURI() {
+ return Constants.NS_XSD;
+ }
+
+ public boolean doHandleExtension(
+ ParserContext context,
+ Extensible parent,
+ Element e) {
+ if (XmlUtil.matchesTagNS(e, SchemaConstants.QNAME_SCHEMA)) {
+ SchemaParser parser = new SchemaParser();
+ parent.addExtension(parser.parseSchema(context, e, null));
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public void doHandleExtension(WriterContext context, Extension extension)
+ throws IOException {
+ if (extension instanceof Schema) {
+ SchemaWriter writer = new SchemaWriter();
+ writer.writeSchema(context, (Schema) extension);
+ } else {
+ // unknown extension
+ throw new IllegalArgumentException();
+ }
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/SchemaExtensionHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/SchemaParser.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/SchemaParser.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/SchemaParser.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,350 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.parser;
+
+import java.io.IOException;
+import java.util.Iterator;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.FactoryConfigurationError;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.jboss.com.sun.tools.ws.util.xml.NullEntityResolver;
+import org.jboss.com.sun.tools.ws.wsdl.document.schema.Schema;
+import org.jboss.com.sun.tools.ws.wsdl.document.schema.SchemaAttribute;
+import org.jboss.com.sun.tools.ws.wsdl.document.schema.SchemaConstants;
+import org.jboss.com.sun.tools.ws.wsdl.document.schema.SchemaDocument;
+import org.jboss.com.sun.tools.ws.wsdl.document.schema.SchemaElement;
+import org.jboss.com.sun.tools.ws.wsdl.framework.ParseException;
+import org.jboss.com.sun.tools.ws.wsdl.framework.ParserContext;
+import org.jboss.com.sun.tools.ws.wsdl.framework.ValidationException;
+import org.jboss.com.sun.xml.ws.util.xml.NamedNodeMapIterator;
+import org.jboss.com.sun.xml.ws.util.xml.XmlUtil;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+
+/**
+ * A parser for XML Schema, including the fragments found inside a WSDL document.
+ *
+ * @author WS Development Team
+ */
+public class SchemaParser {
+
+ public SchemaParser() {
+ }
+
+ public boolean getFollowImports() {
+ return _followImports;
+ }
+
+ public void setFollowImports(boolean b) {
+ _followImports = b;
+ }
+
+ public SchemaDocument parse(InputSource source) {
+ SchemaDocument schemaDocument = new SchemaDocument();
+ schemaDocument.setSystemId(source.getSystemId());
+ ParserContext context = new ParserContext(schemaDocument, null);
+ context.setFollowImports(_followImports);
+ schemaDocument.setSchema(parseSchema(context, source, null));
+ return schemaDocument;
+ }
+
+ public Schema parseSchema(
+ ParserContext context,
+ InputSource source,
+ String expectedTargetNamespaceURI) {
+ Schema schema =
+ parseSchemaNoImport(context, source, expectedTargetNamespaceURI);
+ schema.defineAllEntities();
+ processImports(context, source, schema);
+ return schema;
+ }
+
+ public Schema parseSchema(
+ ParserContext context,
+ Element e,
+ String expectedTargetNamespaceURI) {
+ Schema schema =
+ parseSchemaNoImport(context, e, expectedTargetNamespaceURI);
+ schema.defineAllEntities();
+ processImports(context, null, schema);
+ return schema;
+ }
+
+ protected void processImports(
+ ParserContext context,
+ InputSource source,
+ Schema schema) {
+ for (Iterator iter = schema.getContent().children(); iter.hasNext();) {
+ SchemaElement child = (SchemaElement) iter.next();
+ if (child.getQName().equals(SchemaConstants.QNAME_IMPORT)) {
+ String location =
+ child.getValueOfAttributeOrNull(
+ Constants.ATTR_SCHEMA_LOCATION);
+ String namespace =
+ child.getValueOfAttributeOrNull(Constants.ATTR_NAMESPACE);
+ //bug fix: 4857762, add adjustedLocation to teh importDocuments and
ignore if it
+ //exists, to avoid duplicates
+ if (location != null) {
+ String adjustedLocation = null;
+ if (source != null && source.getSystemId() != null) {
+ adjustedLocation =
+ Util.processSystemIdWithBase(
+ source.getSystemId(),
+ location);
+ }
+ //bug fix: 4856674
+ if (adjustedLocation == null) {
+ adjustedLocation =
+ context.getWSDLLocation() == null
+ ? location
+ : Util.processSystemIdWithBase(
+ context.getWSDLLocation(),
+ location);
+ }
+ if (!context
+ .getDocument()
+ .isImportedDocument(adjustedLocation)) {
+ context.getDocument().addImportedEntity(
+ parseSchema(
+ context,
+ new InputSource(adjustedLocation),
+ namespace));
+ context.getDocument().addImportedDocument(
+ adjustedLocation);
+ }
+ }
+ } else if (
+ child.getQName().equals(SchemaConstants.QNAME_INCLUDE)
+ && (schema.getTargetNamespaceURI() != null)) {
+ String location =
+ child.getValueOfAttributeOrNull(
+ Constants.ATTR_SCHEMA_LOCATION);
+ if (location != null
+ && !context.getDocument().isIncludedDocument(location)) {
+ context.getDocument().addIncludedDocument(location);
+ String adjustedLocation = null;
+ if (source != null && source.getSystemId() != null) {
+ adjustedLocation =
+ Util.processSystemIdWithBase(
+ source.getSystemId(),
+ location);
+ }
+ if (adjustedLocation == null) {
+ adjustedLocation =
+ context.getDocument().getSystemId() == null
+ ? location
+ : Util.processSystemIdWithBase(
+ context.getDocument().getSystemId(),
+ location);
+ }
+ context.getDocument().addIncludedEntity(
+ parseSchema(
+ context,
+ new InputSource(adjustedLocation),
+ schema.getTargetNamespaceURI()));
+ }
+ } else if (
+ child.getQName().equals(SchemaConstants.QNAME_REDEFINE)) {
+ // not supported
+ Util.fail("validation.unsupportedSchemaFeature",
"redefine");
+ }
+ }
+ }
+
+ protected Schema parseSchemaNoImport(
+ ParserContext context,
+ InputSource source,
+ String expectedTargetNamespaceURI) {
+ try {
+ DocumentBuilderFactory builderFactory =
+ DocumentBuilderFactory.newInstance();
+ builderFactory.setNamespaceAware(true);
+ builderFactory.setValidating(false);
+ DocumentBuilder builder = builderFactory.newDocumentBuilder();
+ builder.setErrorHandler(new ErrorHandler() {
+ public void error(SAXParseException e)
+ throws SAXParseException {
+ throw e;
+ }
+ public void fatalError(SAXParseException e)
+ throws SAXParseException {
+ throw e;
+ }
+ public void warning(SAXParseException err)
+ throws SAXParseException {
+ // do nothing
+ }
+ });
+ builder.setEntityResolver(new NullEntityResolver());
+
+ try {
+ Document document = builder.parse(source);
+ return parseSchemaNoImport(
+ context,
+ document,
+ expectedTargetNamespaceURI);
+ } catch (IOException e) {
+ throw new ParseException(
+ "parsing.ioException",e);
+ } catch (SAXException e) {
+ throw new ParseException(
+ "parsing.saxException",e);
+ }
+ } catch (ParserConfigurationException e) {
+ throw new ParseException(
+ "parsing.parserConfigException",e);
+ } catch (FactoryConfigurationError e) {
+ throw new ParseException(
+ "parsing.factoryConfigException",e);
+ }
+ }
+
+ protected Schema parseSchemaNoImport(
+ ParserContext context,
+ Document doc,
+ String expectedTargetNamespaceURI) {
+ Element root = doc.getDocumentElement();
+ Util.verifyTagNSRootElement(root, SchemaConstants.QNAME_SCHEMA);
+ return parseSchemaNoImport(context, root, expectedTargetNamespaceURI);
+ }
+
+ protected Schema parseSchemaNoImport(
+ ParserContext context,
+ Element e,
+ String expectedTargetNamespaceURI) {
+ Schema schema = new Schema(context.getDocument());
+ String targetNamespaceURI =
+ XmlUtil.getAttributeOrNull(e, Constants.ATTR_TARGET_NAMESPACE);
+ //bug 4849754 fix, in both the case of xsd:include and xsd:import this should
work
+ if (targetNamespaceURI != null
+ && expectedTargetNamespaceURI != null
+ && !expectedTargetNamespaceURI.equals(targetNamespaceURI)) {
+ throw new ValidationException(
+ "validation.incorrectTargetNamespace",
+ new Object[] {
+ targetNamespaceURI,
+ expectedTargetNamespaceURI });
+ }
+ if (targetNamespaceURI == null)
+ schema.setTargetNamespaceURI(expectedTargetNamespaceURI);
+ else
+ schema.setTargetNamespaceURI(targetNamespaceURI);
+
+ // snapshot the current prefixes
+ for (Iterator iter = context.getPrefixes(); iter.hasNext();) {
+ String prefix = (String) iter.next();
+ String nsURI = context.getNamespaceURI(prefix);
+ if (nsURI == null) {
+ // should not happen
+ throw new ParseException("parsing.shouldNotHappen");
+ }
+ schema.addPrefix(prefix, nsURI);
+ }
+
+ context.push();
+ context.registerNamespaces(e);
+
+ // just internalize the XML fragment
+ SchemaElement schemaElement =
+ new SchemaElement(SchemaConstants.QNAME_SCHEMA);
+
+ copyNamespaceDeclarations(schemaElement, e);
+ copyAttributesNoNs(schemaElement, e);
+ copyElementContent(schemaElement, e);
+
+ schema.setContent(schemaElement);
+ schemaElement.setSchema(schema);
+
+ context.pop();
+ context.fireDoneParsingEntity(SchemaConstants.QNAME_SCHEMA, schema);
+ return schema;
+ }
+
+ protected void copyAttributesNoNs(SchemaElement target, Element source) {
+ for (Iterator iter = new NamedNodeMapIterator(source.getAttributes());
+ iter.hasNext();
+ ) {
+ Attr attr = (Attr) iter.next();
+ if (attr.getName().equals(PREFIX_XMLNS)
+ || attr.getName().startsWith(PREFIX_XMLNS_COLON)) {
+ continue;
+ }
+
+ SchemaAttribute attribute =
+ new SchemaAttribute(attr.getLocalName());
+ attribute.setNamespaceURI(attr.getNamespaceURI());
+ attribute.setValue(attr.getValue());
+ target.addAttribute(attribute);
+ }
+ }
+
+ protected void copyNamespaceDeclarations(
+ SchemaElement target,
+ Element source) {
+ for (Iterator iter = new NamedNodeMapIterator(source.getAttributes());
+ iter.hasNext();
+ ) {
+ Attr attr = (Attr) iter.next();
+ if (attr.getName().equals(PREFIX_XMLNS)) {
+ // default namespace declaration
+ target.addPrefix("", attr.getValue());
+ } else {
+ String prefix = XmlUtil.getPrefix(attr.getName());
+ if (prefix != null && prefix.equals(PREFIX_XMLNS)) {
+ String nsPrefix = XmlUtil.getLocalPart(attr.getName());
+ String uri = attr.getValue();
+ target.addPrefix(nsPrefix, uri);
+ }
+ }
+ }
+ }
+
+ protected void copyElementContent(SchemaElement target, Element source) {
+ for (Iterator iter = XmlUtil.getAllChildren(source); iter.hasNext();) {
+ Element e2 = Util.nextElementIgnoringCharacterContent(iter);
+ if (e2 == null)
+ break;
+ SchemaElement newElement = new SchemaElement(e2.getLocalName());
+ newElement.setNamespaceURI(e2.getNamespaceURI());
+ copyNamespaceDeclarations(newElement, e2);
+ copyAttributesNoNs(newElement, e2);
+ copyElementContent(newElement, e2);
+ target.addChild(newElement);
+ newElement.setParent(target);
+ }
+ }
+
+ private boolean _followImports;
+
+ private final static String PREFIX_XMLNS = "xmlns";
+ private final static String PREFIX_XMLNS_COLON = "xmlns:";
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/SchemaParser.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/SchemaWriter.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/SchemaWriter.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/SchemaWriter.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,156 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.parser;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.document.schema.Schema;
+import org.jboss.com.sun.tools.ws.wsdl.document.schema.SchemaAttribute;
+import org.jboss.com.sun.tools.ws.wsdl.document.schema.SchemaDocument;
+import org.jboss.com.sun.tools.ws.wsdl.document.schema.SchemaElement;
+import org.jboss.com.sun.tools.ws.wsdl.framework.WriterContext;
+
+
+/**
+ * A writer for XML Schema fragments within a WSDL document.
+ *
+ * @author WS Development Team
+ */
+public class SchemaWriter {
+
+ public SchemaWriter() {
+ }
+
+ public void write(SchemaDocument document, OutputStream os)
+ throws IOException {
+ WriterContext context = new WriterContext(os);
+ writeSchema(context, document.getSchema());
+ context.flush();
+ }
+
+ public void writeSchema(WriterContext context, Schema schema)
+ throws IOException {
+ context.push();
+ try {
+ writeTopSchemaElement(context, schema);
+ } catch (Exception e) {
+ } finally {
+ context.pop();
+ }
+ }
+
+ protected void writeTopSchemaElement(WriterContext context, Schema schema)
+ throws IOException {
+ SchemaElement schemaElement = schema.getContent();
+ QName name = schemaElement.getQName();
+
+ // make sure that all namespaces we expect are actually declared
+ for (Iterator iter = schema.prefixes(); iter.hasNext();) {
+ String prefix = (String) iter.next();
+ String expectedURI = schema.getURIForPrefix(prefix);
+ if (!expectedURI.equals(context.getNamespaceURI(prefix))) {
+ context.declarePrefix(prefix, expectedURI);
+ }
+ }
+
+ for (Iterator iter = schemaElement.prefixes(); iter.hasNext();) {
+ String prefix = (String) iter.next();
+ String uri = schemaElement.getURIForPrefix(prefix);
+ context.declarePrefix(prefix, uri);
+ }
+
+ context.writeStartTag(name);
+
+ for (Iterator iter = schemaElement.attributes(); iter.hasNext();) {
+ SchemaAttribute attribute = (SchemaAttribute) iter.next();
+ if (attribute.getNamespaceURI() == null) {
+ context.writeAttribute(
+ attribute.getLocalName(),
+ attribute.getValue(context));
+ } else {
+ context.writeAttribute(
+ context.getQNameString(attribute.getQName()),
+ attribute.getValue(context));
+ }
+ }
+
+ context.writeAllPendingNamespaceDeclarations();
+
+ for (Iterator iter = schemaElement.children(); iter.hasNext();) {
+ SchemaElement child = (SchemaElement) iter.next();
+ writeSchemaElement(context, child);
+ }
+
+ context.writeEndTag(name);
+ }
+
+ protected void writeSchemaElement(
+ WriterContext context,
+ SchemaElement schemaElement)
+ throws IOException {
+ QName name = schemaElement.getQName();
+
+ if (schemaElement.declaresPrefixes()) {
+ context.push();
+ }
+
+ context.writeStartTag(name);
+
+ if (schemaElement.declaresPrefixes()) {
+ for (Iterator iter = schemaElement.prefixes(); iter.hasNext();) {
+ String prefix = (String) iter.next();
+ String uri = schemaElement.getURIForPrefix(prefix);
+ context.writeNamespaceDeclaration(prefix, uri);
+ context.declarePrefix(prefix, uri);
+ }
+ }
+
+ for (Iterator iter = schemaElement.attributes(); iter.hasNext();) {
+ SchemaAttribute attribute = (SchemaAttribute) iter.next();
+ if (attribute.getNamespaceURI() == null) {
+ context.writeAttribute(
+ attribute.getLocalName(),
+ attribute.getValue(context));
+ } else {
+ context.writeAttribute(
+ context.getQNameString(attribute.getQName()),
+ attribute.getValue(context));
+ }
+ }
+
+ for (Iterator iter = schemaElement.children(); iter.hasNext();) {
+ SchemaElement child = (SchemaElement) iter.next();
+ writeSchemaElement(context, child);
+ }
+
+ context.writeEndTag(name);
+
+ if (schemaElement.declaresPrefixes()) {
+ context.pop();
+ }
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/SchemaWriter.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/Util.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/Util.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/Util.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,175 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.parser;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.framework.ParseException;
+import org.jboss.com.sun.xml.ws.util.xml.XmlUtil;
+import org.w3c.dom.Comment;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.Text;
+
+
+/**2
+ * Defines various utility methods.
+ *
+ * @author WS Development Team
+ */
+public class Util {
+
+ public static String getRequiredAttribute(Element element, String name) {
+ String result = XmlUtil.getAttributeOrNull(element, name);
+ if (result == null)
+ fail(
+ "parsing.missingRequiredAttribute",
+ element.getTagName(),
+ name);
+ return result;
+ }
+
+ public static void verifyTag(Element element, String tag) {
+ if (!element.getLocalName().equals(tag))
+ fail("parsing.invalidTag", element.getTagName(), tag);
+ }
+
+ public static void verifyTagNS(Element element, String tag, String nsURI) {
+ if (!element.getLocalName().equals(tag)
+ || (element.getNamespaceURI() != null
+ && !element.getNamespaceURI().equals(nsURI)))
+ fail(
+ "parsing.invalidTagNS",
+ new Object[] {
+ element.getTagName(),
+ element.getNamespaceURI(),
+ tag,
+ nsURI });
+ }
+
+ public static void verifyTagNS(Element element, QName name) {
+ if (!element.getLocalName().equals(name.getLocalPart())
+ || (element.getNamespaceURI() != null
+ && !element.getNamespaceURI().equals(name.getNamespaceURI())))
+ fail(
+ "parsing.invalidTagNS",
+ new Object[] {
+ element.getTagName(),
+ element.getNamespaceURI(),
+ name.getLocalPart(),
+ name.getNamespaceURI()});
+ }
+
+ public static void verifyTagNSRootElement(Element element, QName name) {
+ if (!element.getLocalName().equals(name.getLocalPart())
+ || (element.getNamespaceURI() != null
+ && !element.getNamespaceURI().equals(name.getNamespaceURI())))
+ fail(
+ "parsing.incorrectRootElement",
+ new Object[] {
+ element.getTagName(),
+ element.getNamespaceURI(),
+ name.getLocalPart(),
+ name.getNamespaceURI()});
+ }
+
+ public static Element nextElementIgnoringCharacterContent(Iterator iter) {
+ while (iter.hasNext()) {
+ Node n = (Node) iter.next();
+ if (n instanceof Text)
+ continue;
+ if (n instanceof Comment)
+ continue;
+ if (!(n instanceof Element))
+ fail("parsing.elementExpected");
+ return (Element) n;
+ }
+
+ return null;
+ }
+
+ public static Element nextElement(Iterator iter) {
+ while (iter.hasNext()) {
+ Node n = (Node) iter.next();
+ if (n instanceof Text) {
+ Text t = (Text) n;
+ if (t.getData().trim().length() == 0)
+ continue;
+ fail("parsing.nonWhitespaceTextFound", t.getData().trim());
+ }
+ if (n instanceof Comment)
+ continue;
+ if (!(n instanceof Element))
+ fail("parsing.elementExpected");
+ return (Element) n;
+ }
+
+ return null;
+ }
+
+ public static String processSystemIdWithBase(
+ String baseSystemId,
+ String systemId) {
+ try {
+ URL base = null;
+ try {
+ base = new URL(baseSystemId);
+ } catch (MalformedURLException e) {
+ base = new File(baseSystemId).toURL();
+ }
+
+ try {
+ URL url = new URL(base, systemId);
+ return url.toString();
+ } catch (MalformedURLException e) {
+ fail("parsing.invalidURI", systemId);
+ }
+
+ } catch (MalformedURLException e) {
+ fail("parsing.invalidURI", baseSystemId);
+ }
+
+ return null; // keep compiler happy
+ }
+
+ public static void fail(String key) {
+ throw new ParseException(key);
+ }
+
+ public static void fail(String key, String arg) {
+ throw new ParseException(key, arg);
+ }
+
+ public static void fail(String key, String arg1, String arg2) {
+ throw new ParseException(key, new Object[] { arg1, arg2 });
+ }
+
+ public static void fail(String key, Object[] args) {
+ throw new ParseException(key, args);
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/Util.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/WSDLParser.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/WSDLParser.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/WSDLParser.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,1406 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.parser;
+
+import java.io.BufferedInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+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;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.FactoryConfigurationError;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.dom.DOMSource;
+
+import org.jboss.com.sun.tools.ws.processor.config.WSDLModelInfo;
+import org.jboss.com.sun.tools.ws.processor.util.ProcessorEnvironment;
+import org.jboss.com.sun.tools.ws.util.xml.NullEntityResolver;
+import org.jboss.com.sun.tools.ws.util.xml.XmlUtil;
+import org.jboss.com.sun.tools.ws.wsdl.document.Binding;
+import org.jboss.com.sun.tools.ws.wsdl.document.BindingFault;
+import org.jboss.com.sun.tools.ws.wsdl.document.BindingInput;
+import org.jboss.com.sun.tools.ws.wsdl.document.BindingOperation;
+import org.jboss.com.sun.tools.ws.wsdl.document.BindingOutput;
+import org.jboss.com.sun.tools.ws.wsdl.document.Definitions;
+import org.jboss.com.sun.tools.ws.wsdl.document.Documentation;
+import org.jboss.com.sun.tools.ws.wsdl.document.Fault;
+import org.jboss.com.sun.tools.ws.wsdl.document.Import;
+import org.jboss.com.sun.tools.ws.wsdl.document.Input;
+import org.jboss.com.sun.tools.ws.wsdl.document.Message;
+import org.jboss.com.sun.tools.ws.wsdl.document.MessagePart;
+import org.jboss.com.sun.tools.ws.wsdl.document.Operation;
+import org.jboss.com.sun.tools.ws.wsdl.document.OperationStyle;
+import org.jboss.com.sun.tools.ws.wsdl.document.Output;
+import org.jboss.com.sun.tools.ws.wsdl.document.Port;
+import org.jboss.com.sun.tools.ws.wsdl.document.PortType;
+import org.jboss.com.sun.tools.ws.wsdl.document.Service;
+import org.jboss.com.sun.tools.ws.wsdl.document.Types;
+import org.jboss.com.sun.tools.ws.wsdl.document.WSDLConstants;
+import org.jboss.com.sun.tools.ws.wsdl.document.WSDLDocument;
+import org.jboss.com.sun.tools.ws.wsdl.document.schema.SchemaConstants;
+import org.jboss.com.sun.tools.ws.wsdl.document.schema.SchemaKinds;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Entity;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extensible;
+import org.jboss.com.sun.tools.ws.wsdl.framework.ParseException;
+import org.jboss.com.sun.tools.ws.wsdl.framework.ParserContext;
+import org.jboss.com.sun.tools.ws.wsdl.framework.ParserListener;
+import org.jboss.com.sun.xml.ws.util.JAXWSUtils;
+import org.jboss.com.sun.xml.ws.util.localization.LocalizableMessageFactory;
+import org.jboss.com.sun.xml.ws.util.localization.Localizer;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.EntityResolver;
+
+
+/**
+ * A parser for WSDL documents.
+ *
+ * @author WS Development Team
+ */
+public class WSDLParser {
+ private WSDLModelInfo modelInfo;
+ private EntityResolver entityResolver;
+ //all the wsdl:import system Ids
+ private final Set<String> imports = new HashSet<String>();
+ //Map which holds wsdl Document(s) for a given SystemId
+ private final Map<String, Document> wsdlDocuments = new HashMap<String,
Document>();
+
+ private WSDLParser() {
+ _extensionHandlers = new HashMap();
+ hSet = new HashSet();
+
+ // register handlers for default extensions
+ register(new SOAPExtensionHandler());
+ register(new HTTPExtensionHandler());
+ register(new MIMEExtensionHandler());
+ register(new SchemaExtensionHandler());
+ register(new JAXWSBindingExtensionHandler());
+ register(new SOAP12ExtensionHandler());
+ }
+
+ public WSDLParser(WSDLModelInfo modelInfo) {
+ this();
+ assert(modelInfo != null);
+ this.modelInfo = modelInfo;
+ this.entityResolver = modelInfo.getEntityResolver();
+ }
+
+ public void register(ExtensionHandler h) {
+ _extensionHandlers.put(h.getNamespaceURI(), h);
+ h.setExtensionHandlers(_extensionHandlers);
+ }
+
+ public void unregister(ExtensionHandler h) {
+ _extensionHandlers.put(h.getNamespaceURI(), null);
+ h.setExtensionHandlers(null);
+ }
+
+ public void unregister(String uri) {
+ _extensionHandlers.put(uri, null);
+ }
+
+ public boolean getFollowImports() {
+ return _followImports;
+ }
+
+ public void setFollowImports(boolean b) {
+ _followImports = b;
+ }
+
+ public void addParserListener(ParserListener l) {
+ if (_listeners == null) {
+ _listeners = new ArrayList();
+ }
+ _listeners.add(l);
+ }
+
+ public void removeParserListener(ParserListener l) {
+ if (_listeners == null) {
+ return;
+ }
+ _listeners.remove(l);
+ }
+
+// public WSDLDocument parse(InputSource source) {
+// _messageFactory =
+// new
LocalizableMessageFactory("org.jboss.com.sun.tools.ws.resources.wsdl");
+// _localizer = new Localizer();
+//
+// WSDLDocument document = new WSDLDocument();
+// document.setSystemId(source.getSystemId());
+// ParserContext context = new ParserContext(document, _listeners);
+// context.setFollowImports(_followImports);
+// document.setDefinitions(parseDefinitions(context, source, null));
+// return document;
+// }
+
+ public WSDLDocument parse(){
+ String location = modelInfo.getLocation();
+ assert(location != null);
+ _messageFactory =
+ new
LocalizableMessageFactory("org.jboss.com.sun.tools.ws.resources.wsdl");
+ _localizer = new Localizer();
+
+ WSDLDocument document = new WSDLDocument();
+ InputSource source = null;
+ String wsdlLoc = JAXWSUtils.absolutize(JAXWSUtils.getFileOrURLName(location));
+ if(entityResolver != null){
+ try {
+ source = entityResolver.resolveEntity(null, wsdlLoc);
+ } catch (SAXException e) {
+ if (source.getSystemId() != null) {
+ throw new ParseException(
+ "parsing.saxExceptionWithSystemId",
+ source.getSystemId(),e);
+ } else {
+ throw new ParseException("parsing.saxException",e);
+ }
+ } catch (IOException e) {
+ if (source.getSystemId() != null) {
+ throw new ParseException(
+ "parsing.ioExceptionWithSystemId",
+ source.getSystemId(),e);
+ } else {
+ throw new ParseException("parsing.ioException",e);
+ }
+ }
+ }
+ if(source == null){
+ //default resolution
+ source = new InputSource(wsdlLoc);
+ }
+ document.setSystemId(wsdlLoc);
+ ParserContext context = new ParserContext(document, _listeners);
+ context.setFollowImports(_followImports);
+ document.setDefinitions(parseDefinitions(context, source, null));
+ return document;
+ }
+
+ protected Definitions parseDefinitions(ParserContext context,
+ InputSource source, String expectedTargetNamespaceURI) {
+ context.pushWSDLLocation();
+ context.setWSDLLocation(context.getDocument().getSystemId());
+ String sysId = context.getDocument().getSystemId();
+ buildDocumentFromWSDL(sysId, source, expectedTargetNamespaceURI);
+ Document root = wsdlDocuments.get(sysId);
+
+ //Internalizer.transform takes Set of jaxws:bindings elements, this is to allow
multiple external
+ //bindings to be transformed.
+ new Internalizer().transform(modelInfo.getJAXWSBindings(), wsdlDocuments,
+ (ProcessorEnvironment)modelInfo.getParent().getEnvironment());
+
+ //print the wsdl
+// try{
+// dump(System.out);
+// }catch(IOException e){
+// e.printStackTrace();
+// }
+
+ Definitions definitions = parseDefinitionsNoImport(context, root,
expectedTargetNamespaceURI);
+ processImports(context, source, definitions);
+ context.popWSDLLocation();
+ return definitions;
+ }
+
+ /**
+ * @param systemId
+ * @param source
+ * @param expectedTargetNamespaceURI
+ */
+ private void buildDocumentFromWSDL(String systemId, InputSource source, String
expectedTargetNamespaceURI) {
+ try {
+ DocumentBuilderFactory builderFactory =
DocumentBuilderFactory.newInstance();
+ builderFactory.setNamespaceAware(true);
+ builderFactory.setValidating(false);
+ DocumentBuilder builder = builderFactory.newDocumentBuilder();
+ builder.setErrorHandler(new ErrorHandler() {
+ public void error(SAXParseException e)
+ throws SAXParseException {
+ throw e;
+ }
+
+ public void fatalError(SAXParseException e)
+ throws SAXParseException {
+ throw e;
+ }
+
+ public void warning(SAXParseException err)
+ throws SAXParseException {
+ // do nothing
+ }
+ });
+ if(entityResolver != null)
+ builder.setEntityResolver(entityResolver);
+ else
+ builder.setEntityResolver(new NullEntityResolver());
+
+ try {
+ Document document = builder.parse(source);
+ wsdlDocuments.put(systemId, document);
+ Element e = document.getDocumentElement();
+ Util.verifyTagNSRootElement(e, WSDLConstants.QNAME_DEFINITIONS);
+ String name = XmlUtil.getAttributeOrNull(e, Constants.ATTR_NAME);
+
+ String _targetNamespaceURI =
+ XmlUtil.getAttributeOrNull(e, Constants.ATTR_TARGET_NAMESPACE);
+
+ if (expectedTargetNamespaceURI != null
+ && !expectedTargetNamespaceURI.equals(_targetNamespaceURI)){
+ //TODO: throw an exception???
+ }
+
+ for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) {
+ Element e2 = Util.nextElement(iter);
+ if (e2 == null)
+ break;
+
+ //check to see if it has imports
+ if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_IMPORT)){
+ String namespace = Util.getRequiredAttribute(e2,
Constants.ATTR_NAMESPACE);
+ String location = Util.getRequiredAttribute(e2,
Constants.ATTR_LOCATION);
+ location = getAdjustedLocation(source, location);
+ if(location != null && !location.equals("")){
+ if(!imports.contains(location)){
+ imports.add(location);
+ InputSource impSource = null;
+ if(entityResolver != null){
+ impSource = entityResolver.resolveEntity(null,
location);
+ }
+
+ if(impSource==null)
+ impSource = new InputSource(location); // default
resolution{
+
+ buildDocumentFromWSDL(location, impSource, namespace);
+ }
+ }
+ }
+ }
+ } catch (IOException e) {
+ if (source.getSystemId() != null) {
+ throw new ParseException(
+ "parsing.ioExceptionWithSystemId",
+ source.getSystemId(),e);
+ } else {
+ throw new ParseException("parsing.ioException",e);
+ }
+ } catch (SAXException e) {
+ if (source.getSystemId() != null) {
+ throw new ParseException(
+ "parsing.saxExceptionWithSystemId",
+ source.getSystemId(),e);
+ } else {
+ throw new ParseException("parsing.saxException",e);
+ }
+ }
+ } catch (ParserConfigurationException e) {
+ throw new ParseException(
+ "parsing.parserConfigException",e);
+ } catch (FactoryConfigurationError e) {
+ throw new ParseException(
+ "parsing.factoryConfigException",e);
+ }
+ }
+
+ private String getAdjustedLocation(InputSource source, String location) {
+ return source.getSystemId() == null
+ ? location
+ : Util.processSystemIdWithBase(
+ source.getSystemId(),
+ location);
+ }
+
+ /**
+ * Dumps the contents of the forest to the specified stream.
+ *
+ * This is a debug method. As such, error handling is sloppy.
+ */
+ public void dump( OutputStream out ) throws IOException {
+ try {
+ // create identity transformer
+ Transformer it = XmlUtil.newTransformer();
+
+ for( Iterator itr=wsdlDocuments.entrySet().iterator(); itr.hasNext(); ) {
+ Map.Entry e = (Map.Entry)itr.next();
+
+ out.write( ("---<<
"+e.getKey()+"\n").getBytes() );
+
+ it.transform( new DOMSource((Document)e.getValue()), new
StreamResult(out) );
+
+ out.write( "\n\n\n".getBytes() );
+ }
+ } catch( TransformerException e ) {
+ e.printStackTrace();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see WSDLParser#processImports(ParserContext, org.xml.sax.InputSource,
Definitions)
+ */
+ protected void processImports(ParserContext context, InputSource source, Definitions
definitions) {
+ for(String location : imports){
+ if (!context.getDocument().isImportedDocument(location)){
+ Definitions importedDefinitions = parseDefinitionsNoImport(context,
+ wsdlDocuments.get(location), location);
+ if(importedDefinitions == null)
+ continue;
+ context.getDocument().addImportedEntity(importedDefinitions);
+ context.getDocument().addImportedDocument(location);
+ }
+ }
+ }
+
+ protected Definitions parseDefinitionsNoImport(
+ ParserContext context,
+ InputSource source,
+ String expectedTargetNamespaceURI) {
+ try {
+ DocumentBuilderFactory builderFactory =
+ DocumentBuilderFactory.newInstance();
+ builderFactory.setNamespaceAware(true);
+ builderFactory.setValidating(false);
+ DocumentBuilder builder = builderFactory.newDocumentBuilder();
+ builder.setErrorHandler(new ErrorHandler() {
+ public void error(SAXParseException e)
+ throws SAXParseException {
+ throw e;
+ }
+
+ public void fatalError(SAXParseException e)
+ throws SAXParseException {
+ throw e;
+ }
+
+ public void warning(SAXParseException err)
+ throws SAXParseException {
+ // do nothing
+ }
+ });
+ builder.setEntityResolver(new NullEntityResolver());
+
+ try {
+ Document document = builder.parse(source);
+ return parseDefinitionsNoImport(
+ context,
+ document,
+ expectedTargetNamespaceURI);
+ } catch (IOException e) {
+ if (source.getSystemId() != null) {
+ throw new ParseException(
+ "parsing.ioExceptionWithSystemId",
+ source.getSystemId(),e);
+ } else {
+ throw new ParseException("parsing.ioException",e);
+ }
+ } catch (SAXException e) {
+ if (source.getSystemId() != null) {
+ throw new ParseException(
+ "parsing.saxExceptionWithSystemId",
+ source.getSystemId(),
+ e);
+ } else {
+ throw new ParseException("parsing.saxException",e);
+ }
+ }
+ } catch (ParserConfigurationException e) {
+ throw new ParseException("parsing.parserConfigException",e);
+ } catch (FactoryConfigurationError e) {
+ throw new ParseException("parsing.factoryConfigException",e);
+ }
+ }
+
+ protected Definitions parseDefinitionsNoImport(
+ ParserContext context,
+ Document doc,
+ String expectedTargetNamespaceURI) {
+ _targetNamespaceURI = null;
+ Element root = doc.getDocumentElement();
+ Util.verifyTagNSRootElement(root, WSDLConstants.QNAME_DEFINITIONS);
+ return parseDefinitionsNoImport(
+ context,
+ root,
+ expectedTargetNamespaceURI);
+ }
+
+ protected Definitions parseDefinitionsNoImport(
+ ParserContext context,
+ Element e,
+ String expectedTargetNamespaceURI) {
+ context.push();
+ context.registerNamespaces(e);
+
+ Definitions definitions = new Definitions(context.getDocument());
+ String name = XmlUtil.getAttributeOrNull(e, Constants.ATTR_NAME);
+ definitions.setName(name);
+
+ _targetNamespaceURI =
+ XmlUtil.getAttributeOrNull(e, Constants.ATTR_TARGET_NAMESPACE);
+
+ definitions.setTargetNamespaceURI(_targetNamespaceURI);
+
+ boolean gotDocumentation = false;
+ boolean gotTypes = false;
+
+ for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) {
+ Element e2 = Util.nextElement(iter);
+ if (e2 == null)
+ break;
+
+ if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) {
+ if (gotDocumentation) {
+ Util.fail(
+ "parsing.onlyOneDocumentationAllowed",
+ e.getLocalName());
+ }
+ gotDocumentation = true;
+ if(definitions.getDocumentation() == null)
+ definitions.setDocumentation(getDocumentationFor(e2));
+ } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_TYPES)) {
+ if (gotTypes) {
+ Util.fail(
+ "parsing.onlyOneTypesAllowed",
+ Constants.TAG_DEFINITIONS);
+ }
+ //add all the wsdl:type elements to latter make a list of all the schema
elements
+ // that will be needed to create jaxb model
+ addSchemaElements(e2);
+
+ //definitions.setTypes(parseTypes(context, definitions, e2));
+ } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_MESSAGE)) {
+ Message message = parseMessage(context, definitions, e2);
+ definitions.add(message);
+ } else if (
+ XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_PORT_TYPE)) {
+ PortType portType = parsePortType(context, definitions, e2);
+ definitions.add(portType);
+ } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_BINDING)) {
+ Binding binding = parseBinding(context, definitions, e2);
+ definitions.add(binding);
+ } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_SERVICE)) {
+ Service service = parseService(context, definitions, e2);
+ definitions.add(service);
+ } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_IMPORT)) {
+ definitions.add(parseImport(context, definitions, e2));
+ } else if (
+ (_useWSIBasicProfile)
+ && (XmlUtil.matchesTagNS(e2, SchemaConstants.QNAME_IMPORT)))
{
+ warn("warning.wsi.r2003");
+ } else {
+ // possible extensibility element -- must live outside the WSDL
namespace
+ checkNotWsdlElement(e2);
+ if (!handleExtension(context, definitions, e2)) {
+ checkNotWsdlRequired(e2);
+ }
+ }
+ }
+
+ context.pop();
+ context.fireDoneParsingEntity(
+ WSDLConstants.QNAME_DEFINITIONS,
+ definitions);
+ return definitions;
+ }
+
+ protected Message parseMessage(
+ ParserContext context,
+ Definitions definitions,
+ Element e) {
+ context.push();
+ context.registerNamespaces(e);
+ Message message = new Message(definitions);
+ String name = Util.getRequiredAttribute(e, Constants.ATTR_NAME);
+ message.setName(name);
+
+ boolean gotDocumentation = false;
+
+ for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) {
+ Element e2 = Util.nextElement(iter);
+ if (e2 == null)
+ break;
+
+ if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) {
+ if (gotDocumentation) {
+ Util.fail(
+ "parsing.onlyOneDocumentationAllowed",
+ e.getLocalName());
+ }
+ gotDocumentation = true;
+ message.setDocumentation(getDocumentationFor(e2));
+ } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_PART)) {
+ MessagePart part = parseMessagePart(context, e2);
+ message.add(part);
+ } else {
+ Util.fail(
+ "parsing.invalidElement",
+ e2.getTagName(),
+ e2.getNamespaceURI());
+ }
+ }
+
+ context.pop();
+ context.fireDoneParsingEntity(WSDLConstants.QNAME_MESSAGE, message);
+ return message;
+ }
+
+ protected MessagePart parseMessagePart(ParserContext context, Element e) {
+ context.push();
+ context.registerNamespaces(e);
+ MessagePart part = new MessagePart();
+ String partName = Util.getRequiredAttribute(e, Constants.ATTR_NAME);
+ part.setName(partName);
+
+ String elementAttr =
+ XmlUtil.getAttributeOrNull(e, Constants.ATTR_ELEMENT);
+ String typeAttr = XmlUtil.getAttributeOrNull(e, Constants.ATTR_TYPE);
+
+ if (elementAttr != null) {
+ if (typeAttr != null) {
+ Util.fail("parsing.onlyOneOfElementOrTypeRequired", partName);
+ }
+
+ part.setDescriptor(context.translateQualifiedName(elementAttr));
+ part.setDescriptorKind(SchemaKinds.XSD_ELEMENT);
+ } else if (typeAttr != null) {
+ part.setDescriptor(context.translateQualifiedName(typeAttr));
+ part.setDescriptorKind(SchemaKinds.XSD_TYPE);
+ } else {
+ // XXX-NOTE - this is wrong; for extensibility purposes,
+ // any attribute can be specified on a <part> element, so
+ // we need to put an extensibility hook here
+ warn("parsing.elementOrTypeRequired", partName);
+ }
+
+ context.pop();
+ context.fireDoneParsingEntity(WSDLConstants.QNAME_PART, part);
+ return part;
+ }
+
+ protected PortType parsePortType(
+ ParserContext context,
+ Definitions definitions,
+ Element e) {
+ context.push();
+ context.registerNamespaces(e);
+ PortType portType = new PortType(definitions);
+ String name = Util.getRequiredAttribute(e, Constants.ATTR_NAME);
+ portType.setName(name);
+
+ boolean gotDocumentation = false;
+
+ for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) {
+ Element e2 = Util.nextElement(iter);
+ if (e2 == null)
+ break;
+
+ if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) {
+ if (gotDocumentation) {
+ Util.fail(
+ "parsing.onlyOneDocumentationAllowed",
+ e.getLocalName());
+ }
+ gotDocumentation = true;
+ if(portType.getDocumentation() == null)
+ portType.setDocumentation(getDocumentationFor(e2));
+ } else if (
+ XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_OPERATION)) {
+ Operation op = parsePortTypeOperation(context, e2);
+ portType.add(op);
+ } else {
+ // possible extensibility element -- must live outside the WSDL
namespace
+ checkNotWsdlElement(e2);
+ if (!handleExtension(context, portType, e2)) {
+ checkNotWsdlRequired(e2);
+ }
+ }/*else {
+ Util.fail(
+ "parsing.invalidElement",
+ e2.getTagName(),
+ e2.getNamespaceURI());
+ }*/
+ }
+
+ context.pop();
+ context.fireDoneParsingEntity(WSDLConstants.QNAME_PORT_TYPE, portType);
+ return portType;
+ }
+
+ protected Operation parsePortTypeOperation(
+ ParserContext context,
+ Element e) {
+ context.push();
+ context.registerNamespaces(e);
+
+ Operation operation = new Operation();
+ String name = Util.getRequiredAttribute(e, Constants.ATTR_NAME);
+ operation.setName(name);
+ String parameterOrderAttr =
+ XmlUtil.getAttributeOrNull(e, Constants.ATTR_PARAMETER_ORDER);
+ operation.setParameterOrder(parameterOrderAttr);
+
+ boolean gotDocumentation = false;
+
+ boolean gotInput = false;
+ boolean gotOutput = false;
+ boolean gotFault = false;
+ boolean inputBeforeOutput = false;
+
+ for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) {
+ Element e2 = Util.nextElement(iter);
+ if (e2 == null)
+ break;
+
+ if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) {
+ if (gotDocumentation) {
+ Util.fail(
+ "parsing.onlyOneDocumentationAllowed",
+ e.getLocalName());
+ }
+ gotDocumentation = true;
+ if(operation.getDocumentation() == null)
+ operation.setDocumentation(getDocumentationFor(e2));
+ } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_INPUT)) {
+ if (gotInput) {
+ Util.fail(
+ "parsing.tooManyElements",
+ new Object[] {
+ Constants.TAG_INPUT,
+ Constants.TAG_OPERATION,
+ name });
+ }
+
+ context.push();
+ context.registerNamespaces(e2);
+ Input input = new Input();
+ String messageAttr =
+ Util.getRequiredAttribute(e2, Constants.ATTR_MESSAGE);
+ input.setMessage(context.translateQualifiedName(messageAttr));
+ String nameAttr =
+ XmlUtil.getAttributeOrNull(e2, Constants.ATTR_NAME);
+ input.setName(nameAttr);
+ operation.setInput(input);
+ gotInput = true;
+ if (gotOutput) {
+ inputBeforeOutput = false;
+ }
+
+ // verify that there is at most one child element and it is a
documentation element
+ boolean gotDocumentation2 = false;
+ for (Iterator iter2 = XmlUtil.getAllChildren(e2);
+ iter2.hasNext();
+ ) {
+ Element e3 = Util.nextElement(iter2);
+ if (e3 == null)
+ break;
+
+ if (XmlUtil
+ .matchesTagNS(e3, WSDLConstants.QNAME_DOCUMENTATION)) {
+ if (gotDocumentation2) {
+ Util.fail(
+ "parsing.onlyOneDocumentationAllowed",
+ e.getLocalName());
+ }
+ gotDocumentation2 = true;
+ input.setDocumentation(getDocumentationFor(e3));
+ } else {
+ Util.fail(
+ "parsing.invalidElement",
+ e3.getTagName(),
+ e3.getNamespaceURI());
+ }
+ }
+ context.pop();
+ } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_OUTPUT)) {
+ if (gotOutput) {
+ Util.fail(
+ "parsing.tooManyElements",
+ new Object[] {
+ Constants.TAG_OUTPUT,
+ Constants.TAG_OPERATION,
+ name });
+ }
+
+ context.push();
+ context.registerNamespaces(e2);
+ Output output = new Output();
+ String messageAttr =
+ Util.getRequiredAttribute(e2, Constants.ATTR_MESSAGE);
+ output.setMessage(context.translateQualifiedName(messageAttr));
+ String nameAttr =
+ XmlUtil.getAttributeOrNull(e2, Constants.ATTR_NAME);
+ output.setName(nameAttr);
+ operation.setOutput(output);
+ gotOutput = true;
+ if (gotInput) {
+ inputBeforeOutput = true;
+ }
+
+ // verify that there is at most one child element and it is a
documentation element
+ boolean gotDocumentation2 = false;
+ for (Iterator iter2 = XmlUtil.getAllChildren(e2);
+ iter2.hasNext();
+ ) {
+ Element e3 = Util.nextElement(iter2);
+ if (e3 == null)
+ break;
+
+ if (XmlUtil
+ .matchesTagNS(e3, WSDLConstants.QNAME_DOCUMENTATION)) {
+ if (gotDocumentation2) {
+ Util.fail(
+ "parsing.onlyOneDocumentationAllowed",
+ e.getLocalName());
+ }
+ gotDocumentation2 = true;
+ output.setDocumentation(getDocumentationFor(e3));
+ } else {
+ Util.fail(
+ "parsing.invalidElement",
+ e3.getTagName(),
+ e3.getNamespaceURI());
+ }
+ }
+ context.pop();
+ } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_FAULT)) {
+ context.push();
+ context.registerNamespaces(e2);
+ Fault fault = new Fault();
+ String messageAttr =
+ Util.getRequiredAttribute(e2, Constants.ATTR_MESSAGE);
+ fault.setMessage(context.translateQualifiedName(messageAttr));
+ String nameAttr =
+ XmlUtil.getAttributeOrNull(e2, Constants.ATTR_NAME);
+ fault.setName(nameAttr);
+ operation.addFault(fault);
+ gotFault = true;
+
+ // verify that there is at most one child element and it is a
documentation element
+ boolean gotDocumentation2 = false;
+ for (Iterator iter2 = XmlUtil.getAllChildren(e2);
+ iter2.hasNext();
+ ) {
+ Element e3 = Util.nextElement(iter2);
+ if (e3 == null)
+ break;
+
+ if (XmlUtil
+ .matchesTagNS(e3, WSDLConstants.QNAME_DOCUMENTATION)) {
+ if (gotDocumentation2) {
+ Util.fail(
+ "parsing.onlyOneDocumentationAllowed",
+ e.getLocalName());
+ }
+ gotDocumentation2 = true;
+ if(fault.getDocumentation() == null)
+ fault.setDocumentation(getDocumentationFor(e3));
+ } else {
+ // possible extensibility element -- must live outside the WSDL
namespace
+ checkNotWsdlElement(e3);
+ if (!handleExtension(context, fault, e3)) {
+ checkNotWsdlRequired(e3);
+ }
+ }/*else {
+ Util.fail(
+ "parsing.invalidElement",
+ e3.getTagName(),
+ e3.getNamespaceURI());
+ }*/
+ }
+ context.pop();
+ } else {
+ // possible extensibility element -- must live outside the WSDL
namespace
+ checkNotWsdlElement(e2);
+ if (!handleExtension(context, operation, e2)) {
+ checkNotWsdlRequired(e2);
+ }
+ }/*else {
+ Util.fail(
+ "parsing.invalidElement",
+ e2.getTagName(),
+ e2.getNamespaceURI());
+ }*/
+ }
+
+ if (gotInput && !gotOutput && !gotFault) {
+ operation.setStyle(OperationStyle.ONE_WAY);
+ } else if (gotInput && gotOutput && inputBeforeOutput) {
+ operation.setStyle(OperationStyle.REQUEST_RESPONSE);
+ } else if (gotInput && gotOutput && !inputBeforeOutput) {
+ operation.setStyle(OperationStyle.SOLICIT_RESPONSE);
+ } else if (gotOutput && !gotInput && !gotFault) {
+ operation.setStyle(OperationStyle.NOTIFICATION);
+ } else {
+ Util.fail("parsing.invalidOperationStyle", name);
+ }
+
+ context.pop();
+ context.fireDoneParsingEntity(WSDLConstants.QNAME_OPERATION, operation);
+ return operation;
+ }
+
+ protected Binding parseBinding(
+ ParserContext context,
+ Definitions definitions,
+ Element e) {
+ context.push();
+ context.registerNamespaces(e);
+ Binding binding = new Binding(definitions);
+ String name = Util.getRequiredAttribute(e, Constants.ATTR_NAME);
+ binding.setName(name);
+ String typeAttr = Util.getRequiredAttribute(e, Constants.ATTR_TYPE);
+ binding.setPortType(context.translateQualifiedName(typeAttr));
+
+ boolean gotDocumentation = false;
+
+ for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) {
+ Element e2 = Util.nextElement(iter);
+ if (e2 == null)
+ break;
+
+ if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) {
+ if (gotDocumentation) {
+ Util.fail(
+ "parsing.onlyOneDocumentationAllowed",
+ e.getLocalName());
+ }
+ gotDocumentation = true;
+ binding.setDocumentation(getDocumentationFor(e2));
+ } else if (
+ XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_OPERATION)) {
+ BindingOperation op = parseBindingOperation(context, e2);
+ binding.add(op);
+ } else {
+ // possible extensibility element -- must live outside the WSDL
namespace
+ checkNotWsdlElement(e2);
+ if (!handleExtension(context, binding, e2)) {
+ checkNotWsdlRequired(e2);
+ }
+ }
+ }
+
+ context.pop();
+ context.fireDoneParsingEntity(WSDLConstants.QNAME_BINDING, binding);
+ return binding;
+ }
+
+ protected BindingOperation parseBindingOperation(
+ ParserContext context,
+ Element e) {
+ context.push();
+ context.registerNamespaces(e);
+ BindingOperation operation = new BindingOperation();
+ String name = Util.getRequiredAttribute(e, Constants.ATTR_NAME);
+ operation.setName(name);
+
+ boolean gotDocumentation = false;
+
+ boolean gotInput = false;
+ boolean gotOutput = false;
+ boolean gotFault = false;
+ boolean inputBeforeOutput = false;
+
+ for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) {
+ Element e2 = Util.nextElement(iter);
+ if (e2 == null)
+ break;
+ if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) {
+ if (gotDocumentation) {
+ Util.fail(
+ "parsing.onlyOneDocumentationAllowed",
+ e.getLocalName());
+ }
+ gotDocumentation = true;
+ operation.setDocumentation(getDocumentationFor(e2));
+ } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_INPUT)) {
+ if (gotInput) {
+ Util.fail(
+ "parsing.tooManyElements",
+ new Object[] {
+ Constants.TAG_INPUT,
+ Constants.TAG_OPERATION,
+ name });
+ }
+
+ /* Here we check for the use scenario */
+ Iterator itere2 = XmlUtil.getAllChildren(e2);
+ Element ee = Util.nextElement(itere2);
+ if (hSet.isEmpty()) {
+ hSet.add(ee.getAttribute("use"));
+ } else {
+ /* this codition will happen when the wsdl used has a mixture of
+ literal and encoded style */
+ if (!hSet.contains(ee.getAttribute("use"))
+ && (ee.getAttribute("use") != "")) {
+ hSet.add(ee.getAttribute("use"));
+ }
+ }
+
+ context.push();
+ context.registerNamespaces(e2);
+ BindingInput input = new BindingInput();
+ String nameAttr =
+ XmlUtil.getAttributeOrNull(e2, Constants.ATTR_NAME);
+ input.setName(nameAttr);
+ operation.setInput(input);
+ gotInput = true;
+ if (gotOutput) {
+ inputBeforeOutput = false;
+ }
+
+ // verify that there is at most one child element and it is a
documentation element
+ boolean gotDocumentation2 = false;
+ for (Iterator iter2 = XmlUtil.getAllChildren(e2);
+ iter2.hasNext();
+ ) {
+ Element e3 = Util.nextElement(iter2);
+ if (e3 == null)
+ break;
+
+ if (XmlUtil
+ .matchesTagNS(e3, WSDLConstants.QNAME_DOCUMENTATION)) {
+ if (gotDocumentation2) {
+ Util.fail(
+ "parsing.onlyOneDocumentationAllowed",
+ e.getLocalName());
+ }
+ gotDocumentation2 = true;
+ input.setDocumentation(getDocumentationFor(e3));
+ } else {
+ // possible extensibility element -- must live outside the WSDL
namespace
+ checkNotWsdlElement(e3);
+ if (!handleExtension(context, input, e3)) {
+ checkNotWsdlRequired(e3);
+ }
+ }
+ }
+ context.pop();
+ } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_OUTPUT)) {
+ if (gotOutput) {
+ Util.fail(
+ "parsing.tooManyElements",
+ new Object[] {
+ Constants.TAG_OUTPUT,
+ Constants.TAG_OPERATION,
+ name });
+ }
+
+ context.push();
+ context.registerNamespaces(e2);
+ BindingOutput output = new BindingOutput();
+ String nameAttr =
+ XmlUtil.getAttributeOrNull(e2, Constants.ATTR_NAME);
+ output.setName(nameAttr);
+ operation.setOutput(output);
+ gotOutput = true;
+ if (gotInput) {
+ inputBeforeOutput = true;
+ }
+
+ // verify that there is at most one child element and it is a
documentation element
+ boolean gotDocumentation2 = false;
+ for (Iterator iter2 = XmlUtil.getAllChildren(e2);
+ iter2.hasNext();
+ ) {
+
+ Element e3 = Util.nextElement(iter2);
+ if (e3 == null)
+ break;
+
+ if (XmlUtil
+ .matchesTagNS(e3, WSDLConstants.QNAME_DOCUMENTATION)) {
+ if (gotDocumentation2) {
+ Util.fail(
+ "parsing.onlyOneDocumentationAllowed",
+ e.getLocalName());
+ }
+ gotDocumentation2 = true;
+ output.setDocumentation(getDocumentationFor(e3));
+ } else {
+ // possible extensibility element -- must live outside the WSDL
namespace
+ checkNotWsdlElement(e3);
+ if (!handleExtension(context, output, e3)) {
+ checkNotWsdlRequired(e3);
+ }
+ }
+ }
+ context.pop();
+ } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_FAULT)) {
+ context.push();
+ context.registerNamespaces(e2);
+ BindingFault fault = new BindingFault();
+ String nameAttr =
+ Util.getRequiredAttribute(e2, Constants.ATTR_NAME);
+ fault.setName(nameAttr);
+ operation.addFault(fault);
+ gotFault = true;
+
+ // verify that there is at most one child element and it is a
documentation element
+ boolean gotDocumentation2 = false;
+ for (Iterator iter2 = XmlUtil.getAllChildren(e2);
+ iter2.hasNext();
+ ) {
+ Element e3 = Util.nextElement(iter2);
+ if (e3 == null)
+ break;
+
+ if (XmlUtil
+ .matchesTagNS(e3, WSDLConstants.QNAME_DOCUMENTATION)) {
+ if (gotDocumentation2) {
+ Util.fail(
+ "parsing.onlyOneDocumentationAllowed",
+ e.getLocalName());
+ }
+ gotDocumentation2 = true;
+ if(fault.getDocumentation() == null)
+ fault.setDocumentation(getDocumentationFor(e3));
+ } else {
+ // possible extensibility element -- must live outside the WSDL
namespace
+ checkNotWsdlElement(e3);
+ if (!handleExtension(context, fault, e3)) {
+ checkNotWsdlRequired(e3);
+ }
+ }
+ }
+ context.pop();
+ } else {
+ // possible extensibility element -- must live outside the WSDL
namespace
+ checkNotWsdlElement(e2);
+ if (!handleExtension(context, operation, e2)) {
+ checkNotWsdlRequired(e2);
+ }
+ }
+ }
+
+ if (gotInput && !gotOutput && !gotFault) {
+ operation.setStyle(OperationStyle.ONE_WAY);
+ } else if (gotInput && gotOutput && inputBeforeOutput) {
+ operation.setStyle(OperationStyle.REQUEST_RESPONSE);
+ } else if (gotInput && gotOutput && !inputBeforeOutput) {
+ operation.setStyle(OperationStyle.SOLICIT_RESPONSE);
+ } else if (gotOutput && !gotInput && !gotFault) {
+ operation.setStyle(OperationStyle.NOTIFICATION);
+ } else {
+ Util.fail("parsing.invalidOperationStyle", name);
+ }
+
+ context.pop();
+ context.fireDoneParsingEntity(WSDLConstants.QNAME_OPERATION, operation);
+ return operation;
+ }
+
+ protected Import parseImport(
+ ParserContext context,
+ Definitions definitions,
+ Element e) {
+ context.push();
+ context.registerNamespaces(e);
+ Import anImport = new Import();
+ String namespace =
+ Util.getRequiredAttribute(e, Constants.ATTR_NAMESPACE);
+ anImport.setNamespace(namespace);
+ String location = Util.getRequiredAttribute(e, Constants.ATTR_LOCATION);
+ anImport.setLocation(location);
+
+ // according to the schema in the WSDL 1.1 spec, an import can have a
documentation element
+ boolean gotDocumentation = false;
+
+ for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) {
+ Element e2 = Util.nextElement(iter);
+ if (e2 == null)
+ break;
+
+ if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) {
+ if (gotDocumentation) {
+ Util.fail(
+ "parsing.onlyOneDocumentationAllowed",
+ e.getLocalName());
+ }
+ gotDocumentation = true;
+ anImport.setDocumentation(getDocumentationFor(e2));
+ } else {
+ Util.fail(
+ "parsing.invalidElement",
+ e2.getTagName(),
+ e2.getNamespaceURI());
+ }
+ }
+ context.pop();
+ context.fireDoneParsingEntity(WSDLConstants.QNAME_IMPORT, anImport);
+ return anImport;
+ }
+
+ protected Service parseService(
+ ParserContext context,
+ Definitions definitions,
+ Element e) {
+ context.push();
+ context.registerNamespaces(e);
+ Service service = new Service(definitions);
+ String name = Util.getRequiredAttribute(e, Constants.ATTR_NAME);
+ service.setName(name);
+
+ boolean gotDocumentation = false;
+
+ for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) {
+ Element e2 = Util.nextElement(iter);
+ if (e2 == null)
+ break;
+
+ if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) {
+ if (gotDocumentation) {
+ Util.fail(
+ "parsing.onlyOneDocumentationAllowed",
+ e.getLocalName());
+ }
+ gotDocumentation = true;
+ if(service.getDocumentation() == null)
+ service.setDocumentation(getDocumentationFor(e2));
+ } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_PORT)) {
+ Port port = parsePort(context, definitions, e2);
+ service.add(port);
+ } else {
+ // possible extensibility element -- must live outside the WSDL
namespace
+ checkNotWsdlElement(e2);
+ if (!handleExtension(context, service, e2)) {
+ checkNotWsdlRequired(e2);
+ }
+ }
+ }
+
+ context.pop();
+ context.fireDoneParsingEntity(WSDLConstants.QNAME_SERVICE, service);
+ return service;
+ }
+
+ protected Port parsePort(
+ ParserContext context,
+ Definitions definitions,
+ Element e) {
+ context.push();
+ context.registerNamespaces(e);
+
+ Port port = new Port(definitions);
+ String name = Util.getRequiredAttribute(e, Constants.ATTR_NAME);
+ port.setName(name);
+
+ String bindingAttr =
+ Util.getRequiredAttribute(e, Constants.ATTR_BINDING);
+ port.setBinding(context.translateQualifiedName(bindingAttr));
+
+ boolean gotDocumentation = false;
+
+ for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) {
+ Element e2 = Util.nextElement(iter);
+ if (e2 == null)
+ break;
+
+ if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) {
+ if (gotDocumentation) {
+ Util.fail(
+ "parsing.onlyOneDocumentationAllowed",
+ e.getLocalName());
+ }
+ gotDocumentation = true;
+ if(port.getDocumentation() == null)
+ port.setDocumentation(getDocumentationFor(e2));
+ } else {
+ // possible extensibility element -- must live outside the WSDL
namespace
+ checkNotWsdlElement(e2);
+ if (!handleExtension(context, port, e2)) {
+ checkNotWsdlRequired(e2);
+ }
+ }
+ }
+
+ context.pop();
+ context.fireDoneParsingEntity(WSDLConstants.QNAME_PORT, port);
+ return port;
+ }
+
+ protected Types parseTypes(
+ ParserContext context,
+ Definitions definitions,
+ Element e) {
+ context.push();
+ context.registerNamespaces(e);
+ Types types = new Types();
+
+ boolean gotDocumentation = false;
+
+ for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) {
+ Element e2 = Util.nextElement(iter);
+ if (e2 == null)
+ break;
+
+ if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) {
+ if (gotDocumentation) {
+ Util.fail(
+ "parsing.onlyOneDocumentationAllowed",
+ e.getLocalName());
+ }
+ gotDocumentation = true;
+ types.setDocumentation(getDocumentationFor(e2));
+ } //bug fix 4854004
+ else if (
+ (_useWSIBasicProfile)
+ && (XmlUtil.matchesTagNS(e2, SchemaConstants.QNAME_IMPORT)))
{
+ warn("warning.wsi.r2003");
+ } else {
+ // possible extensibility element -- must live outside the WSDL
namespace
+ checkNotWsdlElement(e2);
+ try {
+ if (!handleExtension(context, types, e2)) {
+ checkNotWsdlRequired(e2);
+ }
+ } catch (ParseException pe) {
+ if (pe.getKey().equals("parsing.incorrectRootElement")) {
+ if (_useWSIBasicProfile) {
+ warn("warning.wsi.r2004");
+ }
+ throw pe;
+ }
+ }
+ }
+ }
+
+ context.pop();
+ context.fireDoneParsingEntity(WSDLConstants.QNAME_TYPES, types);
+ return types;
+ }
+
+ private List _elements = new ArrayList();
+
+ public void addSchemaElements(Element typesElement){
+ for (Iterator iter = XmlUtil.getAllChildren(typesElement); iter.hasNext();) {
+ Element e = Util.nextElement(iter);
+ if (e == null)
+ break;
+
+ if (XmlUtil.matchesTagNS(e, SchemaConstants.QNAME_SCHEMA)) {
+ _elements.add(e);
+ } else {
+ // possible extensibility element -- must live outside the WSDL
namespace
+ checkNotWsdlElement(e);
+ }
+ }
+ }
+
+ public List getSchemaElements(){
+ return _elements;
+ }
+
+ protected boolean handleExtension(
+ ParserContext context,
+ Extensible entity,
+ Element e) {
+ ExtensionHandler h =
+ (ExtensionHandler) _extensionHandlers.get(e.getNamespaceURI());
+ if (h == null) {
+ context.fireIgnoringExtension(
+ new QName(e.getNamespaceURI(), e.getLocalName()),
+ ((Entity) entity).getElementName());
+ return false;
+ } else {
+ return h.doHandleExtension(context, entity, e);
+ }
+ }
+
+ protected void checkNotWsdlElement(Element e) {
+ // possible extensibility element -- must live outside the WSDL namespace
+ if (e.getNamespaceURI().equals(Constants.NS_WSDL))
+ Util.fail("parsing.invalidWsdlElement", e.getTagName());
+ }
+
+ protected void checkNotWsdlRequired(Element e) {
+ // check the wsdl:required attribute, fail if set to "true"
+ String required =
+ XmlUtil.getAttributeNSOrNull(
+ e,
+ Constants.ATTR_REQUIRED,
+ Constants.NS_WSDL);
+ if (required != null && required.equals(Constants.TRUE)) {
+ Util.fail(
+ "parsing.requiredExtensibilityElement",
+ e.getTagName(),
+ e.getNamespaceURI());
+ }
+ }
+
+ protected Documentation getDocumentationFor(Element e) {
+ String s = XmlUtil.getTextForNode(e);
+ if (s == null) {
+ return null;
+ } else {
+ return new Documentation(s);
+ }
+ }
+
+ protected void error(String key) {
+ System.err.println(
+ _localizer.localize(_messageFactory.getMessage(key)));
+ }
+
+ public HashSet getUse() {
+ return hSet;
+ }
+
+ protected void warn(String key) {
+ System.err.println(
+ _localizer.localize(_messageFactory.getMessage(key)));
+ }
+
+ protected void warn(String key, String arg) {
+ System.err.println(
+ _localizer.localize(_messageFactory.getMessage(key, arg)));
+ }
+
+ protected void warn(String key, Object[] args) {
+ System.err.println(
+ _localizer.localize(_messageFactory.getMessage(key, args)));
+ }
+
+ private boolean _followImports;
+ private String _targetNamespaceURI;
+ private Map _extensionHandlers;
+ private ArrayList _listeners;
+ private boolean _useWSIBasicProfile = true;
+ private LocalizableMessageFactory _messageFactory = null;
+ private Localizer _localizer;
+ private HashSet hSet = null;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/WSDLParser.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/WSDLWriter.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/WSDLWriter.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/WSDLWriter.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,369 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.tools.ws.wsdl.parser;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.tools.ws.wsdl.document.Binding;
+import org.jboss.com.sun.tools.ws.wsdl.document.BindingFault;
+import org.jboss.com.sun.tools.ws.wsdl.document.BindingInput;
+import org.jboss.com.sun.tools.ws.wsdl.document.BindingOperation;
+import org.jboss.com.sun.tools.ws.wsdl.document.BindingOutput;
+import org.jboss.com.sun.tools.ws.wsdl.document.Definitions;
+import org.jboss.com.sun.tools.ws.wsdl.document.Documentation;
+import org.jboss.com.sun.tools.ws.wsdl.document.Fault;
+import org.jboss.com.sun.tools.ws.wsdl.document.Import;
+import org.jboss.com.sun.tools.ws.wsdl.document.Input;
+import org.jboss.com.sun.tools.ws.wsdl.document.Message;
+import org.jboss.com.sun.tools.ws.wsdl.document.MessagePart;
+import org.jboss.com.sun.tools.ws.wsdl.document.Operation;
+import org.jboss.com.sun.tools.ws.wsdl.document.Output;
+import org.jboss.com.sun.tools.ws.wsdl.document.Port;
+import org.jboss.com.sun.tools.ws.wsdl.document.PortType;
+import org.jboss.com.sun.tools.ws.wsdl.document.Service;
+import org.jboss.com.sun.tools.ws.wsdl.document.Types;
+import org.jboss.com.sun.tools.ws.wsdl.document.WSDLConstants;
+import org.jboss.com.sun.tools.ws.wsdl.document.WSDLDocument;
+import org.jboss.com.sun.tools.ws.wsdl.document.WSDLDocumentVisitor;
+import org.jboss.com.sun.tools.ws.wsdl.document.jaxws.JAXWSBindingsConstants;
+import org.jboss.com.sun.tools.ws.wsdl.document.schema.SchemaKinds;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Extension;
+import org.jboss.com.sun.tools.ws.wsdl.framework.Kind;
+import org.jboss.com.sun.tools.ws.wsdl.framework.WriterContext;
+
+
+/**
+ * A writer for WSDL documents.
+ *
+ * @author WS Development Team
+ */
+public class WSDLWriter {
+
+ public WSDLWriter() throws IOException {
+ _extensionHandlers = new HashMap();
+
+ // register handlers for default extensions
+ register(new SOAPExtensionHandler());
+ register(new HTTPExtensionHandler());
+ register(new MIMEExtensionHandler());
+ register(new SchemaExtensionHandler());
+ register(new JAXWSBindingExtensionHandler());
+ }
+
+ public void register(ExtensionHandler h) {
+ _extensionHandlers.put(h.getNamespaceURI(), h);
+ h.setExtensionHandlers(_extensionHandlers);
+ }
+
+ public void unregister(ExtensionHandler h) {
+ _extensionHandlers.put(h.getNamespaceURI(), null);
+ h.setExtensionHandlers(null);
+ }
+
+ public void unregister(String uri) {
+ _extensionHandlers.put(uri, null);
+ }
+
+ public void write(final WSDLDocument document, OutputStream os)
+ throws IOException {
+ final WriterContext context = new WriterContext(os);
+ try {
+ document.accept(new WSDLDocumentVisitor() {
+ public void preVisit(Definitions definitions)
+ throws Exception {
+ context.push();
+ initializePrefixes(context, document);
+ context.writeStartTag(definitions.getElementName());
+ context.writeAttribute(
+ Constants.ATTR_NAME,
+ definitions.getName());
+ context.writeAttribute(
+ Constants.ATTR_TARGET_NAMESPACE,
+ definitions.getTargetNamespaceURI());
+ context.writeAllPendingNamespaceDeclarations();
+ }
+ public void postVisit(Definitions definitions)
+ throws Exception {
+ context.writeEndTag(definitions.getElementName());
+ context.pop();
+ }
+ public void visit(Import i) throws Exception {
+ context.writeStartTag(i.getElementName());
+ context.writeAttribute(
+ Constants.ATTR_NAMESPACE,
+ i.getNamespace());
+ context.writeAttribute(
+ Constants.ATTR_LOCATION,
+ i.getLocation());
+ context.writeEndTag(i.getElementName());
+ }
+ public void preVisit(Types types) throws Exception {
+ context.writeStartTag(types.getElementName());
+ }
+ public void postVisit(Types types) throws Exception {
+ context.writeEndTag(types.getElementName());
+ }
+ public void preVisit(Message message) throws Exception {
+ context.writeStartTag(message.getElementName());
+ context.writeAttribute(
+ Constants.ATTR_NAME,
+ message.getName());
+ }
+ public void postVisit(Message message) throws Exception {
+ context.writeEndTag(message.getElementName());
+ }
+ public void visit(MessagePart part) throws Exception {
+ context.writeStartTag(part.getElementName());
+ context.writeAttribute(Constants.ATTR_NAME, part.getName());
+
+ QName dname = part.getDescriptor();
+ Kind dkind = part.getDescriptorKind();
+ if (dname != null && dkind != null) {
+ if (dkind.equals(SchemaKinds.XSD_ELEMENT)) {
+ context.writeAttribute(
+ Constants.ATTR_ELEMENT,
+ dname);
+ } else if (dkind.equals(SchemaKinds.XSD_TYPE)) {
+ context.writeAttribute(Constants.ATTR_TYPE, dname);
+ } else {
+ // TODO - add support for attribute extensions here
+ }
+ }
+ context.writeEndTag(part.getElementName());
+ }
+ public void preVisit(PortType portType) throws Exception {
+ context.writeStartTag(portType.getElementName());
+ context.writeAttribute(
+ Constants.ATTR_NAME,
+ portType.getName());
+ }
+ public void postVisit(PortType portType) throws Exception {
+ context.writeEndTag(portType.getElementName());
+ }
+ public void preVisit(Operation operation) throws Exception {
+ context.writeStartTag(operation.getElementName());
+ context.writeAttribute(
+ Constants.ATTR_NAME,
+ operation.getName());
+ //bug fix: 4947340, parameterOder="" should not be
generated
+ if(operation.getParameterOrder() != null &&
+ operation.getParameterOrder().length() > 0) {
+ context.writeAttribute(
+ Constants.ATTR_PARAMETER_ORDER,
+ operation.getParameterOrder());
+ }
+ }
+ public void postVisit(Operation operation) throws Exception {
+ context.writeEndTag(operation.getElementName());
+ }
+ public void preVisit(Input input) throws Exception {
+ context.writeStartTag(input.getElementName());
+ context.writeAttribute(
+ Constants.ATTR_NAME,
+ input.getName());
+ context.writeAttribute(
+ Constants.ATTR_MESSAGE,
+ input.getMessage());
+ }
+ public void postVisit(Input input) throws Exception {
+ context.writeEndTag(input.getElementName());
+ }
+ public void preVisit(Output output) throws Exception {
+ context.writeStartTag(output.getElementName());
+ context.writeAttribute(
+ Constants.ATTR_NAME,
+ output.getName());
+ context.writeAttribute(
+ Constants.ATTR_MESSAGE,
+ output.getMessage());
+ }
+ public void postVisit(Output output) throws Exception {
+ context.writeEndTag(output.getElementName());
+ }
+ public void preVisit(Fault fault) throws Exception {
+ context.writeStartTag(fault.getElementName());
+ context.writeAttribute(
+ Constants.ATTR_NAME,
+ fault.getName());
+ context.writeAttribute(
+ Constants.ATTR_MESSAGE,
+ fault.getMessage());
+ }
+ public void postVisit(Fault fault) throws Exception {
+ context.writeEndTag(fault.getElementName());
+ }
+ public void preVisit(Binding binding) throws Exception {
+ context.writeStartTag(binding.getElementName());
+ context.writeAttribute(
+ Constants.ATTR_NAME,
+ binding.getName());
+ context.writeAttribute(
+ Constants.ATTR_TYPE,
+ binding.getPortType());
+ }
+ public void postVisit(Binding binding) throws Exception {
+ context.writeEndTag(binding.getElementName());
+ }
+
+ public void preVisit(BindingOperation operation)
+ throws Exception {
+ context.writeStartTag(operation.getElementName());
+ context.writeAttribute(
+ Constants.ATTR_NAME,
+ operation.getName());
+ }
+ public void postVisit(BindingOperation operation)
+ throws Exception {
+ context.writeEndTag(operation.getElementName());
+ }
+ public void preVisit(BindingInput input) throws Exception {
+ context.writeStartTag(input.getElementName());
+ context.writeAttribute(
+ Constants.ATTR_NAME,
+ input.getName());
+ }
+ public void postVisit(BindingInput input) throws Exception {
+ context.writeEndTag(input.getElementName());
+ }
+ public void preVisit(BindingOutput output) throws Exception {
+ context.writeStartTag(output.getElementName());
+ context.writeAttribute(
+ Constants.ATTR_NAME,
+ output.getName());
+ }
+ public void postVisit(BindingOutput output) throws Exception {
+ context.writeEndTag(output.getElementName());
+ }
+ public void preVisit(BindingFault fault) throws Exception {
+ context.writeStartTag(fault.getElementName());
+ context.writeAttribute(
+ Constants.ATTR_NAME,
+ fault.getName());
+ }
+ public void postVisit(BindingFault fault) throws Exception {
+ context.writeEndTag(fault.getElementName());
+ }
+
+ public void preVisit(Service service) throws Exception {
+ context.writeStartTag(service.getElementName());
+ context.writeAttribute(
+ Constants.ATTR_NAME,
+ service.getName());
+ }
+ public void postVisit(Service service) throws Exception {
+ context.writeEndTag(service.getElementName());
+ }
+ public void preVisit(Port port) throws Exception {
+ context.writeStartTag(port.getElementName());
+ context.writeAttribute(Constants.ATTR_NAME, port.getName());
+ context.writeAttribute(
+ Constants.ATTR_BINDING,
+ port.getBinding());
+ }
+ public void postVisit(Port port) throws Exception {
+ context.writeEndTag(port.getElementName());
+ }
+ public void preVisit(Extension extension) throws Exception {
+ ExtensionHandler h =
+ (ExtensionHandler) _extensionHandlers.get(
+ extension.getElementName().getNamespaceURI());
+ h.doHandleExtension(context, extension);
+ }
+ public void postVisit(Extension extension) throws Exception {
+ }
+ public void visit(Documentation documentation)
+ throws Exception {
+ context.writeTag(WSDLConstants.QNAME_DOCUMENTATION, null);
+ }
+ });
+ context.flush();
+ } catch (Exception e) {
+ if (e instanceof IOException) {
+ throw (IOException) e;
+ } else if (e instanceof RuntimeException) {
+ throw (RuntimeException) e;
+ } else {
+ // entirely unexpected exception
+ throw new IllegalStateException();
+ }
+ }
+ }
+
+ private void initializePrefixes(
+ WriterContext context,
+ WSDLDocument document)
+ throws IOException {
+ // deal with the target namespace first
+ String tnsURI = document.getDefinitions().getTargetNamespaceURI();
+ if (tnsURI != null) {
+ context.setTargetNamespaceURI(tnsURI);
+ context.declarePrefix(TARGET_NAMESPACE_PREFIX, tnsURI);
+ }
+
+ // then with the WSDL namespace
+// context.declarePrefix(_commonPrefixes.get(Constants.NS_WSDL),
Constants.NS_WSDL);
+ context.declarePrefix("", Constants.NS_WSDL);
+
+ // then with all other namespaces
+ Set namespaces = document.collectAllNamespaces();
+ for (Iterator iter = namespaces.iterator(); iter.hasNext();) {
+ String nsURI = (String) iter.next();
+ if (context.getPrefixFor(nsURI) != null)
+ continue;
+
+ String prefix = (String) _commonPrefixes.get(nsURI);
+ if (prefix == null) {
+ // create a new prefix for it
+ prefix = context.findNewPrefix(NEW_NAMESPACE_PREFIX_BASE);
+ }
+ context.declarePrefix(prefix, nsURI);
+ }
+ }
+
+ private Map _extensionHandlers;
+
+ ////////
+
+ private static Map<String, String> _commonPrefixes;
+
+ static {
+ _commonPrefixes = new HashMap<String, String>();
+ _commonPrefixes.put(Constants.NS_WSDL, "wsdl");
+ _commonPrefixes.put(Constants.NS_WSDL_SOAP, "soap");
+ _commonPrefixes.put(Constants.NS_WSDL_HTTP, "http");
+ _commonPrefixes.put(Constants.NS_WSDL_MIME, "mime");
+ _commonPrefixes.put(Constants.NS_XSD, "xsd");
+ _commonPrefixes.put(Constants.NS_XSI, "xsi");
+ _commonPrefixes.put(JAXWSBindingsConstants.NS_JAXWS_BINDINGS,
"jaxws");
+ }
+
+ private final static String TARGET_NAMESPACE_PREFIX = "tns";
+ private final static String NEW_NAMESPACE_PREFIX_BASE = "ns";
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/tools/ws/wsdl/parser/WSDLWriter.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/binding/BindingImpl.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/binding/BindingImpl.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/binding/BindingImpl.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,203 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.binding;
+
+
+import javax.xml.ws.Binding;
+import javax.xml.ws.handler.Handler;
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.ws.http.HTTPBinding;
+import javax.xml.ws.soap.SOAPBinding;
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.xml.ws.binding.http.HTTPBindingImpl;
+import org.jboss.com.sun.xml.ws.binding.soap.SOAPBindingImpl;
+import org.jboss.com.sun.xml.ws.handler.HandlerChainCaller;
+import org.jboss.com.sun.xml.ws.modeler.RuntimeModeler;
+import org.jboss.com.sun.xml.ws.spi.runtime.SystemHandlerDelegate;
+
+/**
+ * Instances are created by the service, which then
+ * sets the handler chain on the binding impl. The handler
+ * caller class actually creates and manages the handlers.
+ *
+ * <p>Also used on the server side, where non-api calls such as
+ * getHandlerChainCaller cannot be used. So the binding impl
+ * now stores the handler list rather than deferring to the
+ * handler chain caller.
+ *
+ * <p>This class is made abstract as we dont see a situation when a BindingImpl has
much meaning without binding id.
+ * IOw, for a specific binding there will be a class extending BindingImpl, for example
SOAPBindingImpl.
+ *
+ * <p>The spi Binding interface extends Binding.
+ *
+ * @author WS Development Team
+ */
+public abstract class BindingImpl implements
+ org.jboss.com.sun.xml.ws.spi.runtime.Binding {
+
+ // caller ignored on server side
+ protected HandlerChainCaller chainCaller;
+
+ private SystemHandlerDelegate systemHandlerDelegate;
+ private List<Handler> handlers;
+ private String bindingId;
+ protected QName serviceName;
+
+ // called by DispatchImpl
+ public BindingImpl(String bindingId, QName serviceName) {
+ this.bindingId = bindingId;
+ this.serviceName = serviceName;
+ }
+
+ public BindingImpl(List<Handler> handlerChain, String bindingId, QName
serviceName) {
+ handlers = handlerChain;
+ this.bindingId = bindingId;
+ this.serviceName = serviceName;
+ }
+
+
+ /**
+ * Return a copy of the list. If there is a handler chain caller,
+ * this is the proper list. Otherwise, return a copy of 'handlers'
+ * or null if list is null. The RuntimeEndpointInfo.init() method
+ * relies on this list being null if there were no handlers
+ * in the deployment descriptor file.
+ *
+ * @return The list of handlers. This can be null if there are
+ * no handlers. The list may have a different order depending on
+ * whether or not the handlers have been called yet, since the
+ * logical and protocol handlers will be sorted before calling them.
+ *
+ * @see org.jboss.com.sun.xml.ws.server.RuntimeEndpointInfo#init
+ */
+ public List<Handler> getHandlerChain() {
+ if (chainCaller != null) {
+ return new ArrayList(chainCaller.getHandlerChain());
+ }
+ if (handlers == null) {
+ return null;
+ }
+ return new ArrayList(handlers);
+ }
+
+ public boolean hasHandlers() {
+ if (handlers == null || handlers.size() == 0) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Sets the handlers on the binding. If the handler chain
+ * caller already exists, then the handlers will be set on
+ * the caller and the handler chain held by the binding will
+ * be the sorted list.
+ */
+ public void setHandlerChain(List<Handler> chain) {
+ if (chainCaller != null) {
+ chainCaller = new HandlerChainCaller(chain);
+ handlers = chainCaller.getHandlerChain();
+ } else {
+ handlers = chain;
+ }
+ }
+
+ /**
+ * Creates the handler chain caller if needed and returns
+ * it. Once the handler chain caller exists, this class
+ * defers getHandlers() calls to it to get the new sorted
+ * list of handlers.
+ */
+ public HandlerChainCaller getHandlerChainCaller() {
+ if (chainCaller == null) {
+ chainCaller = new HandlerChainCaller(handlers);
+ }
+ return chainCaller;
+ }
+
+ public String getBindingId(){
+ return bindingId;
+ }
+
+ public String getActualBindingId() {
+ return bindingId;
+ }
+
+ public void setServiceName(QName serviceName){
+ this.serviceName = serviceName;
+ }
+
+ public SystemHandlerDelegate getSystemHandlerDelegate() {
+ return systemHandlerDelegate;
+ }
+
+ public void setSystemHandlerDelegate(SystemHandlerDelegate delegate) {
+ systemHandlerDelegate = delegate;
+ }
+
+ public static org.jboss.com.sun.xml.ws.spi.runtime.Binding getBinding(String
bindingId,
+ Class implementorClass,
QName serviceName, boolean tokensOK) {
+
+ if (bindingId == null) {
+ // Gets bindingId from @BindingType annotation
+ bindingId = RuntimeModeler.getBindingId(implementorClass);
+ if (bindingId == null) { // Default one
+ bindingId = SOAPBinding.SOAP11HTTP_BINDING;
+ }
+ }
+ if (tokensOK) {
+ if (bindingId.equals("##SOAP11_HTTP")) {
+ bindingId = SOAPBinding.SOAP11HTTP_BINDING;
+ } else if (bindingId.equals("##SOAP11_HTTP_MTOM")) {
+ bindingId = SOAPBinding.SOAP11HTTP_MTOM_BINDING;
+ } else if (bindingId.equals("##SOAP12_HTTP")) {
+ bindingId = SOAPBinding.SOAP12HTTP_BINDING;
+ } else if (bindingId.equals("##SOAP12_HTTP_MTOM")) {
+ bindingId = SOAPBinding.SOAP12HTTP_MTOM_BINDING;
+ } else if (bindingId.equals("##XML_HTTP")) {
+ bindingId = HTTPBinding.HTTP_BINDING;
+ }
+ }
+ if (bindingId.equals(SOAPBinding.SOAP11HTTP_BINDING)
+ || bindingId.equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING)
+ || bindingId.equals(SOAPBinding.SOAP12HTTP_BINDING)
+ || bindingId.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING)
+ || bindingId.equals(SOAPBindingImpl.X_SOAP12HTTP_BINDING)) {
+ return new SOAPBindingImpl(bindingId, serviceName);
+ } else if (bindingId.equals(HTTPBinding.HTTP_BINDING)) {
+ return new HTTPBindingImpl();
+ } else {
+ throw new IllegalArgumentException("Wrong bindingId "+bindingId);
+ }
+ }
+
+ public static Binding getDefaultBinding() {
+ return new SOAPBindingImpl(SOAPBinding.SOAP11HTTP_BINDING);
+ }
+
+ public static Binding getDefaultBinding(QName serviceName) {
+ return new SOAPBindingImpl(SOAPBinding.SOAP11HTTP_BINDING, serviceName);
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/binding/BindingImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/binding/http/HTTPBindingImpl.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/binding/http/HTTPBindingImpl.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/binding/http/HTTPBindingImpl.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,71 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.binding.http;
+
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.handler.LogicalHandler;
+import javax.xml.ws.http.HTTPBinding;
+
+import org.jboss.com.sun.xml.ws.binding.BindingImpl;
+import org.jboss.com.sun.xml.ws.util.localization.Localizable;
+import org.jboss.com.sun.xml.ws.util.localization.LocalizableMessageFactory;
+import org.jboss.com.sun.xml.ws.util.localization.Localizer;
+
+import java.util.List;
+
+
+/**
+ * @author WS Development Team
+ */
+public class HTTPBindingImpl extends BindingImpl implements HTTPBinding {
+
+ public HTTPBindingImpl() {
+ super(HTTPBinding.HTTP_BINDING, null);
+ }
+
+ public HTTPBindingImpl(List<Handler> handlerChain) {
+ super(handlerChain, HTTPBinding.HTTP_BINDING, null);
+ }
+
+ /*
+ * Sets the handler chain. Only logical handlers are
+ * allowed with HTTPBinding.
+ */
+ @Override
+ public void setHandlerChain(List<Handler> chain) {
+ for (Handler handler : chain) {
+ if (!(handler instanceof LogicalHandler)) {
+ LocalizableMessageFactory messageFactory =
+ new LocalizableMessageFactory(
+ "org.jboss.com.sun.xml.ws.resources.client");
+ Localizer localizer = new Localizer();
+ Localizable locMessage =
+ messageFactory.getMessage("non.logical.handler.set",
+ handler.getClass().toString());
+ throw new WebServiceException(localizer.localize(locMessage));
+ }
+ }
+ super.setHandlerChain(chain);
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/binding/http/HTTPBindingImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/binding/soap/SOAPBindingImpl.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/binding/soap/SOAPBindingImpl.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/binding/soap/SOAPBindingImpl.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,225 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.binding.soap;
+
+
+
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPFactory;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.soap.SOAPBinding;
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.xml.ws.binding.BindingImpl;
+import org.jboss.com.sun.xml.ws.encoding.soap.streaming.SOAP12NamespaceConstants;
+import org.jboss.com.sun.xml.ws.encoding.soap.streaming.SOAPNamespaceConstants;
+import org.jboss.com.sun.xml.ws.handler.HandlerChainCaller;
+import org.jboss.com.sun.xml.ws.spi.runtime.SystemHandlerDelegate;
+import org.jboss.com.sun.xml.ws.spi.runtime.SystemHandlerDelegateFactory;
+import org.jboss.com.sun.xml.ws.util.SOAPUtil;
+import org.jboss.com.sun.xml.ws.util.localization.Localizable;
+import org.jboss.com.sun.xml.ws.util.localization.LocalizableMessageFactory;
+import org.jboss.com.sun.xml.ws.util.localization.Localizer;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+
+
+/**
+ * @author WS Development Team
+ */
+public class SOAPBindingImpl extends BindingImpl implements SOAPBinding {
+
+
+ public static final String X_SOAP12HTTP_BINDING =
+ "http://java.sun.com/xml/ns/jaxws/2003/05/soap/bindings/HTTP/";
+
+ protected static String ROLE_NONE;
+
+ protected Set<String> requiredRoles;
+ protected Set<String> roles;
+ protected boolean enableMtom = false;
+
+
+ // called by DispatchImpl
+ public SOAPBindingImpl(String bindingId, QName serviceName) {
+ super(bindingId, serviceName);
+ setup(getBindingId(), getActualBindingId());
+ setupSystemHandlerDelegate(serviceName);
+ }
+
+ public SOAPBindingImpl(String bindingId) {
+ super(bindingId, null);
+ setup(getBindingId(), getActualBindingId());
+ setupSystemHandlerDelegate(null);
+ }
+
+ public SOAPBindingImpl(List<Handler> handlerChain, String bindingId, QName
serviceName) {
+ super(handlerChain, bindingId, serviceName);
+ setup(getBindingId(), getActualBindingId());
+ setupSystemHandlerDelegate(serviceName);
+ }
+
+ // if the binding id is unknown, no roles are added
+ protected void setup(String bindingId, String actualBindingId) {
+ requiredRoles = new HashSet<String>();
+ if (bindingId.equals(SOAPBinding.SOAP11HTTP_BINDING)) {
+ requiredRoles.add(SOAPNamespaceConstants.ACTOR_NEXT);
+ } else if (bindingId.equals(SOAPBinding.SOAP12HTTP_BINDING)) {
+ requiredRoles.add(SOAP12NamespaceConstants.ROLE_NEXT);
+ requiredRoles.add(SOAP12NamespaceConstants.ROLE_ULTIMATE_RECEIVER);
+ }
+ ROLE_NONE = SOAP12NamespaceConstants.ROLE_NONE;
+ roles = new HashSet<String>();
+ addRequiredRoles();
+ setRolesOnHandlerChain();
+ if (actualBindingId.equals(SOAP11HTTP_MTOM_BINDING)
+ || actualBindingId.equals(SOAP12HTTP_MTOM_BINDING)) {
+ setMTOMEnabled(true);
+ }
+ }
+
+ /**
+ * For a non standard SOAP1.2 binding, return actual SOAP1.2 binding
+ * For SOAP 1.1 MTOM binding, return SOAP1.1 binding
+ * For SOAP 1.2 MTOM binding, return SOAP 1.2 binding
+ */
+ @Override
+ public String getBindingId() {
+ String bindingId = super.getBindingId();
+ if (bindingId.equals(SOAPBindingImpl.X_SOAP12HTTP_BINDING)) {
+ return SOAP12HTTP_BINDING;
+ }
+ if (bindingId.equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING)) {
+ return SOAP11HTTP_BINDING;
+ }
+ if (bindingId.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING)) {
+ return SOAP12HTTP_BINDING;
+ }
+ return bindingId;
+ }
+
+ /*
+ * Use this to distinguish SOAP12HTTP_BINDING or X_SOAP12HTTP_BINDING
+ */
+ @Override
+ public String getActualBindingId() {
+ return super.getBindingId();
+ }
+
+ /*
+ * When client sets a new handler chain, must also set roles on
+ * the new handler chain caller that gets created.
+ */
+ public void setHandlerChain(List<Handler> chain) {
+ super.setHandlerChain(chain);
+ setRolesOnHandlerChain();
+ }
+
+ protected void addRequiredRoles() {
+ roles.addAll(requiredRoles);
+ }
+
+ public java.util.Set<String> getRoles() {
+ return roles;
+ }
+
+ /*
+ * Adds the next and other roles in case this has
+ * been called by a user without them.
+ */
+ public void setRoles(Set<String> roles) {
+ if (roles == null) {
+ roles = new HashSet<String>();
+ }
+ if (roles.contains(ROLE_NONE)) {
+ LocalizableMessageFactory messageFactory =
+ new
LocalizableMessageFactory("org.jboss.com.sun.xml.ws.resources.client");
+ Localizer localizer = new Localizer();
+ Localizable locMessage =
+ messageFactory.getMessage("invalid.soap.role.none");
+ throw new WebServiceException(localizer.localize(locMessage));
+ }
+ this.roles = roles;
+ addRequiredRoles();
+ setRolesOnHandlerChain();
+ }
+
+
+ /**
+ * Used typically by the runtime to enable/disable Mtom optimization
+ *
+ * @return true or false
+ */
+ public boolean isMTOMEnabled() {
+ return enableMtom;
+ }
+
+ /**
+ * Client application can set if the Mtom optimization should be enabled
+ *
+ * @param b
+ */
+ public void setMTOMEnabled(boolean b) {
+ this.enableMtom = b;
+ }
+
+ public SOAPFactory getSOAPFactory() {
+ return SOAPUtil.getSOAPFactory(getBindingId());
+ }
+
+
+ public MessageFactory getMessageFactory() {
+ return SOAPUtil.getMessageFactory(getBindingId());
+ }
+
+ /**
+ * This call defers to the super class to get the
+ * handler chain caller. It then sets the roles on the
+ * caller before returning it.
+ *
+ * @see org.jboss.com.sun.xml.ws.binding.BindingImpl#getHandlerChainCaller
+ */
+ public HandlerChainCaller getHandlerChainCaller() {
+ HandlerChainCaller caller = super.getHandlerChainCaller();
+ caller.setRoles(roles);
+ return chainCaller;
+ }
+
+ protected void setRolesOnHandlerChain() {
+ if (chainCaller != null) {
+ chainCaller.setRoles(roles);
+ }
+ }
+
+ protected void setupSystemHandlerDelegate(QName serviceName) {
+ SystemHandlerDelegateFactory shdFactory =
+ SystemHandlerDelegateFactory.getFactory();
+ if (shdFactory != null) {
+ setSystemHandlerDelegate((SystemHandlerDelegate)
+ shdFactory.getDelegate(serviceName));
+ }
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/binding/soap/SOAPBindingImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/AsyncHandlerService.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/AsyncHandlerService.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/AsyncHandlerService.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,65 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.client;
+
+import javax.xml.ws.AsyncHandler;
+import javax.xml.ws.Response;
+import java.rmi.server.UID;
+import java.util.concurrent.Callable;
+import java.util.concurrent.Executor;
+
+public class AsyncHandlerService {
+
+ private AsyncHandler _handler;
+ private UID _uid;
+ private Executor _executor;
+ private WSFuture wsfuture;
+ private Response response;
+
+ public AsyncHandlerService(AsyncHandler handler, Executor executor) {
+ _uid = new UID();
+ _handler = handler;
+ _executor = executor;
+ }
+
+ public synchronized UID getUID() {
+ return _uid;
+ }
+
+ public void executeWSFuture() {
+
+ _executor.execute((Runnable) wsfuture);
+ }
+
+ public WSFuture<Object> setupAsyncCallback(final Response<Object> result)
{
+ response = result;
+
+ wsfuture = new WSFuture<Object>(new Callable<Object>() {
+
+ public Object call() throws Exception {
+ _handler.handleResponse(response);
+ return null;
+ }
+ });
+ return wsfuture;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/AsyncHandlerService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/BindingProviderProperties.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/BindingProviderProperties.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/BindingProviderProperties.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,129 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.client;
+
+import org.jboss.com.sun.xml.ws.developer.JAXWSProperties;
+
+public interface BindingProviderProperties extends JAXWSProperties{
+
+ //legacy properties
+ public static final String SERVICEIMPL_NAME = "serviceImplementationName";
+ public static final String HOSTNAME_VERIFICATION_PROPERTY =
+ "org.jboss.com.sun.xml.ws.client.http.HostnameVerificationProperty";
+ public static final String HTTP_COOKIE_JAR =
+ "org.jboss.com.sun.xml.ws.client.http.CookieJar";
+ public static final String SECURITY_CONTEXT =
+ "org.jboss.com.sun.xml.ws.security.context";
+ public static final String HTTP_STATUS_CODE =
+ "org.jboss.com.sun.xml.ws.client.http.HTTPStatusCode";
+
+ public static final String REDIRECT_REQUEST_PROPERTY =
+ "org.jboss.com.sun.xml.ws.client.http.RedirectRequestProperty";
+ public static final String SET_ATTACHMENT_PROPERTY =
+ "org.jboss.com.sun.xml.ws.attachment.SetAttachmentContext";
+ public static final String GET_ATTACHMENT_PROPERTY =
+ "org.jboss.com.sun.xml.ws.attachment.GetAttachmentContext";
+ public static final String ONE_WAY_OPERATION =
+ "org.jboss.com.sun.xml.ws.server.OneWayOperation";
+
+
+ // Proprietary
+ public static final String REQUEST_TIMEOUT =
+ "org.jboss.com.sun.xml.ws.request.timeout";
+
+ //JAXWS 2.0
+ public static final String JAXWS_RUNTIME_CONTEXT =
+ "org.jboss.com.sun.xml.ws.runtime.context";
+ public static final String JAXWS_CONTEXT_PROPERTY =
+ "org.jboss.com.sun.xml.ws.context.request";
+ public static final String JAXWS_HANDLER_CONTEXT_PROPERTY =
+ "org.jboss.com.sun.xml.ws.handler.context";
+ public static final String JAXWS_RESPONSE_CONTEXT_PROPERTY =
+ "org.jboss.com.sun.xml.ws.context.response";
+ public static final String JAXWS_CLIENT_ASYNC_HANDLER =
+ "org.jboss.com.sun.xml.ws.client.dispatch.asynchandler";
+ public static final String JAXWS_CLIENT_ASYNC_RESPONSE_CONTEXT =
+ "org.jboss.com.sun.xml.ws.client.dispatch.async.response.context";
+ public static final String JAXWS_CLIENT_HANDLE_PROPERTY =
+ "org.jboss.com.sun.xml.ws.client.handle";
+ public static final String JAXB_CONTEXT_PROPERTY =
+ "org.jboss.com.sun.xml.ws.jaxbcontext";
+
+ public static final String CLIENT_TRANSPORT_FACTORY =
+ "org.jboss.com.sun.xml.ws.client.ClientTransportFactory";
+
+ public static final String JAXB_OUTPUTSTREAM =
+ "com.sun.xml.bind.api.Bridge.outputStream";
+
+ public static final String XML_ENCODING_VALUE = "xml.encoding";
// deprecated
+ public static final String ACCEPT_ENCODING_PROPERTY = "accept.encoding";
+
+ public static final String CONTENT_TYPE_PROPERTY = "Content-Type";
+ public static final String SOAP_ACTION_PROPERTY = "SOAPAction";
+ public static final String ACCEPT_PROPERTY = "Accept";
+
+ // FI + SOAP 1.1
+ public static final String FAST_INFOSET_TYPE_SOAP11 =
+ "application/fastinfoset";
+
+ // FI + SOAP 1.2
+ public static final String FAST_INFOSET_TYPE_SOAP12 =
+ "application/soap+fastinfoset";
+
+ // XML + XOP + SOAP 1.1
+ public static final String XOP_SOAP11_XML_TYPE_VALUE =
+ "application/xop+xml;type=\"text/xml\"";
+
+ // XML + XOP + SOAP 1.2
+ public static final String XOP_SOAP12_XML_TYPE_VALUE =
+ "application/xop+xml;type=\"application/soap+xml\"";
+
+ public static final String XML_CONTENT_TYPE_VALUE = "text/xml";
+
+ public static final String SOAP12_XML_CONTENT_TYPE_VALUE =
"application/soap+xml";
+
+ public static final String STANDARD_ACCEPT_VALUE =
+ "application/xop+xml, text/html, image/gif, image/jpeg, *; q=.2, */*;
q=.2";
+
+ public static final String SOAP12_XML_ACCEPT_VALUE =
+ "application/soap+xml" + ", " + STANDARD_ACCEPT_VALUE;
+
+ public static final String XML_ACCEPT_VALUE =
+ XML_CONTENT_TYPE_VALUE + ", " + STANDARD_ACCEPT_VALUE;
+
+ public static final String XML_FI_ACCEPT_VALUE =
+ FAST_INFOSET_TYPE_SOAP11 + ", " + XML_ACCEPT_VALUE;
+
+ public static final String SOAP12_XML_FI_ACCEPT_VALUE =
+ FAST_INFOSET_TYPE_SOAP12 + ", " + SOAP12_XML_ACCEPT_VALUE;
+
+ public String DISPATCH_CONTEXT =
"org.jboss.com.sun.xml.ws.client.dispatch.context";
+ public String DISPATCH_MARSHALLER =
"org.jboss.com.sun.xml.ws.client.dispatch.marshaller";
+ public String DISPATCH_UNMARSHALLER =
"org.jboss.com.sun.xml.ws.client.dispatch.unmarshaller";
+ public static final String BINDING_ID_PROPERTY =
"org.jboss.com.sun.xml.ws.binding";
+
+// // Content negotiation property: values "none", "pessimistic"
and "optimistic"
+// public static final String CONTENT_NEGOTIATION_PROPERTY =
+// "org.jboss.com.sun.xml.ws.client.ContentNegotiation";
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/BindingProviderProperties.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ClientConfigurationException.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ClientConfigurationException.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ClientConfigurationException.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,42 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.client;
+
+import org.jboss.com.sun.xml.ws.util.exception.JAXWSExceptionBase;
+
+/**
+ * @author Vivek Pandey
+ */
+public class ClientConfigurationException extends JAXWSExceptionBase {
+ public ClientConfigurationException(String key, Object... args) {
+ super(key, args);
+ }
+
+ public ClientConfigurationException(Throwable throwable) {
+ super(throwable);
+ }
+
+ public String getResourceBundleName() {
+ return "org.jboss.com.sun.xml.ws.resources.client";
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ClientConfigurationException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ClientTransportException.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ClientTransportException.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ClientTransportException.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,44 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.client;
+
+import org.jboss.com.sun.xml.ws.util.exception.JAXWSExceptionBase;
+import org.jboss.com.sun.xml.ws.util.localization.Localizable;
+
+
+/**
+ * @author WS Development Team
+ */
+public class ClientTransportException extends JAXWSExceptionBase {
+ public ClientTransportException(String key, Object... args) {
+ super(key, args);
+ }
+
+ public ClientTransportException(Throwable throwable) {
+ super(throwable);
+ }
+
+ public String getResourceBundleName() {
+ return "org.jboss.com.sun.xml.ws.resources.client";
+ }
+}
+
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ClientTransportException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ContactInfoBase.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ContactInfoBase.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ContactInfoBase.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,134 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.client;
+
+
+import javax.xml.ws.soap.SOAPBinding;
+
+import org.jboss.com.sun.xml.ws.encoding.internal.InternalEncoder;
+import org.jboss.com.sun.xml.ws.encoding.soap.ClientEncoderDecoder;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPDecoder;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPEPTFactory;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPEncoder;
+import org.jboss.com.sun.xml.ws.pept.encoding.Decoder;
+import org.jboss.com.sun.xml.ws.pept.encoding.Encoder;
+import org.jboss.com.sun.xml.ws.pept.ept.ContactInfo;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.pept.presentation.TargetFinder;
+import org.jboss.com.sun.xml.ws.pept.protocol.Interceptors;
+import org.jboss.com.sun.xml.ws.pept.protocol.MessageDispatcher;
+import org.jboss.com.sun.xml.ws.spi.runtime.WSConnection;
+
+
+/**
+ * @author WS Development Team
+ */
+public class ContactInfoBase implements ContactInfo, SOAPEPTFactory {
+ protected WSConnection _connection;
+ protected MessageDispatcher _messageDispatcher;
+ protected Encoder _encoder;
+ protected Decoder _decoder;
+ private String bindingId;
+ private InternalEncoder internalEncoder;
+
+ public ContactInfoBase(WSConnection connection,
+ MessageDispatcher messageDispatcher, Encoder encoder, Decoder
decoder,
+ String bindingId) {
+ _connection = connection;
+ _messageDispatcher = messageDispatcher;
+ _encoder = encoder;
+ _decoder = decoder;
+ internalEncoder = new ClientEncoderDecoder();
+ this.bindingId = bindingId;
+ }
+
+ public ContactInfoBase() {
+ _connection = null;
+ _messageDispatcher = null;
+ _encoder = null;
+ _decoder = null;
+ }
+
+ /* (non-Javadoc)
+ * @see com.sun.pept.ept.ContactInfo#getConnection(com.sun.pept.ept.MessageInfo)
+ */
+ public WSConnection getConnection(MessageInfo arg0) {
+ return _connection;
+ }
+
+ /* (non-Javadoc)
+ * @see
com.sun.pept.ept.EPTFactory#getMessageDispatcher(com.sun.pept.ept.MessageInfo)
+ */
+ public MessageDispatcher getMessageDispatcher(MessageInfo arg0) {
+ return _messageDispatcher;
+ }
+
+ /* (non-Javadoc)
+ * @see com.sun.pept.ept.EPTFactory#getEncoder(com.sun.pept.ept.MessageInfo)
+ */
+ public Encoder getEncoder(MessageInfo arg0) {
+ return _encoder;
+ }
+
+ /* (non-Javadoc)
+ * @see com.sun.pept.ept.EPTFactory#getDecoder(com.sun.pept.ept.MessageInfo)
+ */
+ public Decoder getDecoder(MessageInfo arg0) {
+ return _decoder;
+ }
+
+ /* (non-Javadoc)
+ * @see com.sun.pept.ept.EPTFactory#getInterceptors(com.sun.pept.ept.MessageInfo)
+ */
+ public Interceptors getInterceptors(MessageInfo arg0) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see com.sun.pept.ept.EPTFactory#getTargetFinder(com.sun.pept.ept.MessageInfo)
+ */
+ public TargetFinder getTargetFinder(MessageInfo arg0) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public SOAPEncoder getSOAPEncoder() {
+ return (SOAPEncoder) _encoder;
+ }
+
+ public SOAPDecoder getSOAPDecoder() {
+ return (SOAPDecoder) _decoder;
+ }
+
+ public InternalEncoder getInternalEncoder() {
+ return internalEncoder;
+ }
+
+ public String getBindingId() {
+ if (bindingId == null) {
+ return SOAPBinding.SOAP11HTTP_BINDING;
+ }
+
+ return bindingId;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ContactInfoBase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ContactInfoListImpl.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ContactInfoListImpl.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ContactInfoListImpl.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,63 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.client;
+
+
+import javax.xml.ws.soap.SOAPBinding;
+
+import org.jboss.com.sun.xml.ws.encoding.soap.client.SOAP12XMLDecoder;
+import org.jboss.com.sun.xml.ws.encoding.soap.client.SOAP12XMLEncoder;
+import org.jboss.com.sun.xml.ws.encoding.soap.client.SOAPXMLDecoder;
+import org.jboss.com.sun.xml.ws.encoding.soap.client.SOAPXMLEncoder;
+import org.jboss.com.sun.xml.ws.pept.ept.ContactInfoList;
+import org.jboss.com.sun.xml.ws.pept.ept.ContactInfoListIterator;
+import org.jboss.com.sun.xml.ws.protocol.soap.client.SOAPMessageDispatcher;
+import org.jboss.com.sun.xml.ws.protocol.xml.client.XMLMessageDispatcher;
+
+import java.util.ArrayList;
+
+/**
+ * @author WS Development Team
+ * List of {@link com.sun.pept.ept.ContactInfo}s
+ */
+public class ContactInfoListImpl implements ContactInfoList {
+ private static final ArrayList arrayList = new ArrayList();
+ static {
+ arrayList.add(new ContactInfoBase(null,
+ new SOAPMessageDispatcher(),
+ new SOAPXMLEncoder(),
+ new SOAPXMLDecoder(), SOAPBinding.SOAP11HTTP_BINDING));
+ arrayList.add(new ContactInfoBase(null,
+ new SOAPMessageDispatcher(),
+ new SOAP12XMLEncoder(),
+ new SOAP12XMLDecoder(), SOAPBinding.SOAP12HTTP_BINDING));
+ }
+
+ /**
+ * Iterator over the list of {@link com.sun.pept.ept.ContactInfo}s
+ * @see com.sun.pept.ept.ContactInfoList#iterator()
+ */
+ public ContactInfoListIterator iterator() {
+ return new ContactInfoListIteratorBase(arrayList);
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ContactInfoListImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ContactInfoListIteratorBase.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ContactInfoListIteratorBase.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ContactInfoListIteratorBase.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,52 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.client;
+
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.jboss.com.sun.xml.ws.pept.ept.ContactInfo;
+import org.jboss.com.sun.xml.ws.pept.ept.ContactInfoListIterator;
+
+
+/**
+ * @author WS Development Team
+ */
+public class ContactInfoListIteratorBase implements ContactInfoListIterator {
+ private Iterator iterator;
+
+ public ContactInfoListIteratorBase(ArrayList list) {
+ iterator = list.iterator();
+ }
+
+ public ContactInfo next() {
+ return (ContactInfo) iterator.next();
+ }
+
+ /* (non-Javadoc)
+ * @see com.sun.pept.ept.ContactInfoListIterator#hasNext()
+ */
+ public boolean hasNext() {
+ return iterator.hasNext();
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ContactInfoListIteratorBase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ContentNegotiation.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ContentNegotiation.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ContentNegotiation.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,68 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.client;
+
+import static
org.jboss.com.sun.xml.ws.client.BindingProviderProperties.CONTENT_NEGOTIATION_PROPERTY;
+
+import java.util.Map;
+
+import org.jboss.com.sun.xml.ws.pept.presentation.MessageStruct;
+
+public class ContentNegotiation {
+
+ /**
+ * Initializes content negotiation property in
<code>MessageStruct</code>
+ * based on request context and system properties.
+ */
+ static public void initialize(Map context, MessageStruct messageStruct) {
+ String value = (String) context.get(CONTENT_NEGOTIATION_PROPERTY);
+ if (value != null) {
+ if (value.equals("none") || value.equals("pessimistic")
|| value.equals("optimistic")) {
+ messageStruct.setMetaData(CONTENT_NEGOTIATION_PROPERTY, value.intern());
+ } else {
+ throw new
SenderException("sender.request.illegalValueForContentNegotiation", value);
+ }
+ } else {
+ initFromSystemProperties(context, messageStruct);
+ }
+ }
+
+ /**
+ * Initializes content negotiation property in
<code>MessageStruct</code>
+ * based on system property of the same name.
+ */
+ static public void initFromSystemProperties(Map context, MessageStruct
messageStruct)
+ throws SenderException {
+ String value = System.getProperty(CONTENT_NEGOTIATION_PROPERTY);
+
+ if (value == null) {
+ messageStruct.setMetaData(
+ CONTENT_NEGOTIATION_PROPERTY, "none"); // FI is off by
default
+ } else if (value.equals("none") ||
value.equals("pessimistic") || value.equals("optimistic")) {
+ messageStruct.setMetaData(CONTENT_NEGOTIATION_PROPERTY, value.intern());
+ context.put(CONTENT_NEGOTIATION_PROPERTY, value.intern());
+ } else {
+ throw new
SenderException("sender.request.illegalValueForContentNegotiation", value);
+ }
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ContentNegotiation.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ContextMap.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ContextMap.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ContextMap.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,246 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.client;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.ws.BindingProvider;
+import static javax.xml.ws.BindingProvider.*;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.MessageContext;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+public abstract class ContextMap extends HashMap<String,Object>
+ implements BindingProviderProperties {
+
+ /**
+ * Read-only list of known properties.
+ */
+ private static final Set<String> KNOWN_PROPERTIES;
+
+ private static final HashMap<String,Class> _allowedClass = new
HashMap<String, Class>();
+
+ protected BindingProvider _owner;
+ protected PortInfoBase portInfo;
+
+ public abstract ContextMap copy();
+
+ static {
+ //JAXWS 2.0 defined
+ _allowedClass.put(USERNAME_PROPERTY, java.lang.String.class);
+ _allowedClass.put(PASSWORD_PROPERTY, java.lang.String.class);
+ _allowedClass.put(ENDPOINT_ADDRESS_PROPERTY, java.lang.String.class);
+ _allowedClass.put(SESSION_MAINTAIN_PROPERTY, java.lang.Boolean.class);
+ _allowedClass.put(SOAPACTION_USE_PROPERTY, java.lang.Boolean.class);
+ _allowedClass.put(SOAPACTION_URI_PROPERTY, java.lang.String.class);
+
+ //now defined in jaxwscontext
+ _allowedClass.put(BindingProviderProperties.JAXB_CONTEXT_PROPERTY,
JAXBContext.class);
+
+ Set<String> temp = new HashSet<String>();
+ //JAXWS 2.0 defined
+ temp.add(USERNAME_PROPERTY);
+ temp.add(PASSWORD_PROPERTY);
+ temp.add(ENDPOINT_ADDRESS_PROPERTY);
+ temp.add(SESSION_MAINTAIN_PROPERTY);
+ temp.add(SOAPACTION_USE_PROPERTY);
+ temp.add(SOAPACTION_URI_PROPERTY);
+
+ temp.add(BindingProviderProperties.JAXB_CONTEXT_PROPERTY);
+ //implementation specific
+ temp.add(BindingProviderProperties.ACCEPT_ENCODING_PROPERTY);
+ temp.add(BindingProviderProperties.CLIENT_TRANSPORT_FACTORY);
+ //used to get stub in runtime for handler chain
+ temp.add(BindingProviderProperties.JAXWS_CLIENT_HANDLE_PROPERTY);
+ temp.add(BindingProviderProperties.JAXWS_CLIENT_HANDLE_PROPERTY);
+
+ //JAXRPC 1.0 - 1.1 DEFINED - implementation specific
+ temp.add(BindingProviderProperties.HTTP_COOKIE_JAR);
+ temp.add(BindingProviderProperties.ONE_WAY_OPERATION);
+ temp.add(BindingProviderProperties.HTTP_STATUS_CODE);
+ temp.add(BindingProviderProperties.HOSTNAME_VERIFICATION_PROPERTY);
+ temp.add(BindingProviderProperties.REDIRECT_REQUEST_PROPERTY);
+ temp.add(BindingProviderProperties.SECURITY_CONTEXT);
+ temp.add(BindingProviderProperties.SET_ATTACHMENT_PROPERTY);
+ temp.add(BindingProviderProperties.GET_ATTACHMENT_PROPERTY);
+ //Tod:check with mark regarding property modification
+ //KNOWN_PROPERTIES = Collections.unmodifiableSet(temp);
+
+ temp.add(MessageContext.INBOUND_MESSAGE_ATTACHMENTS);
+ temp.add(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);
+ temp.add(MessageContext.WSDL_DESCRIPTION);
+ temp.add(MessageContext.WSDL_INTERFACE);
+ temp.add(MessageContext.WSDL_OPERATION);
+ temp.add(MessageContext.WSDL_PORT);
+ temp.add(MessageContext.WSDL_SERVICE);
+ temp.add(MessageContext.HTTP_REQUEST_METHOD);
+ temp.add(MessageContext.HTTP_REQUEST_HEADERS);
+ temp.add(MessageContext.HTTP_RESPONSE_CODE);
+ temp.add(MessageContext.HTTP_RESPONSE_HEADERS);
+ temp.add(MessageContext.PATH_INFO);
+ temp.add(MessageContext.QUERY_STRING);
+ // Content negotiation property for FI -- "none",
"pessimistic", "optimistic"
+ temp.add(BindingProviderProperties.CONTENT_NEGOTIATION_PROPERTY);
+ temp.add(BindingProviderProperties.MTOM_THRESHOLOD_VALUE);
+ KNOWN_PROPERTIES = temp;
+ }
+
+ //used for dispatch
+ public ContextMap(PortInfoBase info, BindingProvider provider) {
+ _owner = provider;
+ if (info != null) {
+ this.portInfo = info;
+ }
+ }
+
+ /**
+ * Copy constructor.
+ */
+ public ContextMap(ContextMap original) {
+ super(original);
+ this._owner = original._owner;
+ }
+
+ //may not need this
+ public ContextMap(BindingProvider owner) {
+ this(null, owner);
+ }
+
+ boolean doValidation() {
+ return _owner != null;
+ }
+
+ public Object put(String name, Object value) {
+ if (doValidation()) {
+ validateProperty(name, value, true);
+ return super.put(name, value);
+ }
+ return null;
+ }
+
+ public Object get(String name) {
+ if (doValidation()) {
+ validateProperty(name, null, false);
+ return super.get(name);
+ }
+ return null;
+ }
+
+ public Iterator<String> getPropertyNames() {
+ return keySet().iterator();
+ }
+
+
+ public Object remove(String name) {
+ if (doValidation()) {
+ validateProperty(name, null, false);
+ return super.remove(name);
+ }
+ return null;
+ }
+
+ private boolean isAllowedValue(String name, Object value) {
+ if ( name.equals(MessageContext.PATH_INFO) ||
+ name.equals(MessageContext.QUERY_STRING))
+ return true;
+
+ if (value == null)
+ return false;
+
+ return true;
+ }
+// no value check needed today
+// Object[] values = _allowedValues.get(name);
+// if (values != null) {
+// boolean allowed = false;
+// for (Object o : values) {
+// if (STRING_CLASS.isInstance(o) &&
(STRING_CLASS.isInstance(value))) {
+// if (((java.lang.String) o).equalsIgnoreCase((java.lang.String)
value)) {
+// allowed = true;
+// break;
+// }
+// } else if (BOOLEAN_CLASS.isInstance(o) &&
(BOOLEAN_CLASS.isInstance(value))) {
+// if (Boolean.FALSE.equals(o) || Boolean.TRUE.equals(o)) {
+// allowed = true;
+// break;
+// }
+// } else {
+// //log this
+// }
+// }
+// return allowed;
+// }
+
+
+
+ private boolean isAllowedClass(String propName, Object value) {
+
+ Class allowedClass = _allowedClass.get(propName);
+ if (allowedClass != null) {
+ return allowedClass.isInstance(value);
+ }
+ return true;
+ }
+
+ private void validateProperty(String name, Object value, boolean isSetter) {
+ if (name == null)
+ throw new WebServiceException(name + " is a User-defined property -
property name can not be null. ",
+ new IllegalArgumentException("Name of property is null. This is an
invalid property name. "));
+
+ /* Spec clarifies that this check is not needed.
+ if (!KNOWN_PROPERTIES.contains(name)) {
+ //do validation check on not "javax.xml.ws."
+ if (name.startsWith("javax.xml.ws"))
+ throw new WebServiceException(name + " is a User-defined property -
can not start with javax.xml.ws. package",
+ new IllegalArgumentException("can not start with javax.xml.ws.
package")); //let's check the
propertyContext
+ }
+ */
+ //is it alreadySet
+ //Object currentPropValue = get(name);
+ //if (currentPropValue != null) {
+ // if (!isDynamic(name))
+ // throw new WebServiceException("Property bound to Binding
Instance",
+ // new IllegalArgumentException("Cannot overwrite the Static
Property"));
+ //}
+
+ if (isSetter) {
+ if (!isAllowedClass(name, value))
+ throw new WebServiceException(value + " is Not Allowed Class for
property " + name,
+ new IllegalArgumentException("Not Allowed Class for
property"));
+
+ if (!isAllowedValue(name, value))
+ throw new WebServiceException(value + " is Not Allowed Value for
property " + name,
+ new IllegalArgumentException("Not Allowed value"));
+ }
+
+ }
+
+ //currently not used
+ /* public static enum StyleAndUse {
+ RPC_LITERAL,
+ DOCLIT_WRAPPER_STYLE, DOCLIT_NONWRAPPER_STYLE
+ }
+*/
+}
+
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ContextMap.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/EndpointIFBase.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/EndpointIFBase.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/EndpointIFBase.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,135 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.client;
+
+
+import javax.xml.ws.Binding;
+import javax.xml.ws.BindingProvider;
+
+import org.jboss.com.sun.xml.ws.binding.BindingImpl;
+import org.jboss.com.sun.xml.ws.pept.Delegate;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.spi.runtime.ClientTransportFactory;
+import org.jboss.com.sun.xml.ws.transport.http.client.HttpClientTransportFactory;
+
+import java.util.Map;
+
+/**
+ * @author WS Development Team
+ */
+public class EndpointIFBase implements org.jboss.com.sun.xml.ws.pept.presentation.Stub,
+ org.jboss.com.sun.xml.ws.spi.runtime.StubBase, BindingProvider,
InternalBindingProvider {
+
+ protected Map<String, Object> _requestContext;
+ protected Map<String, Object> _responseContext;
+
+ protected String _bindingId = null;
+ protected Delegate _delegate = null;
+ protected BindingImpl binding;
+
+ private ClientTransportFactory _transportFactory;
+
+ void setResponseContext(ResponseContext context) {
+ _responseContext = context;
+ }
+
+ public void _setDelegate(Delegate delegate) {
+ _delegate = delegate;
+ }
+
+ public Delegate _getDelegate() {
+ return _delegate;
+ }
+
+ public ClientTransportFactory _getTransportFactory() {
+ _transportFactory =
+
(org.jboss.com.sun.xml.ws.spi.runtime.ClientTransportFactory)getRequestContext().get(BindingProviderProperties.CLIENT_TRANSPORT_FACTORY);
+
+ if (_transportFactory == null) {
+ _transportFactory = new HttpClientTransportFactory();
+ }
+ return _transportFactory;
+ }
+
+ public void _setTransportFactory(ClientTransportFactory f) {
+ getRequestContext().put(BindingProviderProperties.CLIENT_TRANSPORT_FACTORY, f);
+ _transportFactory = f;
+ }
+
+ //toDo: have to update generator on PeptStub to getContext
+ public void updateResponseContext(MessageInfo messageInfo) {
+ ResponseContext responseContext = (ResponseContext)
+
messageInfo.getMetaData(BindingProviderProperties.JAXWS_RESPONSE_CONTEXT_PROPERTY);
+ if (responseContext != null) { // null in async case
+ setResponseContext(responseContext);
+ }
+ }
+
+ /**
+ * Get the JAXWSContext that is used in processing request messages.
+ * <p/>
+ * Modifications to the request context do not affect asynchronous
+ * operations that have already been started.
+ *
+ * @return The JAXWSContext that is used in processing request messages.
+ */
+ public Map<String, Object> getRequestContext() {
+ if (_requestContext == null)
+ _requestContext = new RequestContext(this);
+
+ return _requestContext;
+ }
+
+ /**
+ * Get the JAXWSContext that resulted from processing a response message.
+ * <p/>
+ * The returned context is for the most recently completed synchronous
+ * operation. Subsequent synchronous operation invocations overwrite the
+ * response context. Asynchronous operations return their response context
+ * via the Response interface.
+ *
+ * @return The JAXWSContext that is used in processing request messages.
+ */
+ public Map<String, Object> getResponseContext() {
+ if (_responseContext == null)
+ _responseContext = new ResponseContext(this);
+ return _responseContext;
+ }
+
+ public Binding getBinding() {
+ return binding;
+ }
+
+ public void _setBinding(BindingImpl binding) {
+ this.binding = binding;
+ }
+
+ /**
+ * returns binding id from BindingImpl
+ *
+ * @return the String representing the BindingID
+ */
+ public String _getBindingId() {
+ return _bindingId;
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/EndpointIFBase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/EndpointIFContext.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/EndpointIFContext.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/EndpointIFContext.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,121 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.client;
+
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.handler.Handler;
+
+import org.jboss.com.sun.xml.ws.server.RuntimeContext;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * $author: WS Development Team
+ */
+public class EndpointIFContext {
+
+ private RuntimeContext runtimeContext; //from annotationPro ess
+ private Class serviceInterface; //prop can take out
+ private QName serviceName;
+ private Class sei;
+ private QName portName;
+ private ArrayList<Handler> handlers;
+ private String endpointAddress;
+ private String bindingId;
+
+
+ public EndpointIFContext(Class sei) {
+ this.sei = sei;
+ handlers = new ArrayList();
+ }
+
+ public RuntimeContext getRuntimeContext() {
+ return runtimeContext;
+ }
+
+ public void setRuntimeContext(RuntimeContext runtimeContext) {
+ this.runtimeContext = runtimeContext;
+ }
+
+ public Class getServiceInterface() {
+ return serviceInterface;
+ }
+
+ public void setServiceInterface(Class serviceInterface) {
+ this.serviceInterface = serviceInterface;
+ }
+
+ public Class getSei() {
+ return sei;
+ }
+
+ public void setSei(Class sei) {
+ this.sei = sei;
+ }
+
+ public QName getPortName() {
+ if (portName == null){
+ if ((runtimeContext != null) && (runtimeContext.getModel() != null))
+ portName = runtimeContext.getModel().getPortName();
+ }
+ return portName;
+ }
+
+ public String getEndpointAddress() {
+ return endpointAddress;
+ }
+
+ public void setPortInfo(QName portQName, String endpoint, String bindingID) {
+ portName = portQName;
+ endpointAddress = endpoint;
+ this.bindingId = bindingID;
+ }
+
+ public String getBindingID() {
+ return bindingId;
+ }
+
+ public QName getServiceName() {
+ return serviceName;
+ }
+
+ public boolean contains(QName serviceName) {
+ if (serviceName.equals(this.serviceName))
+ return true;
+ return false;
+ }
+
+ public void setServiceName(QName serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ public void setPortName(QName portName) {
+ this.portName = portName;
+ }
+
+ public void setBindingID(String bindingId) {
+ this.bindingId = bindingId;
+ }
+}
\ No newline at end of file
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/EndpointIFContext.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/EndpointIFInvocationHandler.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/EndpointIFInvocationHandler.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/EndpointIFInvocationHandler.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,214 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.client;
+
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.AsyncHandler;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.Service;
+
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.DelegateBase;
+import org.jboss.com.sun.xml.ws.model.JavaMethod;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.pept.presentation.MessageStruct;
+import org.jboss.com.sun.xml.ws.server.RuntimeContext;
+import org.jboss.com.sun.xml.ws.wsdl.WSDLContext;
+import org.jboss.com.sun.xml.ws.wsdl.parser.PortType;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.util.concurrent.Executor;
+
+public class EndpointIFInvocationHandler
+ extends EndpointIFBase
+ implements InvocationHandler,
org.jboss.com.sun.xml.ws.client.BindingProviderProperties {
+
+ Object _proxy;
+ DelegateBase _delegate;
+
+ EndpointIFContext _endpointContext;
+
+ Class _portInterface;
+ QName _serviceQName;
+
+ RuntimeContext _rtcontext;
+ WSDLContext _wsdlContext;
+ boolean failure;
+ URL wsdlDocumentLocation;
+ WSServiceDelegate _service;
+
+ /**
+ * public constructor
+ */
+
+ public EndpointIFInvocationHandler(Class portInterface, EndpointIFContext eif,
WSServiceDelegate service, QName serviceName) {
+
+ if ((eif.getBindingID() == null) || (eif.getRuntimeContext() == null)) {
+ failure = true;
+ return;
+ }
+ _endpointContext = eif;
+ _portInterface = portInterface;
+ _rtcontext = eif.getRuntimeContext();
+ _bindingId = eif.getBindingID();
+ _service = service;
+
+ if (serviceName != null) {
+ if (eif.contains(serviceName))
+ _serviceQName = serviceName;
+ else
+ throw new WebServiceException("Supplied service QName " +
+ serviceName + " does not exist in this wsdl.");
+ } else
+ _serviceQName =
+ eif.getServiceName();
+
+ if (eif.getEndpointAddress() != null) //temp workaround for local transport kw
+ getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+ eif.getEndpointAddress());
+
+ ContactInfoListImpl cil = new ContactInfoListImpl();
+ //not sure I need this service argument
+ _delegate = new DelegateBase(cil, service);
+ }
+
+ public void setModel(RuntimeContext rtcontext) {
+ _rtcontext = rtcontext;
+ }
+
+ public void setProxy(Object p) {
+ _proxy = p;
+ }
+
+ public Object invoke(Object proxy, Method method, Object[] args) throws
WebServiceException, Throwable {
+
+ try {
+ if (isSEIMethod(method, _portInterface)) {
+ return implementSEIMethod(method, args);
+ } else {
+ return method.invoke(this, args);
+ }
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ }
+ }
+
+ /**
+ * Gets a new {@link org.jboss.com.sun.xml.ws.pept.presentation.MessageStruct} from
the Delegate, copies
+ * the data and metadata into the newly created MessageStruct, invokes Delegate.send,
and
+ * returns the response.
+ */
+ public Object implementSEIMethod(Method method, Object[] parameters) throws Throwable
{
+
+ MessageStruct messageStruct = _delegate.getMessageStruct();
+ int mmep = 0;
+ if (_rtcontext != null) {
+ JavaMethod jmethod = _rtcontext.getModel().getJavaMethod(method);
+ if (jmethod != null) {
+ int mep = jmethod.getMEP();
+ mmep = (mep == MessageStruct.REQUEST_RESPONSE_MEP) ?
+ MessageStruct.REQUEST_RESPONSE_MEP : (mep ==
MessageStruct.ONE_WAY_MEP) ?
+ MessageStruct.ONE_WAY_MEP : ((mep == MessageStruct.ASYNC_POLL_MEP) ?
+ MessageStruct.ASYNC_POLL_MEP : MessageStruct.ASYNC_CALLBACK_MEP);
+ } else throw new WebServiceException("runtime model information for java
Method " + method.getName() + " is not known .");
+ } //need to check if this is dispatch invocation
+
+ if (mmep == MessageStruct.ASYNC_CALLBACK_MEP) {
+ for (Object param : parameters) {
+ if (param != null &&
AsyncHandler.class.isAssignableFrom(param.getClass())) {
+
//messageStruct.setMetaData(BindingProviderProperties.JAXWS_CLIENT_ASYNC_HANDLER, param);
+
messageStruct.setMetaData(BindingProviderProperties.JAXWS_CLIENT_ASYNC_HANDLER,
+ new AsyncHandlerService((AsyncHandler)param,
getCurrentExecutor()));
+ }
+ }
+ }
+
+ messageStruct.setMethod(method);
+ messageStruct.setData(parameters);
+ RequestContext requestContext = (RequestContext)(java.util.Map)
+ ((BindingProvider) _proxy).getRequestContext();
+ requestContext.put(JAXWS_CLIENT_HANDLE_PROPERTY, _proxy);
+ messageStruct.setMetaData(JAXWS_RUNTIME_CONTEXT, _rtcontext);
+ messageStruct.setMetaData(JAXWS_CONTEXT_PROPERTY, requestContext);
+
+ //set mtom threshold value to
+ Object mtomThreshold = requestContext.get(MTOM_THRESHOLOD_VALUE);
+ messageStruct.setMetaData(MTOM_THRESHOLOD_VALUE, mtomThreshold);
+
+ messageStruct.setMEP(mmep);
+
+ // Initialize content negotiation property
+ ContentNegotiation.initialize(requestContext, messageStruct);
+
+ // Set MTOM processing for XML requests only
+ if (_rtcontext != null && _rtcontext.getModel() != null) {
+ javax.xml.ws.soap.SOAPBinding sb =
+ (binding instanceof javax.xml.ws.soap.SOAPBinding) ?
+ (javax.xml.ws.soap.SOAPBinding) binding : null;
+ if (sb != null) {
+ _rtcontext.getModel().enableMtom(sb.isMTOMEnabled());
+ }
+ }
+
+ _delegate.send(messageStruct);
+ updateResponseContext((MessageInfo) messageStruct);
+ switch (messageStruct.getResponseType()) {
+ case MessageStruct.NORMAL_RESPONSE:
+ break;
+ case MessageStruct.CHECKED_EXCEPTION_RESPONSE:
+ if (_rtcontext.getModel().isCheckedException(method,
messageStruct.getResponse().getClass()))
+ throw (Throwable) messageStruct.getResponse();
+ throw (Exception) messageStruct.getResponse();
+ case MessageStruct.UNCHECKED_EXCEPTION_RESPONSE:
+ throw (RuntimeException) messageStruct.getResponse();
+ }
+ return messageStruct.getResponse();
+ }
+
+ boolean isSEIMethod(Method method, Class sei) {
+ return (sei.equals(method.getDeclaringClass())) ? true : false;
+ }
+
+ public EndpointIFContext getEndpointContext() {
+ return _endpointContext;
+ }
+
+ public QName getServiceQName() {
+ return _serviceQName;
+ }
+
+ public Class getPortInterface(){
+ return _portInterface;
+ }
+
+ Executor getCurrentExecutor(){
+ return _service.getExecutor();
+ }
+
+ public QName getWSDLPortTypeQName(){
+ return
_service.getWSDLBinding(_endpointContext.getPortName()).getPortTypeName();
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/EndpointIFInvocationHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/InternalBindingProvider.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/InternalBindingProvider.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/InternalBindingProvider.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,36 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.client;
+
+import org.jboss.com.sun.xml.ws.binding.BindingImpl;
+
+
+/**
+ * A utility interface for all the classes
+ * that implement BindingProvider.
+ *
+ * @see WebService#setBindingOnProvider(InternalBindingProvider,
+ * QName, String)
+ */
+public interface InternalBindingProvider {
+ public void _setBinding(BindingImpl binding);
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/InternalBindingProvider.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/PortInfoBase.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/PortInfoBase.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/PortInfoBase.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,84 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.client;
+
+import javax.xml.namespace.QName;
+
+/**
+ * JAXWS Development Team
+ */
+public class PortInfoBase {
+
+ protected String targetEndpoint;
+ protected String defaultNamespace;
+ protected QName name;
+ protected QName portTypeName;
+ protected String bindingId;
+
+ public PortInfoBase(QName name) {
+ this.name = name;
+ targetEndpoint = "";
+ defaultNamespace = "";
+ }
+
+ public PortInfoBase(String targetEndpoint, QName name, String bindingId) {
+ this.targetEndpoint = targetEndpoint;
+ this.name = name;
+ this.bindingId = bindingId;
+ }
+
+ void setName(QName nm) {
+ name = nm;
+ }
+
+ public QName getName() {
+ return name;
+ }
+
+ void setTargetEndpoint(String endpoint) {
+ targetEndpoint = endpoint;
+ }
+
+ public String getTargetEndpoint() {
+ return targetEndpoint;
+ }
+
+ void setBindingId(String id) {
+ bindingId = id;
+ }
+
+ public String getBindingId() {
+ return bindingId;
+ }
+
+ void setPortTypeName(QName typeName) {
+ portTypeName = typeName;
+ }
+
+ public QName getPortTypeName() {
+ return portTypeName;
+ }
+
+ void setDefaultNamespace(String namespace) {
+ defaultNamespace = namespace;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/PortInfoBase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/RequestContext.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/RequestContext.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/RequestContext.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,47 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.client;
+
+import javax.xml.ws.BindingProvider;
+
+
+public class RequestContext extends ContextMap {
+
+ public RequestContext(BindingProvider provider) {
+ super(provider);
+ }
+
+ public RequestContext(PortInfoBase port, BindingProvider provider) {
+ super(port, provider);
+ }
+
+ /**
+ * Copy constructor.
+ */
+ private RequestContext(RequestContext original) {
+ super(original);
+ }
+
+ public RequestContext copy() {
+ return new RequestContext(this);
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/RequestContext.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ResponseContext.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ResponseContext.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ResponseContext.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,42 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.client;
+
+import javax.xml.ws.BindingProvider;
+
+
+public class ResponseContext extends ContextMap {
+ public ResponseContext(BindingProvider provider) {
+ super(provider);
+ }
+
+ /**
+ * Copy constructor.
+ */
+ private ResponseContext(ResponseContext original) {
+ super(original);
+ }
+
+ public ResponseContext copy() {
+ return new ResponseContext(this);
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ResponseContext.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/SenderException.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/SenderException.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/SenderException.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,47 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.client;
+
+import org.jboss.com.sun.xml.ws.util.exception.JAXWSExceptionBase;
+import org.jboss.com.sun.xml.ws.util.localization.Localizable;
+
+
+/**
+ * @author WS Development Team
+ */
+public class SenderException extends JAXWSExceptionBase {
+ public SenderException(String key, Object... args) {
+ super(key, args);
+ }
+
+ public SenderException(Throwable throwable) {
+ super(throwable);
+ }
+
+ public SenderException(Localizable arg) {
+ super("sender.nestedError", arg);
+ }
+
+ public String getResourceBundleName() {
+ return "org.jboss.com.sun.xml.ws.resources.sender";
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/SenderException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ServiceContext.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ServiceContext.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ServiceContext.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,145 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.client;
+
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.xml.ws.handler.HandlerResolverImpl;
+import org.jboss.com.sun.xml.ws.wsdl.WSDLContext;
+import org.xml.sax.EntityResolver;
+
+
+/**
+ * $author: WS Development Team
+ */
+public class ServiceContext {
+ private WSDLContext wsdlContext; //from wsdlParsing
+
+ private Class serviceClass;
+ private HandlerResolverImpl handlerResolver;
+ private QName serviceName; //supplied on creation of service
+ private final HashSet<EndpointIFContext> seiContext = new
HashSet<EndpointIFContext>();
+ /**
+ * To be used to resolve WSDL resources.
+ */
+ private final EntityResolver entityResolver;
+ private HashMap<QName,Set<String>> rolesMap = new
HashMap<QName,Set<String>>();
+ public ServiceContext(EntityResolver entityResolver) {
+ this.entityResolver = entityResolver;
+ }
+
+ public ServiceContext(Class serviceClass, QName serviceName, EntityResolver
entityResolver) {
+ this.serviceClass = serviceClass;
+ this.serviceName = serviceName;
+ this.entityResolver = entityResolver;
+ }
+
+ public WSDLContext getWsdlContext() {
+ return wsdlContext;
+ }
+
+ public void setWsdlContext(WSDLContext wsdlContext) {
+ this.wsdlContext = wsdlContext;
+ }
+
+ public HandlerResolverImpl getHandlerResolver() {
+ return handlerResolver;
+ }
+
+ public void setHandlerResolver(HandlerResolverImpl resolver) {
+ this.handlerResolver = resolver;
+ }
+
+ public Set<String> getRoles(QName portName) {
+ return rolesMap.get(portName);
+ }
+
+ public void setRoles(QName portName,Set<String> roles) {
+ rolesMap.put(portName,roles);
+ }
+
+ public EndpointIFContext getEndpointIFContext(String className) {
+ for (EndpointIFContext eif: seiContext){
+ if (eif.getSei().getName().equals(className)){
+ //this is the one
+ return eif;
+ }
+ }
+ return null;
+ }
+
+ public HashSet<EndpointIFContext> getEndpointIFContext() {
+ return seiContext;
+ }
+
+ public void addEndpointIFContext(EndpointIFContext eifContext) {
+ this.seiContext.add(eifContext);
+ }
+
+ public void addEndpointIFContext(List<EndpointIFContext> eifContexts) {
+ this.seiContext.addAll(eifContexts);
+ }
+
+ public Class getServiceClass() {
+ return serviceClass;
+ }
+
+ public void setServiceClass(Class serviceClass) {
+ this.serviceClass = serviceClass;
+ }
+
+ public QName getServiceName() {
+ if (serviceName == null) {
+ if (wsdlContext != null) {
+ setServiceName(wsdlContext.getFirstServiceName());
+ }
+ }
+ return serviceName;
+ }
+
+ public void setServiceName(QName serviceName) {
+ assert(serviceName != null);
+ this.serviceName = serviceName;
+ }
+
+ public EntityResolver getEntityResolver() {
+ return entityResolver;
+ }
+
+ public String toString() {
+ return "ServiceContext{" +
+ "wsdlContext=" + wsdlContext +
+ ", handleResolver=" + handlerResolver +
+ ", serviceClass=" + serviceClass +
+ ", serviceName=" + serviceName +
+ ", seiContext=" + seiContext +
+ ", entityResolver=" + entityResolver +
+ "}";
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ServiceContext.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ServiceContextBuilder.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ServiceContextBuilder.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ServiceContextBuilder.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,154 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.client;
+
+import org.jboss.com.sun.xml.ws.handler.HandlerResolverImpl;
+import org.jboss.com.sun.xml.ws.handler.PortInfoImpl;
+import org.jboss.com.sun.xml.ws.model.RuntimeModel;
+import org.jboss.com.sun.xml.ws.modeler.RuntimeModeler;
+import org.jboss.com.sun.xml.ws.server.RuntimeContext;
+import org.jboss.com.sun.xml.ws.util.HandlerAnnotationInfo;
+import org.jboss.com.sun.xml.ws.util.HandlerAnnotationProcessor;
+import org.jboss.com.sun.xml.ws.util.JAXWSUtils;
+import org.jboss.com.sun.xml.ws.wsdl.WSDLContext;
+import org.xml.sax.EntityResolver;
+import javax.jws.HandlerChain;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebEndpoint;
+import javax.xml.ws.WebServiceClient;
+import javax.xml.ws.WebServiceException;
+import javax.jws.WebService;
+import java.lang.reflect.Method;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.ArrayList;
+
+/**
+ * $author: WS Development Team
+ */
+public abstract class ServiceContextBuilder {
+ private ServiceContextBuilder() {
+ } // no instantication please
+
+ /**
+ * Creates a new {@link ServiceContext}.
+ */
+ public static ServiceContext build(URL wsdlLocation, QName serviceName, final Class
service, EntityResolver er) throws WebServiceException {
+ ServiceContext serviceContext = new ServiceContext(service, serviceName, er);
+
+ if (wsdlLocation != null){
+ WSDLContext wsCtx = new WSDLContext(wsdlLocation, er);
+
+ //check if the serviceName is a valid one, if its not in the given WSDL fail
+ if(!wsCtx.contains(serviceName))
+ throw new
ClientConfigurationException("service.invalidServiceName", serviceName,
wsdlLocation);
+
+ serviceContext.setWsdlContext(wsCtx);
+ }
+
+ //if @HandlerChain present, set HandlerResolver on service context
+ HandlerChain handlerChain = (HandlerChain)
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ return service.getAnnotation(HandlerChain.class);
+ }
+ });
+ if(handlerChain != null) {
+ HandlerResolverImpl hresolver = new HandlerResolverImpl(serviceContext);
+ serviceContext.setHandlerResolver(hresolver);
+ }
+ return serviceContext;
+ }
+
+ public static void completeServiceContext(QName portName, ServiceContext
serviceContext, Class portInterface) {
+ if (portInterface != null)
+ processAnnotations(portName, serviceContext, portInterface);
+ }
+
+ private static void processAnnotations(QName portName, ServiceContext serviceContext,
Class portInterface) throws WebServiceException {
+ WSDLContext wsdlContext = serviceContext.getWsdlContext();
+ EndpointIFContext eifc =
serviceContext.getEndpointIFContext(portInterface.getName());
+ if ((eifc != null) && (eifc.getRuntimeContext() != null)) {
+ return;
+ }
+ if (eifc == null) {
+ eifc = new EndpointIFContext(portInterface);
+ serviceContext.addEndpointIFContext(eifc);
+ }
+
+ QName serviceName = serviceContext.getServiceName();
+
+ //if portName is null get it from the WSDL
+ if (portName == null) {
+ //get the first port corresponding to the SEI
+ QName portTypeName = RuntimeModeler.getPortTypeName(portInterface);
+ portName =
wsdlContext.getWsdlDocument().getPortName(serviceContext.getServiceName(), portTypeName);
+ }
+
+ //still no portName, fail
+ if(portName == null)
+ throw new ClientConfigurationException("service.noPortName",
portInterface.getName(), wsdlContext.getWsdlLocation().toString());
+
+ eifc.setPortName(portName);
+ String bindingId = wsdlContext.getBindingID(serviceName, portName);
+ RuntimeModeler modeler = new RuntimeModeler(portInterface,
+ serviceName, bindingId);
+ modeler.setPortName(portName);
+ RuntimeModel model = modeler.buildRuntimeModel();
+
+ eifc.setRuntimeContext(new RuntimeContext(model));
+ }
+
+ private ArrayList<Class<?>> getSEI(final Class sc) {
+
+ if (sc == null) {
+ throw new WebServiceException();
+ }
+
+ //check to make sure this is a service
+ if (!Service.class.isAssignableFrom(sc)) {
+ throw new WebServiceException("service.interface.required" +
+ sc.getName());
+ }
+
+ final ArrayList<Class<?>> classes = new
ArrayList<Class<?>>();
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ Method[] methods = sc.getDeclaredMethods();
+ for (final Method method : methods) {
+ method.setAccessible(true);
+ Class<?> seiClazz = method.getReturnType();
+ if ((seiClazz != null) &&
(!seiClazz.equals("void")))
+ classes.add(seiClazz);
+
+ }
+ return null;
+ }
+ });
+
+ return classes;
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/ServiceContextBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/WSFuture.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/WSFuture.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/WSFuture.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,64 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.client;
+
+
+
+import javax.xml.ws.Response;
+
+import org.jboss.com.sun.xml.ws.client.ResponseContext;
+
+import java.rmi.server.UID;
+import java.util.Map;
+import java.util.concurrent.Callable;
+import java.util.concurrent.FutureTask;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+import java.util.logging.Logger;
+
+/**
+ * The <code>Response</code> interface provides methods used to obtain the
+ * payload and context a message sent in response to an operation invocation.
+ * For asynchronous operation invocations it provides additional methods to
+ * check the status of the request.
+ *
+ * @author JAXWS Development Team
+ * @version 1.0
+ */
+
+
+public class WSFuture<T> extends FutureTask<T> {
+ private static final Logger logger =
+ Logger.getLogger(new
StringBuffer().append(org.jboss.com.sun.xml.ws.util.Constants.LoggingDomain).append(".client.dispatch").toString());
+
+ private Lock _lock;
+
+ public WSFuture(Callable<T> callable) {
+ super(callable);
+ _lock = new ReentrantLock();
+ }
+
+ public WSFuture(Runnable runable, T result) {
+ super(runable, result);
+ _lock = new ReentrantLock();
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/WSFuture.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/WSServiceDelegate.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/WSServiceDelegate.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/WSServiceDelegate.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,417 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+/*
+ * Copyright (c) 2005 Your Corporation. All Rights Reserved.
+ */
+package org.jboss.com.sun.xml.ws.client;
+
+import com.sun.org.apache.xml.internal.resolver.tools.CatalogResolver;
+
+import org.jboss.com.sun.xml.ws.binding.http.HTTPBindingImpl;
+import org.jboss.com.sun.xml.ws.binding.soap.SOAPBindingImpl;
+import org.jboss.com.sun.xml.ws.client.dispatch.DispatchBase;
+import org.jboss.com.sun.xml.ws.handler.PortInfoImpl;
+import org.jboss.com.sun.xml.ws.model.RuntimeModel;
+import org.jboss.com.sun.xml.ws.util.xml.XmlUtil;
+import org.jboss.com.sun.xml.ws.wsdl.WSDLContext;
+import org.jboss.com.sun.xml.ws.wsdl.parser.Binding;
+import org.xml.sax.EntityResolver;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.handler.HandlerResolver;
+import javax.xml.ws.handler.PortInfo;
+import javax.xml.ws.http.HTTPBinding;
+import javax.xml.ws.soap.SOAPBinding;
+import javax.xml.ws.spi.ServiceDelegate;
+import java.lang.reflect.Proxy;
+import java.net.URL;
+import java.util.*;
+import java.util.concurrent.Executor;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ThreadFactory;
+
+/**
+ * <code>Service</code> objects provide the client view of a Web service.
+ * <p><code>Service</code> acts as a factory of the following:
+ * <ul>
+ * <li>Proxies for a target service endpoint.
+ * <li>Instances of <code>javax.xml.ws.Dispatch</code> for
+ * dynamic message-oriented invocation of a remote
+ * operation.
+ * </li>
+ * <p/>
+ * <p>The ports available on a service can be enumerated using the
+ * <code>getPorts</code> method. Alternatively, you can pass a
+ * service endpoint interface to the unary <code>getPort</code> method
+ * and let the runtime select a compatible port.
+ * <p/>
+ * <p>Handler chains for all the objects created by a
<code>Service</code>
+ * can be set by means of the provided <code>HandlerRegistry</code>.
+ * <p/>
+ * <p>An <code>Executor</code> may be set on the service in order
+ * to gain better control over the threads used to dispatch asynchronous
+ * callbacks. For instance, thread pooling with certain parameters
+ * can be enabled by creating a <code>ThreadPoolExecutor</code> and
+ * registering it with the service.
+ *
+ * @author WS Development Team
+ * @see java.util.concurrent.Executor
+ * @since JAX-WS 2.0
+ */
+public class WSServiceDelegate extends ServiceDelegate {
+
+ protected static final String GET = "get";
+
+ protected HashSet<QName> ports;
+
+ protected HashMap<QName, PortInfoBase> dispatchPorts;
+ protected HandlerResolver handlerResolver;
+
+ protected Object serviceProxy;
+ protected URL wsdlLocation;
+ protected ServiceContext serviceContext;
+ protected Executor executor;
+
+ /**
+ * {@link CatalogResolver} to check META-INF/jax-ws-catalog.xml.
+ * Lazily created.
+ */
+ private EntityResolver entityResolver;
+
+
+ public WSServiceDelegate(ServiceContext scontext) {
+ serviceContext = scontext;
+ this.dispatchPorts = new HashMap();
+ if (serviceContext.getHandlerResolver() != null) {
+ handlerResolver = serviceContext.getHandlerResolver();
+ }
+ }
+
+ public WSServiceDelegate(URL wsdlDocumentLocation, QName serviceName, Class
serviceClass) {
+ //we cant create a Service without serviceName
+ if (serviceName == null)
+ throw new ClientConfigurationException("service.noServiceName");
+
+ this.dispatchPorts = new HashMap();
+
+ serviceContext = ServiceContextBuilder.build(wsdlDocumentLocation, serviceName,
+ serviceClass, XmlUtil.createDefaultCatalogResolver());
+
+ if (serviceContext.getHandlerResolver() != null) {
+ handlerResolver = serviceContext.getHandlerResolver();
+ }
+
+ populatePorts();
+ }
+
+ private void processServiceContext(QName portName, Class portInterface) throws
WebServiceException {
+ ServiceContextBuilder.completeServiceContext(portName, serviceContext,
portInterface);
+ }
+
+ public URL getWSDLLocation() {
+ if (wsdlLocation == null)
+ setWSDLLocation(getWsdlLocation());
+ return wsdlLocation;
+ }
+
+ public void setWSDLLocation(URL location) {
+ wsdlLocation = location;
+ }
+
+ public Executor getExecutor() {
+ if (executor != null)
+ //todo:needs to be decoupled from service at execution
+ {
+ return (Executor) executor;
+ } else
+ executor = Executors.newFixedThreadPool(3, new DaemonThreadFactory());
+ return executor;
+ }
+
+ public void setExecutor(Executor executor) {
+ this.executor = executor;
+ }
+
+
+ public HandlerResolver getHandlerResolver() {
+ return handlerResolver;
+ }
+
+ public void setHandlerResolver(HandlerResolver resolver) {
+ handlerResolver = resolver;
+ }
+
+ public Object getPort(QName portName, Class portInterface)
+ throws WebServiceException {
+ Object seiProxy = createEndpointIFBaseProxy(portName, portInterface);
+ if (portName != null) {
+ addPort(portName);
+ }
+
+ return seiProxy;
+ }
+
+ public Object getPort(Class portInterface) throws WebServiceException {
+ return createEndpointIFBaseProxy(null, portInterface);
+ }
+
+ //todo: rename addPort :spec tbd
+ public void addPort(QName portName, String bindingId,
+ String endpointAddress) throws WebServiceException {
+
+ if (!dispatchPorts.containsKey(portName)) {
+ dispatchPorts.put(portName, new PortInfoBase(endpointAddress,
+ portName, bindingId));
+ } else
+ throw new WebServiceException("Port " + portName.toString() +
" already exists can not create a port with the same name.");
+ // need to add port to list for HandlerRegistry
+ addPort(portName);
+ }
+
+
+ public <T> Dispatch<T> createDispatch(QName qName, Class<T> aClass,
Service.Mode mode) throws WebServiceException {
+ return createDispatchClazz(qName, aClass, mode);
+ }
+
+ public Dispatch<Object> createDispatch(QName qName, JAXBContext jaxbContext,
Service.Mode mode) throws WebServiceException {
+ return createDispatchJAXB(qName, jaxbContext, mode);
+ }
+
+ public QName getServiceName() {
+ return serviceContext.getServiceName();
+ }
+
+ public Iterator getPorts() throws WebServiceException {
+ if (ports == null)
+ populatePorts();
+
+ if (ports.size() == 0)
+ throw noWsdlException();
+ return ports.iterator();
+ }
+
+ public URL getWSDLDocumentLocation() {
+ return getWsdlLocation();
+ }
+
+ protected void addPorts(QName[] ports) {
+ if (ports != null) {
+ for (int i = 0; i < ports.length; ++i) {
+ addPort(ports[i]);
+ }
+ }
+ }
+
+ private void populatePorts() {
+ if (ports == null)
+ ports = new HashSet<QName>();
+
+ WSDLContext wscontext = serviceContext.getWsdlContext();
+
+ if (serviceContext.getServiceName() == null) {
+ if (wscontext != null) {
+ serviceContext.setServiceName(wscontext.getFirstServiceName());
+ }
+ }
+ Set knownPorts = null;
+
+ if (wscontext != null) {
+ QName serviceName = serviceContext.getServiceName();
+ knownPorts =
+ wscontext.getPortsAsSet(serviceName);
+ if (knownPorts != null) {
+ QName[] portz = (QName[]) knownPorts.toArray(
+ new QName[knownPorts.size()]);
+ addPorts(portz);
+ for (QName port : portz) {
+ String endpoint =
+ wscontext.getEndpoint(serviceName, port);
+ String bid = wscontext.getWsdlBinding(serviceName, port)
+ .getBindingId();
+ dispatchPorts.put(port,
+ new PortInfoBase(endpoint, port, bid));
+ }
+ }
+ }
+ }
+
+ protected void addPort(QName port) {
+ if (ports == null)
+ populatePorts();
+ ports.add(port);
+ }
+
+ protected WebServiceException noWsdlException() {
+ return new WebServiceException("dii.service.no.wsdl.available");
+ }
+
+ private Object createEndpointIFBaseProxy(QName portName, Class portInterface) throws
WebServiceException {
+ //fail if service doesnt have WSDL
+ if (serviceContext.getWsdlContext() == null)
+ throw new ClientConfigurationException("service.noWSDLUrl");
+
+ //if there is portName validate it
+ if ((portName != null) &&
!serviceContext.getWsdlContext().contains(serviceContext.getServiceName(), portName))
+ {
+ throw new ClientConfigurationException("service.invalidPort",
portName, serviceContext.getServiceName(),
serviceContext.getWsdlContext().getWsdlLocation().toString());
+ }
+
+ processServiceContext(portName, portInterface);
+
+ //if the portName is null it must have been set inside processServiceContext, now
get it
+ //from EndpointIfContext
+ if (portName == null)
+ portName =
serviceContext.getEndpointIFContext(portInterface.getName()).getPortName();
+
+ return buildEndpointIFProxy(portName, portInterface);
+ }
+
+ protected HashSet<QName> getPortsAsSet() {
+ if (ports == null)
+ populatePorts();
+ return ports;
+ }
+
+ /*
+ * Set the binding on the binding provider. Called by the service
+ * class when creating the binding provider.
+ */
+ protected void setBindingOnProvider(InternalBindingProvider provider,
+ QName portName, String bindingId) {
+
+ // get handler chain
+ List<Handler> handlerChain = null;
+ HandlerResolver hResolver = getHandlerResolver();
+ if (handlerResolver != null && getServiceName() != null) {
+ PortInfo portInfo = new PortInfoImpl(bindingId, portName,
+ getServiceName());
+ handlerChain = handlerResolver.getHandlerChain(portInfo);
+ } else {
+ handlerChain = new ArrayList<Handler>();
+ }
+
+ // create binding
+ if (bindingId.toString().equals(SOAPBinding.SOAP11HTTP_BINDING) ||
+ bindingId.toString().equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING) ||
+ bindingId.toString().equals(SOAPBinding.SOAP12HTTP_BINDING) ||
+ bindingId.toString().equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING)) {
+ SOAPBindingImpl bindingImpl = new SOAPBindingImpl(handlerChain,
+ bindingId, getServiceName());
+ Set<String> roles = serviceContext.getRoles(portName);
+ if (roles != null) {
+ bindingImpl.setRoles(roles);
+ }
+ provider._setBinding(bindingImpl);
+ } else if (bindingId.equals(HTTPBinding.HTTP_BINDING)) {
+ provider._setBinding(new HTTPBindingImpl(handlerChain));
+ }
+ }
+
+
+ private Dispatch createDispatchClazz(QName port, Class clazz, Service.Mode mode)
throws WebServiceException {
+ PortInfoBase dispatchPort = dispatchPorts.get(port);
+ if (dispatchPort != null) {
+ DispatchBase dBase = new DispatchBase((PortInfoBase) dispatchPort, clazz,
(Service.Mode) mode, this);
+ setBindingOnProvider(dBase, port, dBase._getBindingId());
+ return dBase;
+ } else {
+ throw new WebServiceException("Port must be defined in order to create
Dispatch");
+ }
+ }
+
+ private Dispatch createDispatchJAXB(QName port, JAXBContext jaxbContext, Service.Mode
mode) throws WebServiceException {
+ PortInfoBase dispatchPort = dispatchPorts.get(port);
+ if (dispatchPort != null) {
+ DispatchBase dBase = new DispatchBase((PortInfoBase) dispatchPort,
jaxbContext, mode, this);
+ setBindingOnProvider(dBase, port, dBase._getBindingId());
+ return dBase;
+ } else {
+ throw new WebServiceException("Port must be defined in order to create
Dispatch");
+ }
+ }
+
+ private URL getWsdlLocation() {
+ return serviceContext.getWsdlContext().getWsdlLocation();
+ }
+
+ private Object buildEndpointIFProxy(QName portQName, Class portInterface)
+ throws WebServiceException {
+
+ EndpointIFContext eif = completeEndpointIFContext(serviceContext, portQName,
portInterface);
+
+ //apply parameter bindings
+ RuntimeModel model = eif.getRuntimeContext().getModel();
+ if (portQName != null) {
+ Binding binding = getWSDLBinding(portQName);
+ eif.setBindingID(binding.getBindingId());
+ model.applyParameterBinding(binding);
+ }
+
+ //needs cleaning up
+ EndpointIFInvocationHandler handler =
+ new EndpointIFInvocationHandler(portInterface,
+ eif, this, getServiceName()); //need handler registry passed in here
+ setBindingOnProvider(handler, portQName, handler._getBindingId());
+
+ Object proxy = Proxy.newProxyInstance(portInterface.getClassLoader(),
+ new Class[]{
+ portInterface, BindingProvider.class,
+ BindingProviderProperties.class,
+ org.jboss.com.sun.xml.ws.spi.runtime.StubBase.class
+ }, handler);
+ handler.setProxy((Object) proxy);
+ return (BindingProvider) proxy;
+ }
+
+ Binding getWSDLBinding(QName portQName) {
+ return
serviceContext.getWsdlContext().getWsdlBinding(serviceContext.getServiceName(),
portQName);
+ }
+
+ private EndpointIFContext completeEndpointIFContext(ServiceContext serviceContext,
QName portQName, Class portInterface) {
+
+ EndpointIFContext context =
serviceContext.getEndpointIFContext(portInterface.getName());
+ WSDLContext wscontext = serviceContext.getWsdlContext();
+ if (wscontext != null) {
+ String endpoint = wscontext.getEndpoint(serviceContext.getServiceName(),
portQName);
+ String bindingID = wscontext.getBindingID(
+ serviceContext.getServiceName(), portQName);
+ context.setServiceName(serviceContext.getServiceName());
+ context.setPortInfo(portQName, endpoint, bindingID);
+ }
+ return context;
+ }
+
+ class DaemonThreadFactory implements ThreadFactory {
+ public Thread newThread(Runnable r) {
+ Thread daemonThread = new Thread(r);
+ daemonThread.setDaemon(Boolean.TRUE);
+ return daemonThread;
+ }
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/WSServiceDelegate.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/DispatchBase.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/DispatchBase.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/DispatchBase.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,709 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.client.dispatch;
+
+import static javax.xml.ws.Service.Mode.*;
+import static javax.xml.ws.Service.*;
+
+
+import javax.activation.DataSource;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.namespace.QName;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPConstants;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.transform.Source;
+import javax.xml.ws.*;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.http.HTTPBinding;
+import javax.xml.ws.http.HTTPException;
+import javax.xml.ws.soap.SOAPBinding;
+import javax.xml.ws.soap.SOAPFaultException;
+
+import org.jboss.com.sun.xml.ws.binding.BindingImpl;
+import org.jboss.com.sun.xml.ws.binding.soap.SOAPBindingImpl;
+import org.jboss.com.sun.xml.ws.client.*;
+import org.jboss.com.sun.xml.ws.client.dispatch.impl.DispatchContactInfoList;
+import org.jboss.com.sun.xml.ws.client.dispatch.impl.DispatchDelegate;
+import org.jboss.com.sun.xml.ws.encoding.soap.message.SOAPFaultInfo;
+import org.jboss.com.sun.xml.ws.pept.Delegate;
+import org.jboss.com.sun.xml.ws.pept.presentation.MessageStruct;
+import org.jboss.com.sun.xml.ws.spi.runtime.ClientTransportFactory;
+import org.jboss.com.sun.xml.ws.transport.http.client.HttpClientTransportFactory;
+
+import java.util.Map;
+import java.util.concurrent.Executor;
+import java.util.concurrent.Future;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+import java.util.logging.Logger;
+
+
+/**
+ * The <code>javax.xml.ws.Dispatch</code> interface provides support
+ * for the dynamic invocation of a service endpoint operation using XML
+ * constructs or JAXB objects. The <code>javax.xml.ws.Service</code>
+ * interface acts as a factory for the creation of <code>Dispatch</code>
+ * instances.
+ *
+ * @author WS Development Team
+ * @version 1.0
+ */
+
+public class DispatchBase implements BindingProvider, InternalBindingProvider,
+ Dispatch {
+
+ public DispatchBase(PortInfoBase port, Class aClass, Service.Mode mode,
WSServiceDelegate service) {
+ this(port, mode, null, aClass, service);
+ }
+
+ public DispatchBase(PortInfoBase port, JAXBContext jaxbContext, Service.Mode mode,
WSServiceDelegate service) {
+ this(port, mode, jaxbContext, null, service);
+ }
+
+ DispatchBase(PortInfoBase port, Service.Mode mode, JAXBContext context, Class clazz,
WSServiceDelegate service) {
+ _delegate = new DispatchDelegate(new DispatchContactInfoList());
+ _mode = mode;
+ _portInfo = port;
+ _jaxbContext = context;
+ _clazz = clazz;
+ _service = service;
+ }
+
+ /**
+ * Invoke a service operation synchronously.
+ * <p/>
+ * The client is responsible for ensuring that the <code>msg</code>
object
+ * is formed according to the requirements of the protocol binding in use.
+ *
+ * @param msg An object that will form the payload of
+ * the message used to invoke the operation. Must be an instance of
+ * either <code>javax.xml.transform.Source</code> or a JAXB
object. If
+ * <code>msg</code> is an instance of a JAXB object then the
request
+ * context must have the
<code>javax.xml.ws.binding.context</code>
+ * property set.
+ * @return The response to the operation invocation. The object is
+ * either an instance of <code>javax.xml.transform.Source</code>
+ * or a JAXB object.
+ * @throws javax.xml.ws.WebServiceException
+ * If there is any error in the configuration of
+ * the <code>Dispatch</code> instance
+ * @throws javax.xml.ws.WebServiceException
+ * If an error occurs when using a supplied
+ * JAXBContext to marshall msg or unmarshall the response. The cause of
+ * the WebServiceException is the original JAXBException.
+ */
+ public Object invoke(Object msg)
+ throws WebServiceException {
+
+ MessageStruct messageStruct = setupMessageStruct(msg);
+ messageStruct.setMEP(MessageStruct.REQUEST_RESPONSE_MEP);
+ return sendAndReceive(messageStruct);
+ }
+
+ /**
+ * Invoke a service operation asynchronously. The
+ * method returns without waiting for the response to the operation
+ * invocation, the results of the operation are obtained by polling the
+ * returned <code>Response</code>.
+ * <p/>
+ * The client is responsible for ensuring that the <code>msg</code>
object
+ * when marshalled is formed according to the requirements of the protocol
+ * binding in use.
+ *
+ * @param msg An object that, when marshalled, will form the payload of
+ * the message used to invoke the operation. Must be an instance of
+ * either <code>javax.xml.transform.Source</code> or a JAXB
object. If
+ * <code>msg</code> is an instance of a JAXB object then the
request
+ * context must have the
<code>javax.xml.ws.binding.context</code>
+ * property set.
+ * @return The response to the operation invocation. The object
+ * returned by <code>Response.get()</code> is
+ * either an instance of <code>javax.xml.transform.Source</code>
+ * or a JAXB object.
+ * @throws javax.xml.ws.WebServiceException
+ * If there is any error in the configuration of
+ * the <code>Dispatch</code> instance
+ * @throws javax.xml.ws.WebServiceException
+ * If an error occurs when using a supplied
+ * JAXBContext to marshall msg. The cause of
+ * the WebServicException is the original JAXBException.
+ */
+ public Response<Object> invokeAsync(Object msg)
+ throws WebServiceException {
+
+ MessageStruct messageStruct = setupMessageStruct(msg);
+ messageStruct.setMEP(MessageStruct.ASYNC_POLL_MEP);
+ Object result = sendAsync(messageStruct);
+ if (result instanceof Response)
+ return (Response<Object>) result;
+ else
+ throw (RuntimeException) result;
+ }
+
+
+ /**
+ * Invoke a service operation asynchronously. The
+ * method returns without waiting for the response to the operation
+ * invocation, the results of the operation are communicated to the client
+ * via the passed in handler.
+ * <p/>
+ * The client is responsible for ensuring that the <code>msg</code>
object
+ * when marshalled is formed according to the requirements of the protocol
+ * binding in use.
+ *
+ * @param msg An object that, when marshalled, will form the payload of
+ * the message used to invoke the operation. Must be an instance of
+ * either <code>javax.xml.transform.Source</code> or a
JAXB object. If
+ * <code>msg</code> is an instance of a JAXB object then
the request
+ * context must have the
<code>javax.xml.ws.binding.context</code>
+ * property set.
+ * @param handler The handler object that will receive the
+ * response to the operation invocation. The object
+ * returned by <code>Response.get()</code> is
+ * either an instance of
+ * <code>javax.xml.transform.Source</code> or a JAXB
object.
+ * @return A <code>Future</code> object that may be used to check the
status
+ * of the operation invocation. This object must not be used to try to
+ * obtain the results of the operation - the object returned from
+ * <code>Future<?>.get()</code> is implementation
dependent
+ * and any use of it will result in non-portable behaviour.
+ * @throws javax.xml.ws.WebServiceException
+ * If there is any error in the configuration of
+ * the <code>Dispatch</code> instance
+ * @throws javax.xml.ws.WebServiceException
+ * If an error occurs when using a supplied
+ * JAXBContext to marshall msg. The cause of
+ * the WebServiceException is the original JAXBException.
+ */
+ public Future<?> invokeAsync(java.lang.Object msg, AsyncHandler handler) {
+
+ MessageStruct messageStruct = setupMessageStruct(msg);
+ if (handler != null) {
+
messageStruct.setMetaData(BindingProviderProperties.JAXWS_CLIENT_ASYNC_HANDLER, (Object)
new AsyncHandlerService(handler, getCurrentExecutor()));
+ } else
+ throw new WebServiceException("AsyncHandler argument is null. " +
+ "AsyncHandler is required for asynchronous callback invocations
");
+
+ messageStruct.setMEP(MessageStruct.ASYNC_CALLBACK_MEP);
+ Object result = sendAsync(messageStruct);
+ if (result instanceof WSFuture)
+ return (Future<Object>) result;
+ else
+ throw (RuntimeException) result;
+ }
+
+ /**
+ * Invokes a service operation using the one-way
+ * interaction mode. The operation invocation is logically non-blocking,
+ * subject to the capabilities of the underlying protocol, no results
+ * are returned. When
+ * the protocol in use is SOAP/HTTP, this method must block until
+ * an HTTP response code has been received or an error occurs.
+ * <p/>
+ * The client is responsible for ensuring that the <code>msg</code>
object
+ * when marshalled is formed according to the requirements of the protocol
+ * binding in use.
+ *
+ * @param msg An object that, when marshalled, will form the payload of
+ * the message used to invoke the operation. Must be an instance of
+ * either <code>javax.xml.transform.Source</code> or a JAXB
object. If
+ * <code>msg</code> is an instance of a JAXB object then the
request
+ * context must have the
<code>javax.xml.ws.binding.context</code>
+ * property set.
+ * @throws javax.xml.ws.WebServiceException
+ * If there is any error in the configuration of
+ * the <code>Dispatch</code> instance or if an error occurs
during the
+ * invocation.
+ * @throws javax.xml.ws.WebServiceException
+ * If an error occurs when using a supplied
+ * JAXBContext to marshall msg. The cause of
+ * the WebServiceException is the original JAXBException.
+ */
+
+ public void invokeOneWay(Object msg) {
+
+ MessageStruct messageStruct = setupMessageStruct(msg);
+ messageStruct.setMEP(MessageStruct.ONE_WAY_MEP);
+ sendOneWay(messageStruct);
+ }
+
+ private boolean hasJAXBContext(Object msg, MessageStruct messageStruct) {
+ RequestContext requestContext = (RequestContext) getRequestContext();
+ if (_jaxbContext != null) {
+ requestContext.put(BindingProviderProperties.JAXB_CONTEXT_PROPERTY,
_jaxbContext);
+ return true;
+ }
+ return false;
+ }
+
+ public void _setDelegate(Delegate delegate) {
+ _delegate = delegate;
+ }
+
+ public Delegate _getDelegate() {
+ return _delegate;
+ }
+
+ public static void setDefaultTransportFactory(ClientTransportFactory factory) {
+ defaultTransportFactory = factory;
+ }
+
+ public static ClientTransportFactory getDefaultTransportFactory() {
+ if (defaultTransportFactory == null)
+ defaultTransportFactory = new HttpClientTransportFactory();
+ return defaultTransportFactory;
+ }
+
+ public ClientTransportFactory _getTransportFactory() {
+ _transportFactory =
+ (ClientTransportFactory)
getRequestContext().get(BindingProviderProperties.CLIENT_TRANSPORT_FACTORY);
+
+ if (_transportFactory == null) {
+ _transportFactory = new HttpClientTransportFactory();
+ }
+ return _transportFactory;
+ }
+
+ public void
_setTransportFactory(org.jboss.com.sun.xml.ws.spi.runtime.ClientTransportFactory f) {
+ getRequestContext().put(BindingProviderProperties.CLIENT_TRANSPORT_FACTORY, f);
+ _transportFactory = (ClientTransportFactory) f;
+ }
+
+ private Object sendAndReceive(MessageStruct messageStruct) {
+ Object response = null;
+
+ _delegate.send(messageStruct);
+ response = messageStruct.getResponse();
+ updateResponseContext(messageStruct);
+ //((ContextMap) getRequestContext()).clear();
+ switch (messageStruct.getResponseType()) {
+
+ case MessageStruct.NORMAL_RESPONSE:
+ //not sure where this belongs yet - but for now-
+ break;
+ case MessageStruct.CHECKED_EXCEPTION_RESPONSE:
+ if (response instanceof SOAPFaultException)
+ throw (SOAPFaultException) response;
+ if (response instanceof SOAPFaultInfo) {
+ SOAPFaultInfo soapFaultInfo = (SOAPFaultInfo) response;
+ JAXBException jbe = null;
+ if (soapFaultInfo.getString().contains("javax.xml.bind"))
{
+ jbe = new JAXBException(soapFaultInfo.getString());
+ //do I need to put this in a webservice exception
+ SOAPFaultException sfe = new
SOAPFaultException(soapFaultInfo.getSOAPFault());
+ sfe.initCause(jbe);
+ } else
+ throw new SOAPFaultException(soapFaultInfo.getSOAPFault());
+ } else if (response instanceof HTTPException) {
+ throw (HTTPException) response;
+ } else if (response instanceof RuntimeException)
+ throw (RuntimeException) response;
+ case MessageStruct.UNCHECKED_EXCEPTION_RESPONSE:
+ if (response instanceof SOAPFaultException) {
+ throw (SOAPFaultException) response;
+ } else if (response instanceof HTTPException) {
+ throw (HTTPException) response;
+ } else if (response instanceof RuntimeException) {
+ throw (RuntimeException) response;
+ }
+ break; //just break and return response
+ default:
+ if (response != null) //must be some kind of exception
+ throw new WebServiceException("Client side exception - examine
cause ", (Exception) response);
+ }
+ return response;
+ }
+
+ private Object sendAsync(MessageStruct messageStruct)
+ throws WebServiceException {
+ Object response = null;
+ _lock = new ReentrantLock();
+ _lock.lock();
+ try {
+ _delegate.send(messageStruct);
+ response = messageStruct.getResponse();
+ } catch (Throwable t) {
+ throw (RuntimeException) t;
+ } finally {
+ _lock.unlock();
+ }
+ return response;
+ }
+
+ private void sendOneWay(MessageStruct messageStruct) {
+
+ _delegate.send(messageStruct);
+ Object response = messageStruct.getResponse();
+ //no exceptions should be returned from server but
+ //exceptions may be returned from the client
+ switch (messageStruct.getResponseType()) {
+ case MessageStruct.NORMAL_RESPONSE:
+ break;
+ case MessageStruct.CHECKED_EXCEPTION_RESPONSE:
+ case MessageStruct.UNCHECKED_EXCEPTION_RESPONSE:
+ //before invocation
+ if (response instanceof RuntimeException)
+ throw (RuntimeException) response;
+ default:
+ throw new RuntimeException("Client side Exception ");
+ }
+ }
+
+ private MessageStruct setupMessageStruct(Object msg) throws WebServiceException {
+ MessageStruct messageStruct = _delegate.getMessageStruct();
+
+ if (msg != null) {
+ MessageFactory factory = null;
+ if (((msg instanceof Source) && _mode == MESSAGE) &&
+ (!_getBindingId().toString().equals(HTTPBinding.HTTP_BINDING)))
+ {
+ try {
+
+ if
(_getBindingId().toString().equals(SOAPBinding.SOAP12HTTP_BINDING))
+ factory =
MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
+ else
+ factory =
MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
+
+ SOAPMessage message = factory.createMessage();
+ message.getSOAPPart().setContent((Source) msg);
+ message.saveChanges();
+ msg = message;
+ } catch (SOAPException se) {
+ throw new WebServiceException(se);
+ }
+ }
+
+ //setMessageStruct(messageStruct, msg);
+
+ } else {
+ //todo - needs to be a get request
+ if (!isValidNullParameter(msg))
+ throw new WebServiceException("This is not a valid request ");
+ }
+ setMessageStruct(messageStruct, msg);
+ return messageStruct;
+ }
+
+ private void setMessageStruct(MessageStruct messageStruct, Object msg) {
+ messageStruct.setData(new Object[]{msg});
+ setMetadata(getRequestContext(), msg, messageStruct);
+ //set mtom threshold value to
+ Object mtomThreshold =
getRequestContext().get(BindingProviderProperties.MTOM_THRESHOLOD_VALUE);
+ messageStruct.setMetaData(BindingProviderProperties.MTOM_THRESHOLOD_VALUE,
mtomThreshold);
+
+ // Set MTOM processing for XML requests only
+ String bindingId =
+ (getBinding() instanceof SOAPBinding)?
+
((SOAPBindingImpl)binding).getBindingId().toString():HTTPBinding.HTTP_BINDING;
+ if (bindingId.equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING)||
+ bindingId.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING))
+ messageStruct.setMetaData("org.jboss.com.sun.xml.ws.mtom.enabled",
((SOAPBindingImpl)getBinding()).isMTOMEnabled());
+
+ // Initialize content negotiation property
+ ContentNegotiation.initialize(getRequestContext(), messageStruct);
+ }
+
+ private void updateResponseContext(MessageStruct messageStruct) {
+ ResponseContext responseContext = (ResponseContext)
+
messageStruct.getMetaData(BindingProviderProperties.JAXWS_RESPONSE_CONTEXT_PROPERTY);
+ setResponseContext(responseContext);
+ }
+
+ private void setMetadata(Map jaxwsContext, Object obj, MessageStruct messageStruct)
{
+
+ jaxwsContext.put(BindingProviderProperties.JAXWS_CLIENT_HANDLE_PROPERTY, this);
+
+ if (jaxwsContext.get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY) == null)
+ jaxwsContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
_portInfo.getTargetEndpoint());
+
+ jaxwsContext.put(BindingProviderProperties.BINDING_ID_PROPERTY,
_getBindingId().toString());
+ if (_jaxbContext != null)
+ jaxwsContext.put(BindingProviderProperties.JAXB_CONTEXT_PROPERTY,
_jaxbContext);
+ messageStruct.setMetaData(BindingProviderProperties.JAXWS_CONTEXT_PROPERTY,
+ jaxwsContext);
+
+ messageStruct.setMetaData(DispatchContext.DISPATCH_MESSAGE_MODE, _mode);
+ if (_clazz != null)
+ messageStruct.setMetaData(DispatchContext.DISPATCH_MESSAGE_CLASS, _clazz);
+
+ DispatchContext context = setDispatchContext(jaxwsContext, obj, _mode);
+ messageStruct.setMetaData(BindingProviderProperties.DISPATCH_CONTEXT, context);
+ }
+
+ public Binding getBinding() {
+ return (Binding) binding;
+ }
+
+ public void _setBinding(BindingImpl binding) {
+ this.binding = binding;
+ }
+
+ // default for now is soap binding
+ public String _getBindingId() {
+ _bindingId = _portInfo.getBindingId();
+ if (_bindingId == null) {
+ _bindingId = SOAPBinding.SOAP11HTTP_BINDING;
+ }
+ return _bindingId;
+ }
+
+
+ /**
+ * Get the jaxwsContext that is used in processing request messages.
+ * <p/>
+ * Modifications to the request context do not affect asynchronous
+ * operations that have already been started.
+ *
+ * @return The jaxwsContext that is used in processing request messages.
+ */
+ public Map getRequestContext() {
+ if (_requestContext == null)
+ _requestContext = new RequestContext(this);
+
+ return _requestContext;
+ }
+
+ private void setResponseContext(ResponseContext context) {
+ _responseContext = context;
+ }
+
+ /**
+ * Get the jaxwsContext that resulted from processing a response message.
+ * <p/>
+ * The returned context is for the most recently completed synchronous
+ * operation. Subsequent synchronous operation invocations overwrite the
+ * response context. Asynchronous operations return their response context
+ * via the Response interface.
+ *
+ * @return The jaxwsContext that is used in processing request messages.
+ */
+ public Map getResponseContext() {
+ if (_responseContext == null)
+ _responseContext = new ResponseContext(this);
+ return _responseContext;
+ }
+
+ public DispatchContext setDispatchContext(Map jaxwsContext, Object obj, Service.Mode
mode) {
+
+ DispatchContext context = new DispatchContext();
+ context.setProperty(DispatchContext.DISPATCH_MESSAGE_MODE, mode);
+
+ if (obj != null) {
+ if (obj instanceof Source) {
+ context.setProperty(DispatchContext.DISPATCH_MESSAGE_CLASS,
+ DispatchContext.MessageClass.SOURCE);
+ } else if (obj instanceof SOAPMessage) {
+ context.setProperty(DispatchContext.DISPATCH_MESSAGE_CLASS,
+ DispatchContext.MessageClass.SOAPMESSAGE);
+ } else if ((obj instanceof DataSource) &&
+ _getBindingId().toString().equals(HTTPBinding.HTTP_BINDING)) {
+ context.setProperty(DispatchContext.DISPATCH_MESSAGE_CLASS,
+ DispatchContext.MessageClass.DATASOURCE);
+
+ } else if (_jaxbContext != null) {
+ context.setProperty(DispatchContext.DISPATCH_MESSAGE_CLASS,
+ DispatchContext.MessageClass.JAXBOBJECT);
+ } else {
+ if (!_getBindingId().toString().equals(HTTPBinding.HTTP_BINDING))
+ throw new WebServiceException("Object is not a
javax.xml.transform.Source or there is no JAXB Context");
+ }
+ }
+
+ if (_clazz != null) {
+ if (_clazz.isAssignableFrom(Source.class)) {
+ if (mode == PAYLOAD) {
+ if (_getBindingId().toString().equals(HTTPBinding.HTTP_BINDING))
+ context.setProperty(DispatchContext.DISPATCH_MESSAGE,
DispatchContext.MessageType.HTTP_SOURCE_PAYLOAD);
+ else
+ context.setProperty(DispatchContext.DISPATCH_MESSAGE,
DispatchContext.MessageType.SOURCE_PAYLOAD);
+ } else if (mode == MESSAGE) {
+ if (_getBindingId().toString().equals(HTTPBinding.HTTP_BINDING))
+ context.setProperty(DispatchContext.DISPATCH_MESSAGE,
DispatchContext.MessageType.HTTP_SOURCE_MESSAGE);
+ else
+ context.setProperty(DispatchContext.DISPATCH_MESSAGE,
DispatchContext.MessageType.SOURCE_MESSAGE);
+ }
+ } else if (_clazz.isAssignableFrom(SOAPMessage.class)) {
+ if (mode == PAYLOAD) {
+ throw new WebServiceException("SOAPMessages must be
Service.Mode.MESSAGE. ");
+ } else if (mode == MESSAGE)
+ context.setProperty(DispatchContext.DISPATCH_MESSAGE,
DispatchContext.MessageType.SOAPMESSAGE_MESSAGE);
+ } else if (_clazz.isAssignableFrom(DataSource.class)) {
+ if (mode == PAYLOAD)
+ throw new WebServiceException("Can not have a Datahandler class
with mode PAYLOAD");
+ //context.setProperty(DispatchContext.DISPATCH_MESSAGE,
DispatchContext.MessageType.HTTP_DATASOURCE_PAYLOAD);
+ else if (mode == MESSAGE)
+ context.setProperty(DispatchContext.DISPATCH_MESSAGE,
DispatchContext.MessageType.HTTP_DATASOURCE_MESSAGE);
+ } else {
+ context.setProperty(DispatchContext.DISPATCH_MESSAGE_CLASS, _clazz);
+ }
+ } else if (hasJAXBContext(obj, null)) {
+ if (mode == PAYLOAD) {
+ if (_getBindingId().toString().equals(HTTPBinding.HTTP_BINDING))
+ context.setProperty(DispatchContext.DISPATCH_MESSAGE,
DispatchContext.MessageType.HTTP_JAXB_PAYLOAD);
+ else
+ context.setProperty(DispatchContext.DISPATCH_MESSAGE,
DispatchContext.MessageType.JAXB_PAYLOAD);
+ } else if (mode == MESSAGE) {
+ if (_getBindingId().toString().equals(HTTPBinding.HTTP_BINDING))
+ throw new WebServiceException(" Can not have a JAXB object with
mode MESSAGE");
+ //context.setProperty(DispatchContext.DISPATCH_MESSAGE,
DispatchContext.MessageType.HTTP_JAXB_MESSAGE);
+ else
+ context.setProperty(DispatchContext.DISPATCH_MESSAGE,
DispatchContext.MessageType.JAXB_MESSAGE);
+ }
+ }
+
+ return context;
+ }
+
+ Executor getCurrentExecutor() {
+ return _service.getExecutor();
+ }
+
+ public QName getServiceName() {
+ if (_service != null)
+ return _service.getServiceName();
+ return null;
+ }
+
+ public QName getPortName() {
+ if (_portInfo != null)
+ return _portInfo.getName();
+ return null;
+ }
+
+ private boolean isValidNullParameter(Object msg) {
+ if (msg != null)
+ return true;
+
+ String method = (String)
getRequestContext().get(MessageContext.HTTP_REQUEST_METHOD);
+ if (method == null)
+ method = "POST";
+
+ String bindingId = _getBindingId().toString();
+ if (("POST".equalsIgnoreCase(method))) {
+
+ if (SOAPBinding.SOAP11HTTP_BINDING.equals(bindingId) ||
+ SOAPBinding.SOAP11HTTP_MTOM_BINDING.equals(bindingId)) {
+ switch (_mode) {
+ case MESSAGE:
+ throw new WebServiceException("SOAP 1.1 Binding with null
invocation parameter is not allowed with HTTP POST Request Method in MESSAGE mode");
+ //return false;
+ case PAYLOAD:
+ return true;
+ }
+ } else if (HTTPBinding.HTTP_BINDING.equals(bindingId)) {
+ switch (_mode) {
+ case MESSAGE:
+ case PAYLOAD:
+ throw new WebServiceException("XML/HTTP Binding with null
invocation parameter is not allowed with HTTP POST Request Method in MESSAGE or PAYLOAD
mode");
+ }
+
+ } else if (SOAPBinding.SOAP12HTTP_BINDING.equals(bindingId) ||
+ SOAPBinding.SOAP12HTTP_MTOM_BINDING.equals(bindingId)) {
+ switch (_mode) {
+ case MESSAGE:
+ throw new WebServiceException("SOAP 1.2 Binding with null
invocation parameter is not allowed with HTTP POST Request Method in MESSAGE mode");
+ //return false;
+ case PAYLOAD:
+ return true;
+ }
+ }
+
+ } else if ("GET".equalsIgnoreCase(method)) {
+
+ if (SOAPBinding.SOAP12HTTP_BINDING.equals(bindingId) ||
+ SOAPBinding.SOAP12HTTP_MTOM_BINDING.equals(bindingId)) {
+ switch (_mode) {
+ case MESSAGE:
+ //return false;
+ throw new WebServiceException("SOAP 1.2 Binding with null
invocation parameter is not allowed with HTTP GET Request Method in MESAGE mode.");
+ case PAYLOAD:
+ return true;
+ }
+ } else if (SOAPBinding.SOAP11HTTP_BINDING.equals(bindingId) ||
+ SOAPBinding.SOAP11HTTP_MTOM_BINDING.equals(bindingId)) {
+ switch (_mode) {
+ case MESSAGE:
+ case PAYLOAD:
+ throw new WebServiceException("SOAP 1.1 Binding with null
invocation parameter is not allowed with HTTP GET Request Method in either PAYLOAD or
MESAGE mode.");
+ //return false;
+ }
+ } else if (HTTPBinding.HTTP_BINDING.equals(bindingId)) {
+ switch (_mode) {
+ case MESSAGE:
+ case PAYLOAD:
+ return true;
+ }
+ }
+
+ } else if ("DELETE".equalsIgnoreCase(method) ||
"HEAD".equalsIgnoreCase(method)) {
+
+ if (HTTPBinding.HTTP_BINDING.equals(bindingId)) {
+ switch (_mode) {
+ case MESSAGE:
+ case PAYLOAD:
+ return true;
+ }
+ } else if (SOAPBinding.SOAP12HTTP_BINDING.equals(bindingId) ||
+ SOAPBinding.SOAP12HTTP_MTOM_BINDING.equals(bindingId)) {
+ switch (_mode) {
+ case MESSAGE:
+ //return false;
+ throw new WebServiceException("SOAP 1.2 Binding with null
invocation parameter is not allowed with HTTP " + method + " Request Method in
MESAGE mode.");
+ case PAYLOAD:
+ return true;
+ }
+ } else if (SOAPBinding.SOAP11HTTP_BINDING.equals(bindingId) ||
+ SOAPBinding.SOAP11HTTP_MTOM_BINDING.equals(bindingId)) {
+ //return false;
+ throw new WebServiceException("SOAP 1.1 Binding with null invocation
parameter is not allowed with HTTP " + method + " Request Method in either
PAYLOAD or MESAGE mode.");
+ //return false;
+ }
+
+ }
+ return false;
+ }
+
+ private static ClientTransportFactory defaultTransportFactory = null;
+ private static final Logger logger =
+ Logger.getLogger(new
StringBuffer().append(org.jboss.com.sun.xml.ws.util.Constants.LoggingDomain).append(".client.dispatch").toString());
+
+ protected Map _requestContext;
+ protected Map _responseContext;
+ protected Service.Mode _mode;
+ protected WSServiceDelegate _service;
+ protected Class _clazz;
+ protected JAXBContext _jaxbContext;
+
+ protected Delegate _delegate = null;
+ protected PortInfoBase _portInfo = null;
+
+ protected String _bindingId = null;
+ protected BindingImpl binding;
+
+ private ClientTransportFactory _transportFactory;
+ private Lock _lock;
+
+}
\ No newline at end of file
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/DispatchBase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/DispatchContext.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/DispatchContext.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/DispatchContext.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,77 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.client.dispatch;
+
+import java.util.HashMap;
+
+/**
+ * $author: JAXWS Development Team
+ */
+public class DispatchContext {
+
+ private HashMap dprops = null;
+
+ public DispatchContext() {
+ dprops = new HashMap();
+ }
+
+ public void setProperty(String name, Object value) {
+ dprops.put(name, value);
+ }
+
+ public Object getProperty(String name) {
+ return dprops.get(name);
+ }
+
+ public void removeProperty(String name) {
+ dprops.remove(name);
+ }
+
+ public void clearProperties() {
+ dprops.clear();
+ }
+
+ public static final String DISPATCH_MESSAGE =
+ "org.jboss.com.sun.xml.ws.rt.client.dispatch.messagetype";
+ public static final String DISPATCH_MESSAGE_MODE =
+ "org.jboss.com.sun.xml.ws.rt.client.dispatch.mode";
+ public static final String DISPATCH_MESSAGE_CLASS =
+ "org.jboss.com.sun.xml.ws.rt.client.dispatch.messageclass";
+
+ public enum MessageClass {
+ SOURCE ,JAXBOBJECT, SOAPMESSAGE, DATASOURCE
+ }
+
+ public enum MessageType {
+ JAXB_PAYLOAD, //SOAP Binding
+ SOURCE_PAYLOAD,
+ JAXB_MESSAGE,
+ SOURCE_MESSAGE ,
+ SOAPMESSAGE_MESSAGE,
+ //HTTP_DATASOURCE_PAYLOAD, //HTTP Binding
+ HTTP_DATASOURCE_MESSAGE,
+ HTTP_SOURCE_MESSAGE, //can be allowed with an HTTP GET method
+ HTTP_SOURCE_PAYLOAD,
+ HTTP_JAXB_PAYLOAD,
+ //HTTP_JAXB_MESSAGE
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/DispatchContext.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/ResponseImpl.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/ResponseImpl.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/ResponseImpl.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,132 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.client.dispatch;
+
+
+import javax.xml.ws.Response;
+
+import org.jboss.com.sun.xml.ws.client.AsyncHandlerService;
+import org.jboss.com.sun.xml.ws.client.ResponseContext;
+
+import java.rmi.server.UID;
+import java.util.Map;
+import java.util.concurrent.Callable;
+import java.util.concurrent.FutureTask;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+import java.util.logging.Logger;
+
+/**
+ * The <code>Response</code> interface provides methods used to obtain the
+ * payload and context a message sent in response to an operation invocation.
+ * For asynchronous operation invocations it provides additional methods to
+ * check the status of the request.
+ *
+ * @author JAXWS Development Team
+ * @version 1.0
+ */
+
+
+public class ResponseImpl<T> extends FutureTask<T> implements
Response<T> {
+ private static final Logger logger =
+ Logger.getLogger(new
StringBuffer().append(org.jboss.com.sun.xml.ws.util.Constants.LoggingDomain).append(".client.dispatch").toString());
+ private UID uid;
+ private Lock _lock;
+ private AsyncHandlerService _handlerService;
+ private ResponseContext _responseContext;
+ private boolean handler;
+
+ public ResponseImpl(Callable<T> callable) {
+ super(callable);
+ _lock = new ReentrantLock();
+ }
+
+ public ResponseImpl(Runnable runable, T result) {
+ super(runable, result);
+ _lock = new ReentrantLock();
+ }
+
+ //protected method need to overide
+ public void setException(Exception ex) {
+ _lock.lock();
+ try {
+ super.setException(ex);
+ } catch (Exception e) {
+ } finally {
+ _lock.unlock();
+ }
+ }
+
+ public void set(T result) {
+ _lock.lock();
+ try {
+ super.set(result);
+ } catch (Exception e) {
+ } finally {
+ _lock.unlock();
+ }
+ }
+
+ /**
+ * Gets the contained response context.
+ *
+ * @return The contained response context. May be <code>null</code> if a
+ * response is not yet available.
+ */
+ public Map<String, Object> getContext() {
+ if (!isDone()) {
+ return null;
+ } else {
+ return (_responseContext);
+ }
+ }
+
+ public void setResponseContext(Map context) {
+ _responseContext = (ResponseContext) context;
+ }
+
+ public synchronized void setUID(UID id) {
+ uid = id;
+ }
+
+ public synchronized UID getUID() {
+ return uid;
+ }
+
+ public void setHandlerService(AsyncHandlerService handlerService) {
+ _handlerService = handlerService;
+ }
+
+ //got to lock
+
+ public void done() {
+ _lock.lock();
+ try {
+ if (!isCancelled())
+ _handlerService.executeWSFuture();
+
+ } catch (Exception e) {
+ } finally {
+ _lock.unlock();
+ }
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/ResponseImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/impl/DispatchContactInfoList.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/impl/DispatchContactInfoList.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/impl/DispatchContactInfoList.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,71 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.client.dispatch.impl;
+
+import java.util.ArrayList;
+
+import javax.xml.ws.http.HTTPBinding;
+import javax.xml.ws.soap.SOAPBinding;
+
+import org.jboss.com.sun.xml.ws.client.ContactInfoBase;
+import org.jboss.com.sun.xml.ws.client.ContactInfoListIteratorBase;
+import org.jboss.com.sun.xml.ws.client.dispatch.impl.protocol.MessageDispatcherHelper;
+import org.jboss.com.sun.xml.ws.encoding.soap.client.SOAP12XMLDecoder;
+import org.jboss.com.sun.xml.ws.encoding.soap.client.SOAP12XMLEncoder;
+import org.jboss.com.sun.xml.ws.encoding.soap.client.SOAPXMLDecoder;
+import org.jboss.com.sun.xml.ws.encoding.soap.client.SOAPXMLEncoder;
+import org.jboss.com.sun.xml.ws.encoding.xml.XMLDecoder;
+import org.jboss.com.sun.xml.ws.encoding.xml.XMLEncoder;
+import org.jboss.com.sun.xml.ws.pept.ept.ContactInfoList;
+import org.jboss.com.sun.xml.ws.pept.ept.ContactInfoListIterator;
+import org.jboss.com.sun.xml.ws.protocol.xml.client.XMLMessageDispatcher;
+
+
+/**
+ * @author: WS Development Team
+ */
+public class DispatchContactInfoList implements ContactInfoList {
+
+ public ContactInfoListIterator iterator() {
+ ArrayList<Object> arrayList = new ArrayList<Object>();
+
+ arrayList.add(new ContactInfoBase(null,
+ new MessageDispatcherHelper(),
+ new SOAPXMLEncoder(),
+ new SOAPXMLDecoder(),SOAPBinding.SOAP11HTTP_BINDING));
+ arrayList.add(new ContactInfoBase(null,
+ new MessageDispatcherHelper(),
+ new SOAP12XMLEncoder(),
+ new SOAP12XMLDecoder(), SOAPBinding.SOAP12HTTP_BINDING));
+ arrayList.add(new ContactInfoBase(null,
+ new XMLMessageDispatcher(),
+ new XMLEncoder(),
+ new XMLDecoder(), HTTPBinding.HTTP_BINDING));
+ /*arrayList.add(new DispatchContactInfo(null,
+ new MessageDispatcherHelper(new DispatchEncoderDecoderUtil()),
+ new SOAPFastEncoder(new DispatchEncoderDecoderUtil()),
+ new SOAPFastDecoder(new DispatchEncoderDecoderUtil())));
+ */
+ return new ContactInfoListIteratorBase(arrayList);
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/impl/DispatchContactInfoList.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/impl/DispatchDelegate.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/impl/DispatchDelegate.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/impl/DispatchDelegate.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,118 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.client.dispatch.impl;
+
+
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.WebServiceException;
+
+import org.jboss.com.sun.xml.ws.binding.BindingImpl;
+import org.jboss.com.sun.xml.ws.client.*;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.DelegateBase;
+import org.jboss.com.sun.xml.ws.pept.ept.ContactInfo;
+import org.jboss.com.sun.xml.ws.pept.ept.ContactInfoList;
+import org.jboss.com.sun.xml.ws.pept.ept.ContactInfoListIterator;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.pept.presentation.MessageStruct;
+import org.jboss.com.sun.xml.ws.pept.protocol.MessageDispatcher;
+
+import java.util.logging.Logger;
+import java.util.logging.Level;
+
+/**
+ * @author WS Development Team
+ */
+public class DispatchDelegate extends DelegateBase {
+
+ private static final Logger logger =
+ Logger.getLogger(new
StringBuffer().append(org.jboss.com.sun.xml.ws.util.Constants.LoggingDomain).append(".client.dispatch").toString());
+
+ public DispatchDelegate() {
+ }
+
+ public DispatchDelegate(ContactInfoList contactInfoList) {
+ this.contactInfoList = contactInfoList;
+ }
+
+ public void send(MessageStruct messageStruct) {
+ MessageInfo messageInfo = (MessageInfo) messageStruct;
+
+ ContextMap properties = (ContextMap)
+
messageInfo.getMetaData(BindingProviderProperties.JAXWS_CONTEXT_PROPERTY);
+ BindingProvider dispatch =
(BindingProvider)properties.get(BindingProviderProperties.JAXWS_CLIENT_HANDLE_PROPERTY);
+
+ if (!contactInfoList.iterator().hasNext())
+ throw new WebServiceException("can't pickup message encoder/decoder,
no ContactInfo!");
+
+
+ BindingImpl bi = (BindingImpl)dispatch.getBinding();
+ String bindingId = bi.getBindingId();
+ ContactInfo contactInfo = getContactInfo(contactInfoList, bindingId);
+ messageInfo.setEPTFactory(contactInfo);
+ messageInfo.setConnection(contactInfo.getConnection(messageInfo));
+
+ MessageDispatcher messageDispatcher =
+ contactInfo.getMessageDispatcher(messageInfo);
+ messageDispatcher.send(messageInfo);
+ }
+
+ private ContactInfo getContactInfo(ContactInfoList cil, String bindingId){
+ ContactInfoListIterator iter = cil.iterator();
+ while(iter.hasNext()){
+ ContactInfoBase cib = (ContactInfoBase)iter.next();
+ if(cib.getBindingId().equals(bindingId))
+ return cib;
+ }
+ //return the first one
+ return cil.iterator().next();
+ }
+ /*private ContactInfo getContactInfo(ContactInfoListIterator iterator, MessageStruct
messageStruct) {
+ if (!iterator.hasNext())
+ throw new RuntimeException("no next");
+
+ ContactInfo contactInfo = iterator.next();
+ //Todo: use Map
+ //if fast encoding go to next
+ if (isFastEncoding((RequestContext)
+
messageStruct.getMetaData(BindingProviderProperties.JAXWS_CONTEXT_PROPERTY))) {
+ if (iterator.hasNext())
+ contactInfo = iterator.next();
+ else {
+ if (logger.isLoggable(Level.INFO)) //needs localicalization
+ logger.info("Defaulting to XML Encoding. ");
+ setDefaultEncoding((RequestContext)
+
messageStruct.getMetaData(BindingProviderProperties.JAXWS_CONTEXT_PROPERTY));
+ }
+ } else
+ setDefaultEncoding((RequestContext)
+
messageStruct.getMetaData(BindingProviderProperties.JAXWS_CONTEXT_PROPERTY));
+
+ return contactInfo;
+ }
+ */
+
+ private void setDefaultEncoding(RequestContext requestContext) {
+ requestContext.put(BindingProviderProperties.ACCEPT_ENCODING_PROPERTY,
+ BindingProviderProperties.XML_ENCODING_VALUE);
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/impl/DispatchDelegate.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/impl/encoding/DispatchSerializer.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/impl/encoding/DispatchSerializer.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/impl/encoding/DispatchSerializer.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,325 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.client.dispatch.impl.encoding;
+
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.namespace.QName;
+import static javax.xml.stream.XMLStreamConstants.*;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.ws.WebServiceException;
+
+import org.jboss.com.sun.xml.ws.encoding.jaxb.JAXBBeanInfo;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAP12Constants;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPConstants;
+import org.jboss.com.sun.xml.ws.encoding.soap.SerializationException;
+import org.jboss.com.sun.xml.ws.streaming.Attributes;
+import org.jboss.com.sun.xml.ws.streaming.SourceReaderFactory;
+import org.jboss.com.sun.xml.ws.streaming.XMLStreamReaderUtil;
+import org.jboss.com.sun.xml.ws.streaming.XMLStreamWriterFactory;
+import org.jboss.com.sun.xml.ws.util.ByteArrayBuffer;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.logging.Logger;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.HashMap;
+
+/**
+ * @author WS Development Team
+ */
+public final class DispatchSerializer {
+
+ private static final Logger logger =
+ Logger.getLogger(new
StringBuffer().append(org.jboss.com.sun.xml.ws.util.Constants.LoggingDomain).append(".client.dispatch").toString());
+
+ private final QName bodyTagName;
+
+ /**
+ * For SOAP 1.0.
+ */
+ public static final DispatchSerializer SOAP_1_0 = new
DispatchSerializer(SOAPConstants.QNAME_SOAP_BODY);
+
+ /**
+ * For SOAP 1.2.
+ */
+ public static final DispatchSerializer SOAP_1_2 = new
DispatchSerializer(SOAP12Constants.QNAME_SOAP_BODY);
+
+
+ private DispatchSerializer(QName soapBodyTagName) {
+ bodyTagName = soapBodyTagName;
+ }
+
+ public void serialize(Object obj, XMLStreamWriter writer, JAXBContext context) {
+ if (obj instanceof Source)
+ serializeSource(obj, writer);
+ else if (obj instanceof JAXBBeanInfo) {
+ ((JAXBBeanInfo) obj).writeTo(writer);
+ } else
+ throw new WebServiceException("Unable to serialize object type " +
obj.getClass().getName());
+ //should not happen
+ }
+
+
+ private static String convertNull(String s) {
+ return (s != null) ? s : "";
+ }
+
+ // this is very very inefficient.
+ //kw-needs lots of cleanup
+ //kw-modifying this in any way will cause dispatch tests sqe failures
+ public Source deserializeSource(XMLStreamReader reader, DispatchUtil dispatchUtil) {
+
+ ByteArrayBuffer baos = new ByteArrayBuffer();
+ XMLStreamWriter writer = XMLStreamWriterFactory.createXMLStreamWriter(baos);
+ dispatchUtil.populatePrefixes(writer);
+ try {
+ while (reader.hasNext()) {
+ int state = reader.getEventType();
+ switch (state) {
+ case START_ELEMENT:
+
+ String uri = reader.getNamespaceURI();
+ String rprefix = reader.getPrefix();
+ String nlocal = reader.getLocalName();
+ setWriterPrefixes(rprefix, uri, writer);
+
+ String prefix = null;
+ String wprefix = writer.getNamespaceContext().getPrefix(uri);
+ if ((wprefix != null && !"".equals(wprefix))
&& wprefix.length() > 0){
+ prefix = wprefix;
+ } else
+ if ((rprefix != null && !"".equals(rprefix))
&& (uri != null && !"null".equals(uri))){
+ prefix = setWriterPrefixes(reader, uri, writer);
+ } else {
+ prefix = convertNull(prefix);
+ uri = convertNull(uri);
+ }
+
+ writer.writeStartElement(prefix, nlocal, uri);
+ writer.writeNamespace(prefix, uri);
+
+ Attributes atts = XMLStreamReaderUtil.getAttributes(reader);
+ writer.flush();
+ writeAttributes(atts, writer, prefix, uri);
+ break;
+ case END_ELEMENT:
+ writer.writeEndElement();
+ break;
+ case CHARACTERS:
+ writer.writeCharacters(reader.getText());
+
+ }
+ state = XMLStreamReaderUtil.next(reader);
+ if ((reader.getEventType() == END_ELEMENT) &&
(reader.getName().equals(bodyTagName)))
+ break;
+ }
+ writer.flush();
+ writer.close();
+ reader.close();
+ } catch (XMLStreamException ex) {
+ ex.printStackTrace();
+ }
+
+ return new StreamSource(baos.newInputStream());
+ }
+
+ private void writeAttributes(Attributes atts, XMLStreamWriter writer, String prefix,
String uri) throws XMLStreamException {
+ for (int i = 0; i < atts.getLength(); i++) {
+
+ String value = atts.getValue(i);
+ String localName = atts.getName(i).getLocalPart();
+ String aprefix = atts.getPrefix(i);
+ String auri = atts.getURI(i);
+
+ setWriterPrefix(localName, value, aprefix, writer);
+ if (atts.isNamespaceDeclaration(i)) {
+ writeAttrNamespace(aprefix, auri, writer, localName, prefix, uri,
value);
+ } else {
+ writeAttribute(atts, i, writer);
+ }
+ }
+ }
+
+ private void setWriterPrefix(String localName, String value, String aprefix,
XMLStreamWriter writer) throws XMLStreamException {
+ if (localName.equals("xsi") &&
+
value.equals("http://www.w3.org/2001/XMLSchema-instance")
&&
+ aprefix.equals("xmlns")) {
+ //kw was aa prefix
+ writer.setPrefix(localName, value);
+ }
+ }
+
+ private String setWriterPrefixes(XMLStreamReader reader, String nuri, XMLStreamWriter
writer) {
+
+ String prefix = reader.getNamespaceContext().getPrefix(nuri);
+ if (prefix == null)
+ prefix = convertNull(prefix);
+ if (prefix != null && prefix.length() > 0 && nuri != null
&& !prefix.equals("xmlns")) {
+ try {
+ writer.setPrefix(prefix, nuri);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ return prefix;
+ }
+
+ private void setWriterPrefixes(String npre, String nuri, XMLStreamWriter writer)
throws XMLStreamException {
+ if ((npre != null && npre.length() > 0) && (nuri.length() >
0 && nuri != null))
+ {
+ if ((npre.equals("null") || nuri.equals("null"))) {
+ writer.setPrefix(npre, nuri);
+ }
+ }
+ }
+
+ private void writeAttrNamespace(String aprefix, String auri, XMLStreamWriter writer,
String localName, String prefix, String nuri, String value) throws XMLStreamException {
+ if (aprefix == null || !aprefix.equals("") ||
(aprefix.equals("xmlns")))
+ {
+ String temp = aprefix;
+ if (auri != null) {
+ String wprefix = writer.getNamespaceContext().getPrefix(auri);
+ if (aprefix.equals("xmlns") &&
!(localName.equals("xsi"))){
+ aprefix = prefix;
+ auri = nuri;
+ } else {
+ if (wprefix != null && !wprefix.equals("xmlns")) {
+ aprefix = wprefix;
+ }
+ }
+ if (aprefix == null)
+ convertNull(aprefix);
+ }
+
+ writeNamespace(aprefix, prefix, auri, nuri, writer);
+ writeXSINamspece(localName, value, temp, writer, aprefix, auri);
+ }
+ }
+
+ private void writeNamespace(String aprefix, String prefix, String auri, String nuri,
XMLStreamWriter writer) throws XMLStreamException {
+ if (!(aprefix.equals(prefix) && auri.equals(nuri))){
+ if (!aprefix.equals("xmlns")) {
+ writer.writeNamespace(aprefix, auri);
+ }
+ }
+ }
+
+ private void writeXSINamspece(String localName, String value, String temp,
XMLStreamWriter writer, String aprefix, String auri) throws XMLStreamException {
+ if (localName.equals("xsi") &&
+
value.equals("http://www.w3.org/2001/XMLSchema-instance")
&&
+ temp.equals("xmlns")) {
+ writer.setPrefix(localName, value);
+ writer.writeAttribute(aprefix, auri, localName, value);
+ }
+ }
+
+ private void writeAttribute(Attributes atts, int i, XMLStreamWriter writer) throws
XMLStreamException {
+ if ((atts.getURI(i) == null) && (atts.getPrefix(i) != null)) {
+ String ns = writer.getNamespaceContext().getNamespaceURI(atts.getURI(i));
+ writer.writeAttribute(atts.getPrefix(i), ns, atts.getLocalName(i),
+ atts.getValue(i));
+ }
+ writer.writeAttribute(atts.getPrefix(i), atts.getURI(i), atts.getLocalName(i),
atts.getValue(i));
+ }
+
+ void serializeSource(Object source, XMLStreamWriter writer) {
+ try {
+ XMLStreamReader reader = SourceReaderFactory.createSourceReader((Source)
source, true);
+
+ int state;
+ do {
+ state = XMLStreamReaderUtil.next(reader);
+ switch (state) {
+ case START_ELEMENT:
+ QName elementName = reader.getName();
+ String localPart = elementName.getLocalPart();
+ String namespaceURI = elementName.getNamespaceURI();
+ String prefix = elementName.getPrefix();
+
+ writer.writeStartElement(prefix, localPart, namespaceURI);
+
+ Attributes atts = XMLStreamReaderUtil.getAttributes(reader);
+ writer.flush();
+ for (int i = 0; i < atts.getLength(); i++) {
+ if (atts.isNamespaceDeclaration(i)) {
+ String value = atts.getValue(i);
+ String localName = atts.getName(i).getLocalPart();
+ writer.setPrefix(localName, value);
+ writer.writeNamespace(localName, value);
+ } else {
+ writer.writeAttribute(atts.getPrefix(i), atts.getURI(i),
+ atts.getLocalName(i), atts.getValue(i));
+ }
+ }
+ break;
+ case END_ELEMENT:
+ writer.writeEndElement();
+ break;
+ case CHARACTERS:
+ writer.writeCharacters(reader.getText());
+ }
+ } while (state != END_DOCUMENT);
+ } catch (XMLStreamException e) {
+ throw new SerializationException(e);
+ }
+ }
+
+// private void displayDOM(Node node, java.io.OutputStream ostream) {
+// try {
+// System.out.println("\n====\n");
+//
javax.xml.transform.TransformerFactory.newInstance().newTransformer().transform(new
javax.xml.transform.dom.DOMSource(node),
+// new javax.xml.transform.stream.StreamResult(ostream));
+// System.out.println("\n====\n");
+// } catch (Exception e) {
+// e.printStackTrace();
+// }
+// }
+
+// private String sourceToXMLString(Source result) {
+// String xmlResult = null;
+// try {
+// TransformerFactory factory = TransformerFactory.newInstance();
+// Transformer transformer = factory.newTransformer();
+// transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION,
"yes");
+// transformer.setOutputProperty(OutputKeys.METHOD, "xml");
+// OutputStream out = new ByteArrayOutputStream();
+// StreamResult streamResult = new StreamResult();
+// streamResult.setOutputStream(out);
+// transformer.transform(result, streamResult);
+// xmlResult = streamResult.getOutputStream().toString();
+// } catch (TransformerException e) {
+// e.printStackTrace();
+// }
+// return xmlResult;
+// }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/impl/encoding/DispatchSerializer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/impl/encoding/DispatchUtil.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/impl/encoding/DispatchUtil.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/impl/encoding/DispatchUtil.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,76 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+/*
+ * Copyright (c) 2005 Sun Microsystems, Inc.
+ * All Rights Reserved.
+ */
+package org.jboss.com.sun.xml.ws.client.dispatch.impl.encoding;
+
+
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.xml.ws.streaming.XMLStreamWriterFactory;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Set;
+
+public class DispatchUtil {
+
+ private Map<String, String> namespacePrefixMap;
+
+ public void clearNPMap() {
+ namespacePrefixMap.clear();
+ }
+
+ public void populatePrefixes(XMLStreamWriter writer) {
+ if (!namespacePrefixMap.isEmpty()) {
+ Set<Map.Entry<String, String>> entrys =
namespacePrefixMap.entrySet();
+ for (Map.Entry<String, String> entry : entrys) {
+ try {
+ writer.setPrefix(entry.getValue(), entry.getKey());
+ } catch (XMLStreamException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+ public void collectPrefixes(XMLStreamReader reader) {
+ if (namespacePrefixMap == null)
+ namespacePrefixMap = new HashMap<String, String>();
+
+ int i = reader.getNamespaceCount();
+ for (int j = 0; j < i; j++){
+ String prefix = reader.getNamespacePrefix(j);
+ String namespace = reader.getNamespaceURI(j);
+ if (prefix.length() > 0 && namespace != null) {
+ namespacePrefixMap.put(namespace, prefix);
+ }
+ }
+ }
+}
+
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/impl/encoding/DispatchUtil.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/impl/protocol/MessageDispatcherHelper.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/impl/protocol/MessageDispatcherHelper.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/impl/protocol/MessageDispatcherHelper.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,76 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.client.dispatch.impl.protocol;
+
+
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.WebServiceException;
+
+import org.jboss.com.sun.xml.ws.binding.BindingImpl;
+import org.jboss.com.sun.xml.ws.client.BindingProviderProperties;
+import org.jboss.com.sun.xml.ws.client.ContextMap;
+import org.jboss.com.sun.xml.ws.handler.HandlerChainCaller;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.pept.presentation.MessageStruct;
+import org.jboss.com.sun.xml.ws.pept.protocol.MessageDispatcher;
+import org.jboss.com.sun.xml.ws.protocol.soap.client.SOAPMessageDispatcher;
+
+import java.util.logging.Logger;
+
+/**
+ * @author WS Development Team
+ */
+public class MessageDispatcherHelper extends SOAPMessageDispatcher
+ implements BindingProviderProperties {
+
+ private static final Logger logger =
+ Logger.getLogger(new
StringBuffer().append(org.jboss.com.sun.xml.ws.util.Constants.LoggingDomain).append(".client.dispatch").toString());
+
+ public MessageDispatcherHelper() {
+ super();
+ }
+
+ @Override
+ protected void setResponseType(Throwable e, MessageInfo messageInfo) {
+ if (e instanceof RuntimeException) {
+ //leave for now- fix later
+ if (e instanceof WebServiceException)
+ messageInfo.setResponseType(MessageStruct.CHECKED_EXCEPTION_RESPONSE);
+ else
+ messageInfo.setResponseType(MessageStruct.UNCHECKED_EXCEPTION_RESPONSE);
+ } else {
+ messageInfo.setResponseType(MessageStruct.CHECKED_EXCEPTION_RESPONSE);
+ }
+ }
+
+ @Override
+ protected HandlerChainCaller getHandlerChainCaller(MessageInfo messageInfo) {
+ ContextMap context = (ContextMap)
+ messageInfo.getMetaData(BindingProviderProperties.JAXWS_CONTEXT_PROPERTY);
+ BindingProvider provider = (BindingProvider)
+ context.get(BindingProviderProperties.JAXWS_CLIENT_HANDLE_PROPERTY);
+ BindingImpl binding = (BindingImpl) provider.getBinding();
+ return binding.getHandlerChainCaller();
+ }
+
+}
+
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/dispatch/impl/protocol/MessageDispatcherHelper.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/package-info.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/package-info.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/package-info.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,270 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+/**
+ * <h1>JAX-WS 2.0 Client Runtime</h1>
+ * <P>This document describes the architecture of client side
+ * JAX-WS 2.0 runtime.
+ *
+ * <h3>JAX-WS 2.0 Server Client Sequence Diagram</h3>
+ * {@SequenceDiagram
+ * pobject(U,"user");
+ * object(A,"EndpointIFInvocationHandler");
+ * object(B,"DelegateBase");
+ * object(C,"MessageDispatcher");
+ * object(D,"Encoder/Decoder");
+ * object(F,"WSConnection");
+ * step();
+ *
+ * message(U,A,"invoke Web Service");
+ * active(A);
+ * message(A,A,"invoke");
+ * active(A);
+ * step();
+ * inactive(A);
+ *# step();
+ *
+ * message(A,A,"implementSEIMethod");
+ * active(A);
+ * step();
+ * inactive(A);
+ *
+ * message(A,B,"send");
+ * active(B);
+ *
+ * message(B,B,"getContactInfo");
+ * active(B);
+ * step();
+ * inactive(B);
+ *
+ * message(B,B,"getMessageDispatcher");
+ * active(B);
+ * step();
+ * inactive(B);
+ *
+ * message(B,C,"send");
+ * active(C);
+ *# step();
+ *# inactive(B);
+ *
+ *# message(C,C,"doSend");
+ *# active(C);
+ *# step();
+ *# inactive(C);
+ *
+ *# active(C);
+ * message(C,D,"toInternalMessage");
+ * active(D);
+ * step();
+ * inactive(D);
+ *
+ * message(C,D,"toSOAPMessage");
+ * active(D);
+ * step();
+ * inactive(D);
+ *
+ * message(C,C,"invokeHandlers");
+ * active(C);
+ * step();
+ * inactive(C);
+ *
+ * message(C,F,"setHeaders");
+ * active(F);
+ * step();
+ * inactive(F);
+ *
+ * message(C,F,"getOutput");
+ * active(F);
+ * step();
+ * inactive(F);
+ *
+ * message(C,F,"writeTo");
+ * active(F);
+ * step();
+ * inactive(F);
+ *
+ *# message(C,C,"receive");
+ *# active(C);
+ *# step();
+ *# inactive(C);
+ *
+ * message(C,F,"readSOAPMessage");
+ * active(F);
+ * step();
+ * inactive(F);
+ *
+ * message(C,C,"mustUnderstand");
+ * active(C);
+ * step();
+ * inactive(C);
+ *
+ * message(C,C,"invokeHandlers");
+ * active(C);
+ * step();
+ * inactive(C);
+ *
+ * message(C,D,"toInternalMessage");
+ * active(D);
+ * step();
+ * inactive(D);
+ *
+ *# message(C,C,"doSendAsync");
+ *# active(C);
+ *# step();
+ *# inactive(C);
+ *
+ *# message(C,C,"sendAsyncReceive");
+ *# active(C);
+ *# step();
+ *# inactive(C);
+ *
+ * rmessage(C,B,"response");
+ * inactive(C);
+ *
+ * rmessage(B,A,"response");
+ * inactive(B);
+ *
+ * rmessage(A,U,"response");
+ * complete(A);
+ * }
+ *
+ * <H3>Message Flow</H3>
+ * {@link org.jboss.com.sun.xml.ws.client.WebService} provides client view of a Web
service.
+ * WebService.getPort returns an instance of {@link
org.jboss.com.sun.xml.ws.client.EndpointIFInvocationHandler}
+ * with {@link com.sun.pept.ept.ContactInfoList} and {@link com.sun.pept.Delegate}
+ * initialized. A method invocation on the port, obtained from WebService, invokes
+ * {@link org.jboss.com.sun.xml.ws.client.EndpointIFInvocationHandler#invoke}. This
method
+ * then creates a {@link com.sun.pept.ept.MessageInfo} and populates the data
+ * (parameters specified by the user) and metadata such as RuntimeContext,
RequestContext,
+ * Message Exchange Pattern into this MessageInfo. This method then invokes
+ * {@link com.sun.pept.Delegate#send} and returns the response.
+ * <P></P>
+ * The Delegate.send method iterates through the ContactInfoList and picks up the
+ * correct {@link com.sun.pept.ept.ContactInfo} based upon the binding id of
+ * {@link javax.xml.ws.BindingProvider} and sets it on the MessageInfo. After the
+ * Delegate obtains a specific ContactInfo it uses that ContactInfo to obtain a
+ * protocol-specific {@link com.sun.pept.protocol.MessageDispatcher}. There will be
+ * two types of client-side MessageDispatchers for JAX-WS 2.0 FCS,
+ * {@link org.jboss.com.sun.xml.ws.protocol.soap.client.SOAPMessageDispatcher} and
+ * {@link org.jboss.com.sun.xml.ws.protocol.xml.client.XMLMessageDispatcher}. The
Delegate
+ * then invokes {@link com.sun.pept.protocol.MessageDispatcher#send}. The
+ * MessageDispatcher.send method makes a decision about the synchronous and
+ * asynchronous nature of the message exchange pattern and invokes separate methods
+ * accordingly.
+ * <p></P>
+ * The MessageDispatcher uses ContactInfo to obtain
+ * a {@link org.jboss.com.sun.xml.ws.encoding.soap.client.SOAPXMLEncoder} which converts
+ * the MessageInfo to {@link
org.jboss.com.sun.xml.ws.encoding.soap.internal.InternalMessage}.
+ * There will be two types of client-side SOAPXMLEncoder for JAX-WS 2.0 FCS,
+ * SOAPXMEncoder for SOAP 1.1 and {@link
org.jboss.com.sun.xml.ws.encoding.soap.client.SOAP12XMLEncoder}
+ * for SOAP 1.2. The MessageDispatcher invokes configured handlers and use the
+ * encoder to convert the InternalMessage to a {@link javax.xml.soap.SOAPMessage}.
+ * The metadata from the MessageInfo is classified into {@link
javax.xml.soap.MimeHeaders}
+ * of this SOAPMessage and context information for {@link
org.jboss.com.sun.xml.ws.spi.runtime.WSConnection}.
+ * The SOAPMessge is then written to the output stream of the WSConnection
+ * obtained from MessageInfo.
+ *<P></P>
+ * The MessageDispatcher.receive method handles the response. The
+ * SOAPMessageDispatcher extracts the SOAPMessage from the input stream of
+ * WSConnection and performs the mustUnderstand processing followed by invocation
+ * of any handlers. The MessageDispatcher uses ContactInfo to obtain a
+ * {@link org.jboss.com.sun.xml.ws.encoding.soap.client.SOAPXMLDecoder} which converts
the SOAPMessage
+ * to InternalMessage and then InternalMessage to MessageInfo. There will be two types of
+ * client-side SOAPXMLDecoder for JAX-WS 2.0 FCS, SOAPXMLDencoder for SOAP 1.1 and
+ * {@link org.jboss.com.sun.xml.ws.encoding.soap.client.SOAP12XMLDecoder} for SOAP 1.2.
The
+ * response is returned back to the client code via Delegate.
+ *
+ * <H3>External Interactions</H3>
+ * <H4>SAAJ API</H4>
+ * <UL>
+ * <LI><P>JAX-WS creates SAAJ SOAPMessage from the HttpServletRequest.
+ * At present, JAX-WS reads all the bytes from the request stream and
+ * then creates SOAPMessage along with the HTTP headers.</P>
+ * </UL>
+ * <P>MessageFactory(binding).createMessage(MimeHeaders, InputStream)</P>
+ * <UL>
+ * <LI><P>SOAPMessage parses the content from the stream including MIME
+ * data</P>
+ *
<LI><P>org.jboss.com.sun.xml.ws.server.SOAPMessageDispatcher::checkHeadersPeekBody()</P>
+ * <P>SOAPMessage.getSOAPHeader() is used for mustUnderstand processing
+ * of headers. It further uses
+ * SOAPHeader.examineMustUnderstandHeaderElements(role)</P>
+ * <P>SOAPMessage.getSOAPBody().getFistChild() is used for guessing the
+ * MEP of the request</P>
+ *
<LI><P>org.jboss.com.sun.xml.ws.handler.HandlerChainCaller:insertFaultMessage()</P>
+ * <P>SOAPMessage.getSOAPPart().getEnvelope() and some other SAAJ calls
+ * are made to create a fault in the SOAPMessage</P>
+ * <LI><P>org.jboss.com.sun.xml.ws.handler.LogicalMessageImpl::getPayload()
+ * interacts with SAAJ to get body from SOAPMessage</P>
+ *
<LI><P>org.jboss.com.sun.xml.ws.encoding.soap.SOAPEncoder.toSOAPMessage(org.jboss.com.sun.xml.ws.encoding.soap.internal.InternalMessage,
+ * SOAPMessage). There is a scenario where there is SOAPMessage and a
+ * logical handler sets payload as Source. To write to the stream,
+ * SOAPMessage.writeTo() is used but before that the body needs to be
+ * updated with logical handler' Source. Need to verify if this
+ * scenario is still happening since Handler.close() is changed to take
+ * MessageContext.</P>
+ *
<LI><P>org.jboss.com.sun.xml.ws.handlerSOAPMessageContextImpl.getHeaders()
+ * uses SAAJ API to get headers.</P>
+ * <LI><P>SOAPMessage.writeTo() is used to write response. At present,
+ * it writes into byte[] and this byte[] is written to
+ * HttpServletResponse.</P>
+ * </UL>
+ * <H4>JAXB API</H4>
+ * <P>JAX-WS RI uses the JAXB API to marshall/unmarshall user created
+ * JAXB objects with user created {@link javax.xml.bind.JAXBContext JAXBContext}.
+ * Handler, Dispatch in JAX-WS API provide ways for the user to specify his/her own
+ * JAXBContext. {@link org.jboss.com.sun.xml.ws.encoding.jaxb.JAXBTypeSerializer
JAXBTypeSerializer} class uses all these methods.</P>
+ * <UL>
+ * <LI><p>{@link javax.xml.bind.Marshaller#marshal(Object,XMLStreamWriter)
Marshaller.marshal(Object,XMLStreamWriter)}</p>
+ * <LI><P>{@link javax.xml.bind.Marshaller#marshal(Object,Result)
Marshaller.marshal(Object, DomResult)}</P>
+ * <LI><P>{@link javax.xml.bind.Unmarshaller#unmarshal(XMLStreamReader)
Object Unmarshaller.unmarshal(XMLStreamReader)}</P>
+ * <LI><P>{@link javax.xml.bind.Unmarshaller#unmarshal(Source) Object
Unmarshaller.unmarshal(Source)}</P>
+ * </UL>
+ * The following two JAXB classes are implemented by JAX-WS to enable/implement MTOM and
XOP
+ * <UL>
+ * <LI><P>{@link javax.xml.bind.attachment.AttachmentMarshaller
AttachmentMarshaller}</P>
+ * <LI><P>{@link javax.xml.bind.attachment.AttachmentUnmarshaller
AttachmentUnmarshaller}</P>
+ * </UL>
+ * <H4>JAXB Runtime-API (private contract)</H4>
+ * <P>JAX-WS RI uses these private API for serialization/deserialization
+ * purposes. This private API is used to serialize/deserialize method
+ * parameters at the time of JAXBTypeSerializer class uses all
+ * these methods.</P>
+ * <UL>
+ * <LI><P>{@link com.sun.xml.bind.api.Bridge#marshal(BridgeContext, Object,
XMLStreamWriter) Bridge.marshal(BridgeContext, Object, XMLStreamWriter)}</P>
+ * <LI><P>{@link com.sun.xml.bind.api.Bridge#marshal(BridgeContext, Object,
Node) Bridge.marshal(BridgeContext, Object, Node)}</P>
+ * <LI><P>{@link com.sun.xml.bind.api.Bridge#unmarshal(BridgeContext,
XMLStreamReader) Object Bridge.unmarshal(BridgeContext, XMLStreamReader)}</P>
+ * </UL>
+ *
+ * @ArchitectureDocument
+ **/
+package org.jboss.com.sun.xml.ws.client;
+
+import com.sun.xml.bind.api.BridgeContext;
+
+import javax.xml.ws.Binding;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.w3c.dom.Node;
\ No newline at end of file
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/client/package-info.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/developer/JAXWSProperties.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/developer/JAXWSProperties.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/developer/JAXWSProperties.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,31 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.developer;
+
+public interface JAXWSProperties {
+ // Some values are split into two strings so that package renaming for
+ // mustang doesn't alter the values. So do not combine them
+ // Content negotiation property: values "none", "pessimistic" and
"optimistic"
+ public static final String CONTENT_NEGOTIATION_PROPERTY = "com.sun."+
"xml.ws.client.ContentNegotiation";
+ public static final String MTOM_THRESHOLOD_VALUE =
"org.jboss.com.sun.xml.ws.common.MtomThresholdValue";
+ public static final String HTTP_EXCHANGE =
"org.jboss.com.sun.xml.ws.http.exchange";
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/developer/JAXWSProperties.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/EncoderDecoderBase.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/EncoderDecoderBase.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/EncoderDecoderBase.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,139 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.encoding;
+
+import com.sun.xml.bind.api.AccessorException;
+import com.sun.xml.bind.api.JAXBRIContext;
+import com.sun.xml.bind.api.RawAccessor;
+
+import javax.xml.bind.JAXBException;
+
+import org.jboss.com.sun.xml.ws.encoding.soap.SerializationException;
+import org.jboss.com.sun.xml.ws.model.RuntimeModel;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.server.RuntimeContext;
+
+import java.util.Map;
+
+/**
+ * @author Vivek Pandey
+ *
+ * Base Abstract class to be used for encoding-decoding a given binding.
+ */
+public abstract class EncoderDecoderBase {
+ /**
+ * Creates an internal message based thats binding dependent.
+ *
+ * @param messageInfo
+ * @return the internal message given a messageInfo
+ */
+ public Object toInternalMessage(MessageInfo messageInfo) {
+ throw new UnsupportedOperationException("Not Implementated!");
+ }
+
+ /**
+ * Fills in MessageInfo from binding dependent internal message.
+ *
+ * @param internalMessage
+ * @param messageInfo
+ */
+ public void toMessageInfo(Object internalMessage, MessageInfo messageInfo) {
+ throw new UnsupportedOperationException("Not Implementated!");
+ }
+
+ /**
+ * Get the wrapper child value from a jaxb style wrapper bean.
+ *
+ * @param context
+ * RuntimeContext to be passed by the encoder/decoder processing
+ * SOAP message during toMessageInfo()
+ * @param wrapperBean
+ * The wrapper bean instance
+ * @param nsURI
+ * namespace of the wrapper child property
+ * @param localName
+ * local name of the wrapper child property
+ * @return The wrapper child
+ *
+ */
+ protected Object getWrapperChildValue(RuntimeContext context, Object wrapperBean,
String nsURI,
+ String localName) {
+ if (wrapperBean == null)
+ return null;
+
+ RawAccessor ra = getRawAccessor(context, wrapperBean.getClass(), nsURI,
localName);
+ try {
+ return ra.get(wrapperBean);
+ } catch (AccessorException e) {
+ throw new SerializationException(e);
+ }
+ }
+
+ /**
+ * Set the wrapper child value from a jaxb style wrapper bean.
+ *
+ * @param context
+ * context RuntimeContext to be passed by the encoder/decoder
+ * processing SOAP message during toMessageInfo()
+ * @param wrapperBean
+ * The wrapper bean instance
+ * @param value
+ * value of the wrapper child property
+ * @param nsURI
+ * namespace of the wrapper child property
+ * @param localName
+ * localName local name of the wrapper child property
+ */
+ protected void setWrapperChildValue(RuntimeContext context, Object wrapperBean,
Object value,
+ String nsURI, String localName) {
+ if (wrapperBean == null)
+ return;
+ RawAccessor ra = getRawAccessor(context, wrapperBean.getClass(), nsURI,
localName);
+ try {
+ ra.set(wrapperBean, value);
+ } catch (AccessorException e) {
+ throw new SerializationException(e);
+ }
+ }
+
+ private RawAccessor getRawAccessor(RuntimeContext context, Class wrapperBean, String
nsURI, String localName){
+ RuntimeModel model = context.getModel();
+ Map<Integer, RawAccessor> map = model.getRawAccessorMap();
+ int id = getHashCode(wrapperBean, nsURI, localName);
+ RawAccessor ra = map.get(id);
+ if(ra == null){
+ JAXBRIContext jaxbContext = model.getJAXBContext();
+ try {
+ ra = jaxbContext.getElementPropertyAccessor(wrapperBean, nsURI,
+ localName);
+ map.put(id, ra);
+ } catch (JAXBException e) {
+ throw new SerializationException(e);
+ }
+ }
+ return ra;
+ }
+
+ private int getHashCode(Class bean, String uri, String pfix){
+ return bean.hashCode()+uri.hashCode()+pfix.hashCode();
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/EncoderDecoderBase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/JAXWSAttachmentMarshaller.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/JAXWSAttachmentMarshaller.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/JAXWSAttachmentMarshaller.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,226 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.encoding;
+
+
+import javax.activation.DataHandler;
+import javax.xml.bind.attachment.AttachmentMarshaller;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.MessageContext;
+
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.AttachmentBlock;
+import org.jboss.com.sun.xml.ws.handler.HandlerContext;
+import org.jboss.com.sun.xml.ws.handler.MessageContextUtil;
+import org.jboss.com.sun.xml.ws.spi.runtime.MtomCallback;
+import org.jboss.com.sun.xml.ws.util.ByteArrayDataSource;
+
+import java.io.ByteArrayInputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URLEncoder;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+/**
+ * @author WS Development Team
+ *
+ *
+ */
+public class JAXWSAttachmentMarshaller extends AttachmentMarshaller {
+
+ public JAXWSAttachmentMarshaller(boolean isXOP){
+ this.isXOP = isXOP;
+ }
+
+ public boolean isXOPPackage() {
+ return isXOP;
+ }
+
+ /**
+ * set the XOP package if the incoming SOAP envelope is a XOP package
+ * @param isXOP
+ */
+ public void setXOPPackage(boolean isXOP){
+ this.isXOP = isXOP;
+ }
+
+ /*
+ * @see AttachmentMarshaller#addMtomAttachment(DataHandler, String, String)
+ */
+ public String addMtomAttachment(DataHandler data, String elementNamespace, String
elementName) {
+ if(!isXOP)
+ return null;
+ String cid = encodeCid(elementNamespace);
+ if(cid != null){
+ String cidBracket = '<' + cid + '>';
+ attachments.put(cidBracket,
AttachmentBlock.fromDataHandler(cidBracket,data));
+ addToMessageContext(cidBracket, data);
+ if(mtomCallback != null)
+ mtomCallback.addedMtomAttachment(cidBracket, data, elementNamespace,
elementName);
+ isXopped = true;
+ cid = "cid:"+cid;
+ }
+ return cid;
+ }
+
+ /**
+ * <p>Consider binary <code>data</code> for optimized binary
storage as an attachment.
+ * <p/>
+ * <p>Since content type is not known, the attachment's MIME content type
must be set to "application/octet-stream".</p>
+ * <p/>
+ * <p/>
+ * The <code>elementNamespace</code> and
<code>elementLocalName</code>
+ * parameters provide the
+ * context that contains the binary data. This information could
+ * be used by the MIME-based package processor to determine if the
+ * binary data should be inlined or optimized as an attachment.
+ *
+ * @param data represents the data to be attached. Must be non-null. The
actual data region is
+ * specified by <tt>(data,offset,len)</tt>
tuple.
+ * @param mimeType If the data has an associated MIME type known to JAXB,
that is passed
+ * as this parameter. If none is known,
"application/octet-stream".
+ * This parameter may never be null.
+ * @param elementNamespace the namespace URI of the element that encloses the
base64Binary data.
+ * Can be empty but never null.
+ * @param elementLocalName The local name of the element. Always a non-null valid
string.
+ * @return content-id URI, cid, to the attachment containing
+ * <code>data</code> or null if data should be inlined.
+ * @see #addMtomAttachment(javax.activation.DataHandler, String, String)
+ */
+ public String addMtomAttachment(byte[] data, int offset, int len, String mimeType,
String elementNamespace, String elementLocalName) {
+ if(!isXOP)
+ return null;
+
+ //TODO: With performance results we need to find out what length would need
optimization
+ if(len < mtomThresholdValue)
+ return null;
+
+ //this will not be needed if saaj exposes api that takes
+ //byte[] actualData = getActualData(data, offset, len);
+
+ String cid = encodeCid(elementNamespace);
+ if(cid != null){
+ String cidBracket = '<' + cid + '>';
+ DataHandler dh = new DataHandler(new ByteArrayDataSource(data, offset, len,
"application/octet-stream"));
+ attachments.put(cidBracket, AttachmentBlock.fromDataHandler(cidBracket,dh));
+ addToMessageContext(cidBracket, dh);
+ if(mtomCallback != null)
+ mtomCallback.addedMtomAttachment(cidBracket, dh, elementNamespace,
elementLocalName);
+ isXopped = true;
+ cid = "cid:"+cid;
+ }
+ return cid;
+
+ }
+
+ /*
+ * @see AttachmentMarshaller#addSwaRefAttachment(DataHandler)
+ */
+ public String addSwaRefAttachment(DataHandler data) {
+ String cid = encodeCid(null);
+ if(cid != null){
+ String cidBracket = '<' + cid + '>';
+ attachments.put(cidBracket,
AttachmentBlock.fromDataHandler("<"+cid+">", data));
+ addToMessageContext(cidBracket, data);
+ isXopped = false;
+ cid = "cid:"+cid;
+ }
+ return cid;
+ }
+
+ private void addToMessageContext(String cid, DataHandler dh){
+ if(hc == null)
+ return;
+ MessageContext ctxt = hc.getMessageContext();
+ if(ctxt == null)
+ return;
+ MessageContextUtil.addMessageAttachment(ctxt, cid, dh);
+ }
+
+ /**
+ *
+ * @param ns
+ * @return
+ */
+ private String encodeCid(String ns){
+ String cid="example.jaxws.sun.com";
+ String name = UUID.randomUUID()+"@";
+ if(ns != null && (ns.length() > 0)){
+ try {
+ URI uri = new URI(ns);
+ String host = uri.toURL().getHost();
+ cid = host;
+ } catch (URISyntaxException e) {
+ e.printStackTrace();
+ return null;
+ } catch (MalformedURLException e) {
+ try {
+ cid = URLEncoder.encode(ns, "UTF-8");
+ } catch (UnsupportedEncodingException e1) {
+ throw new WebServiceException(e);
+ }
+ }
+ }
+ return name + cid;
+ }
+
+ /**
+ * Must be called before marshalling any data.
+ * @param attachments Reference to Map from InternalMessage
+ */
+ public void setAttachments(Map<String, AttachmentBlock> attachments){
+ this.attachments = attachments;
+ isXopped = false;
+ }
+
+ public void setHandlerContaxt(HandlerContext hc){
+ this.hc = hc;
+ }
+
+ /**
+ *
+ * @return true if Xopped, false otherwise
+ */
+ public boolean isXopped() {
+ return isXopped;
+ }
+
+ public void setMtomThresholdValue(Integer mtomThresholdValue) {
+ if((mtomThresholdValue != null) && (mtomThresholdValue >=0))
+ this.mtomThresholdValue = mtomThresholdValue;
+ }
+
+ public void setMtomCallback(MtomCallback mtomCallback){
+ this.mtomCallback = mtomCallback;
+ }
+
+ private MtomCallback mtomCallback;
+ private boolean isXOP;
+ private boolean isXopped;
+ private Map<String, AttachmentBlock> attachments;
+ private HandlerContext hc;
+ private int mtomThresholdValue = 1000;
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/JAXWSAttachmentMarshaller.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/JAXWSAttachmentUnmarshaller.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/JAXWSAttachmentUnmarshaller.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/JAXWSAttachmentUnmarshaller.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,120 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.encoding;
+
+
+import javax.activation.DataHandler;
+import javax.xml.bind.attachment.AttachmentUnmarshaller;
+import javax.xml.soap.AttachmentPart;
+import javax.xml.soap.SOAPException;
+import javax.xml.ws.WebServiceException;
+
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.AttachmentBlock;
+import org.jboss.com.sun.xml.ws.util.ASCIIUtility;
+
+import java.util.Map;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.net.URLDecoder;
+
+/**
+ * @author Vivek Pandey
+ *
+ * AttachmentUnmarshaller, will be called by jaxb unmarshaller to process xop package.
+ */
+public class JAXWSAttachmentUnmarshaller extends AttachmentUnmarshaller {
+
+ /**
+ *
+ */
+ public JAXWSAttachmentUnmarshaller(){
+ }
+
+ /**
+ *
+ * @param cid
+ * @return a <code>DataHandler</code> for the attachment
+ */
+ public DataHandler getAttachmentAsDataHandler(String cid) {
+ AttachmentBlock ab = attachments.get(decodeCid(cid));
+ if(ab == null)
+ //TODO localize exception message
+ throw new IllegalArgumentException("Attachment corresponding to
"+cid+ " not found!");
+ return ab.asDataHandler();
+ }
+
+ /**
+ *
+ * @param cid
+ * @return the attachment as a <code>byte[]</code>
+ */
+ public byte[] getAttachmentAsByteArray(String cid) {
+ AttachmentBlock ab = attachments.get(decodeCid(cid));
+ if(ab == null)
+ throw new IllegalArgumentException("Attachment corresponding to
"+cid+ " not found!");
+ return ab.asByteArray();
+ }
+
+ /**
+ *
+ * @return true if XOPPackage
+ */
+ public boolean isXOPPackage() {
+ return isXOP;
+ }
+
+ /**
+ * set the XOP package if the incoming SOAP envelope is a XOP package
+ * @param isXOP
+ */
+ public void setXOPPackage(boolean isXOP){
+ this.isXOP = isXOP;
+ }
+
+ /**
+ * Must be called before marshalling any data.
+ * @param attachments Reference to Map from InternalMessage
+ */
+ public void setAttachments(Map<String, AttachmentBlock> attachments){
+ this.attachments = attachments;
+ }
+
+ /**
+ *
+ * @param cid
+ * @return
+ */
+ private String decodeCid(String cid){
+ if(cid.startsWith("cid:"))
+ cid = cid.substring(4, cid.length());
+// try { // Added fix for CR 6456442
+ //return "<"+URLDecoder.decode(cid,
"UTF-8")+">";
+ return "<"+cid+">";
+// } catch (UnsupportedEncodingException e) {
+// throw new WebServiceException(e);
+// }
+ }
+
+ private Map<String, AttachmentBlock> attachments;
+ private boolean isXOP;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/JAXWSAttachmentUnmarshaller.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/internal/InternalEncoder.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/internal/InternalEncoder.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/internal/InternalEncoder.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,31 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.encoding.internal;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+
+/**
+ * Payload is converted from one form to the other
+ */
+public interface InternalEncoder {
+ public void toMessageInfo(Object intMessage, MessageInfo mi);
+ public Object toInternalMessage(MessageInfo mi);
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/internal/InternalEncoder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/jaxb/JAXBBeanInfo.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/jaxb/JAXBBeanInfo.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/jaxb/JAXBBeanInfo.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,110 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.encoding.jaxb;
+
+import com.sun.xml.bind.api.BridgeContext;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.Source;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.stream.XMLStreamReader;
+
+import org.jboss.com.sun.xml.ws.encoding.soap.SerializationException;
+
+import java.io.OutputStream;
+
+/**
+ * XML infoset represented as a JAXB object.
+ *
+ * @author WS Development Team
+ */
+public final class JAXBBeanInfo {
+ private final Object jaxbBean;
+ private JAXBContext jaxbContext;
+ private BridgeContext bc;
+ private Marshaller marshaller;
+ private Unmarshaller unmarshaller;
+
+ public JAXBBeanInfo(Object payload, JAXBContext jaxbContext) {
+ this.jaxbBean = payload;
+ this.jaxbContext = jaxbContext;
+ }
+
+ public static JAXBBeanInfo fromSource(Source source, JAXBContext context) {
+ Object obj = JAXBTypeSerializer.deserialize(source, context);
+ return new JAXBBeanInfo(obj, context);
+ }
+
+ public static JAXBBeanInfo fromStAX(XMLStreamReader reader, JAXBContext context) {
+
+ Object obj = JAXBTypeSerializer.deserialize(reader, context);
+ return new JAXBBeanInfo(obj, context);
+ }
+
+ public static JAXBBeanInfo fromStAX(XMLStreamReader reader, JAXBContext context,
Unmarshaller um) {
+
+ Object obj = JAXBTypeSerializer.deserialize(reader, context, um);
+ return new JAXBBeanInfo(obj, context);
+ }
+
+
+
+ public Object getBean() {
+ return jaxbBean;
+ }
+
+ public JAXBContext getJAXBContext() {
+ return jaxbContext;
+ }
+
+ /**
+ * Creates a {@link DOMSource} from this JAXB bean.
+ */
+ public DOMSource toDOMSource() {
+ return JAXBTypeSerializer.serialize(jaxbBean,jaxbContext);
+ }
+
+ /**
+ * Writes this bean to StAX.
+ */
+ public void writeTo(XMLStreamWriter w) {
+ if (marshaller != null)
+ JAXBTypeSerializer.serialize(jaxbBean, w, jaxbContext, marshaller);
+ else
+ JAXBTypeSerializer.serialize(jaxbBean, w, jaxbContext);
+ }
+
+ public void writeTo(OutputStream os) {
+ if (marshaller != null)
+ JAXBTypeSerializer.serialize(jaxbBean, os, jaxbContext, marshaller);
+ else
+ JAXBTypeSerializer.serialize(jaxbBean,os,jaxbContext);
+ }
+
+ public void setMarshallers(Marshaller m, Unmarshaller u) {
+ this.marshaller = m;
+ this.unmarshaller = u;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/jaxb/JAXBBeanInfo.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/jaxb/JAXBBridgeInfo.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/jaxb/JAXBBridgeInfo.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/jaxb/JAXBBridgeInfo.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,150 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.encoding.jaxb;
+
+import com.sun.xml.bind.api.Bridge;
+import com.sun.xml.bind.api.TypeReference;
+import com.sun.xml.bind.api.BridgeContext;
+
+import javax.xml.namespace.QName;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.transform.Source;
+import java.io.OutputStream;
+import java.io.InputStream;
+
+import org.jboss.com.sun.xml.ws.encoding.soap.DeserializationException;
+import org.jboss.com.sun.xml.ws.encoding.soap.SerializationException;
+import org.jboss.com.sun.xml.ws.streaming.XMLStreamReaderUtil;
+import org.w3c.dom.Node;
+
+/**
+ * XML infoset represented as a JAXB object and {@link Bridge}.
+ *
+ * @author WS Development Team
+ */
+public final class JAXBBridgeInfo {
+ private final Bridge bridge;
+ private Object value;
+
+ public JAXBBridgeInfo(Bridge bridge) {
+ this.bridge = bridge;
+ }
+
+ public JAXBBridgeInfo(Bridge bridge, Object value) {
+ this(bridge);
+ this.value = value;
+ }
+
+ public QName getName() {
+ return bridge.getTypeReference().tagName;
+ }
+
+ public TypeReference getType(){
+ return bridge.getTypeReference();
+ }
+
+ public Bridge getBridge() {
+ return bridge;
+ }
+
+ public Object getValue() {
+ return value;
+ }
+
+ public static JAXBBridgeInfo copy(JAXBBridgeInfo payload) {
+ return new JAXBBridgeInfo(payload.getBridge(), payload.getValue());
+ }
+
+ /**
+ * JAXB object is serialized. Note that the BridgeContext is cached per
+ * thread, and JAXBBridgeInfo should contain correct BridgeContext for the
+ * current thread.
+ */
+ public void serialize(BridgeContext bridgeContext, OutputStream os, NamespaceContext
nsContext) {
+ try {
+ bridge.marshal(bridgeContext, value, os, nsContext);
+ } catch (JAXBException e) {
+ throw new SerializationException(e);
+ }
+ }
+
+ /**
+ * Serialize to StAX.
+ */
+ public void serialize(BridgeContext bridgeContext, XMLStreamWriter writer) {
+ try {
+ bridge.marshal(bridgeContext, value, writer);
+ } catch (JAXBException e) {
+ throw new SerializationException(e);
+ }
+ }
+
+ /**
+ * Serialize to DOM.
+ */
+ public void serialize(BridgeContext bridgeContext, Node node) {
+ try {
+ bridge.marshal(bridgeContext, value, node);
+ } catch (JAXBException e) {
+ throw new SerializationException(e);
+ }
+ }
+
+ public void deserialize(Source source, BridgeContext bridgeContext) {
+ try {
+ value = bridge.unmarshal(bridgeContext, source);
+ } catch (JAXBException e) {
+ throw new DeserializationException(e);
+ }
+ }
+
+ public void deserialize(InputStream stream, BridgeContext bridgeContext) {
+ try {
+ value = bridge.unmarshal(bridgeContext, stream);
+ } catch (JAXBException e) {
+ throw new DeserializationException(e);
+ }
+ }
+
+ /*
+ * JAXB object is deserialized and is set in JAXBBridgeInfo. Note that
+ * the BridgeContext is cached per thread, and JAXBBridgeInfo should contain
+ * correct BridgeContext for the current thread.
+ */
+ public void deserialize(XMLStreamReader reader, BridgeContext bridgeContext) {
+ try {
+ value = bridge.unmarshal(bridgeContext, reader);
+
+ // reader could be left on CHARS token rather than </body>
+ if (reader.getEventType() == XMLStreamConstants.CHARACTERS &&
+ reader.isWhiteSpace()) {
+ XMLStreamReaderUtil.nextContent(reader);
+ }
+ } catch (JAXBException e) {
+ throw new DeserializationException(e);
+ }
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/jaxb/JAXBBridgeInfo.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/jaxb/JAXBTypeSerializer.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/jaxb/JAXBTypeSerializer.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/jaxb/JAXBTypeSerializer.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,218 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.encoding.jaxb;
+
+import com.sun.xml.bind.api.BridgeContext;
+import com.sun.xml.bind.v2.runtime.MarshallerImpl;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.dom.DOMSource;
+
+import org.jboss.com.sun.xml.ws.encoding.soap.DeserializationException;
+import org.jboss.com.sun.xml.ws.encoding.soap.SerializationException;
+import org.jboss.com.sun.xml.ws.streaming.XMLStreamReaderUtil;
+
+import java.io.OutputStream;
+
+/**
+ * @author Vivek Pandey
+ */
+public final class JAXBTypeSerializer {
+ private JAXBTypeSerializer() {
+ } // no instanciation please
+
+ public static void serialize(Object obj, XMLStreamWriter writer, JAXBContext context)
{
+
+ try {
+ Marshaller marshaller = context.createMarshaller();
+ marshaller.setProperty("jaxb.fragment", Boolean.TRUE);
+ marshaller.marshal(obj, writer);
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new SerializationException(e);
+ }
+ }
+
+ public static void serialize(Object obj, XMLStreamWriter writer,
+ JAXBContext context, Marshaller marshaller) {
+
+ try {
+ if (marshaller == null)
+ marshaller = context.createMarshaller();
+ marshaller.setProperty("jaxb.fragment", Boolean.TRUE);
+ marshaller.marshal(obj, writer);
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new SerializationException(e);
+ }
+ }
+
+
+ /* for FI, it will be a whole document, not fragment
+ * called by setPayload and writeTo methods in XMLMessage class
+ */
+ public static void serializeDocument(Object obj, XMLStreamWriter writer, JAXBContext
context) {
+ try {
+ Marshaller marshaller = context.createMarshaller();
+ marshaller.marshal(obj, writer);
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new SerializationException(e);
+ }
+ }
+
+ public static void serialize(Object obj, OutputStream os,
+ JAXBContext context, Marshaller marshaller) {
+
+ try {
+ if (marshaller == null)
+ marshaller = context.createMarshaller();
+ marshaller.setProperty("jaxb.fragment", Boolean.TRUE);
+ marshaller.marshal(obj, os);
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new SerializationException(e);
+ }
+ }
+
+ public static void serialize(Object obj, OutputStream os, JAXBContext context) {
+
+ try {
+ Marshaller marshaller = context.createMarshaller();
+ marshaller.setProperty("jaxb.fragment", Boolean.TRUE);
+ marshaller.marshal(obj, os);
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new SerializationException(e);
+ }
+ }
+
+ /*
+ * Marshalls arbitrary type object with the given tag name
+ */
+ public static DOMSource serialize(Object bean, JAXBContext context) {
+ try {
+ Marshaller marshaller = context.createMarshaller();
+ marshaller.setProperty("jaxb.fragment", Boolean.TRUE);
+ DOMResult domResult = new DOMResult();
+ marshaller.marshal(bean, domResult);
+ return new DOMSource(domResult.getNode());
+ } catch (JAXBException e) {
+ throw new SerializationException(e);
+ }
+ }
+
+ /*
+ * @see JAXBTypeSerializerIf#deserialize(XMLStreamReader,JAXBContext)
+ */
+ public static Object deserialize(XMLStreamReader reader, JAXBContext context) {
+ Object obj = null;
+ try {
+ Unmarshaller unmarshaller = context.createUnmarshaller();
+ if (reader.getEventType() == XMLStreamConstants.START_ELEMENT)
+ obj = unmarshaller.unmarshal(reader);
+
+ // reader could be left on CHARS token rather than </body>
+ if (reader.getEventType() == XMLStreamConstants.CHARACTERS
+ && reader.isWhiteSpace()) {
+ XMLStreamReaderUtil.nextContent(reader);
+ }
+ return obj;
+
+ } catch (DeserializationException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new DeserializationException(e);
+ }
+ }
+
+ public static Object deserialize(XMLStreamReader reader, JAXBContext context,
Unmarshaller bc) {
+ Object obj = null;
+ try {
+ Unmarshaller unmarshaller = context.createUnmarshaller();
+ if (bc != null)
+ unmarshaller.setAttachmentUnmarshaller(bc.getAttachmentUnmarshaller());
+
+ if (reader.getEventType() == XMLStreamConstants.START_ELEMENT)
+ obj = unmarshaller.unmarshal(reader);
+
+ // reader could be left on CHARS token rather than </body>
+ if (reader.getEventType() == XMLStreamConstants.CHARACTERS
+ && reader.isWhiteSpace()) {
+ XMLStreamReaderUtil.nextContent(reader);
+ }
+ return obj;
+
+ } catch (DeserializationException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new DeserializationException(e);
+ }
+ }
+
+ /*
+ * convert JAXB bean as a Source
+ *
+ public static Object toSource(Object obj, JAXBContext context) {
+ try {
+ // Use ctxt to marshall the object
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ Marshaller marshaller = context.createMarshaller();
+ marshaller.setProperty("jaxb.fragment", Boolean.TRUE);
+ marshaller.marshal(obj, bos);
+ ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
+ return new StreamSource(bis);
+ } catch (JAXBException e) {
+ throw new DeserializationException(new LocalizableExceptionAdapter(
+ e));
+ }
+ }
+ */
+
+ /*
+ * Convert Source object as a JAXB bean
+ */
+ public static Object deserialize(Source source, JAXBContext context) {
+ try {
+ Unmarshaller unmarshaller = context.createUnmarshaller();
+ return unmarshaller.unmarshal(source);
+ } catch (JAXBException e) {
+ throw new DeserializationException(e);
+ }
+ }
+
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/jaxb/JAXBTypeSerializer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/jaxb/RpcLitPayload.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/jaxb/RpcLitPayload.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/jaxb/RpcLitPayload.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,75 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.encoding.jaxb;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+public class RpcLitPayload {
+ private QName operation;
+ private List<JAXBBridgeInfo> bridgeParameters;
+
+ public RpcLitPayload(QName operation) {
+ this.operation = operation;
+ this.bridgeParameters = new ArrayList<JAXBBridgeInfo>();
+ }
+
+ /* Same as the above one. Need to remove the above constructor.
+ public RpcLitPayload(QName operation, List<JAXBBridgeInfo> parameters) {
+ this.operation = operation;
+ this.bridgeParameters = parameters;
+ }
+ */
+
+ public QName getOperation() {
+ return operation;
+ }
+
+ public List<JAXBBridgeInfo> getBridgeParameters() {
+ return bridgeParameters;
+ }
+
+ public static RpcLitPayload copy(RpcLitPayload payload) {
+ RpcLitPayload newPayload = new RpcLitPayload(payload.getOperation());
+ for(JAXBBridgeInfo param: payload.getBridgeParameters()) {
+ JAXBBridgeInfo newParam = JAXBBridgeInfo.copy(param);
+ newPayload.addParameter(newParam);
+ }
+ return newPayload;
+ }
+
+ public JAXBBridgeInfo getBridgeParameterByName(String name){
+ for(JAXBBridgeInfo param : bridgeParameters) {
+ if (param.getName().getLocalPart().equals(name)) {
+ return param;
+ }
+ }
+ return null;
+ }
+
+ public void addParameter(JAXBBridgeInfo parameter) {
+ bridgeParameters.add(parameter);
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/jaxb/RpcLitPayload.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/jaxb/RpcLitPayloadSerializer.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/jaxb/RpcLitPayloadSerializer.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/jaxb/RpcLitPayloadSerializer.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,138 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.encoding.jaxb;
+
+import com.sun.xml.bind.api.BridgeContext;
+
+import static
org.jboss.com.sun.xml.ws.client.BindingProviderProperties.JAXB_OUTPUTSTREAM;
+
+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 org.jboss.com.sun.xml.ws.encoding.soap.DeserializationException;
+import org.jboss.com.sun.xml.ws.encoding.soap.SerializationException;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.streaming.XMLStreamReaderUtil;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+public class RpcLitPayloadSerializer {
+
+ /*
+ * Uses BridgeContext to serialize the rpc/lit payload. First it writes
+ * the operation, and then it serializes each parameter
+ */
+ public static void serialize(RpcLitPayload obj, BridgeContext bridgeContext,
+ MessageInfo messageInfo, XMLStreamWriter writer)
+ {
+ try {
+ QName op = obj.getOperation();
+ String opURI = op.getNamespaceURI();
+
+ writer.writeStartElement("ans", op.getLocalPart(), opURI);
+ writer.setPrefix("ans", opURI);
+ writer.writeNamespace("ans", opURI);
+
+
+ // Pass output stream directly to JAXB when available
+ OutputStream os = (OutputStream) messageInfo.getMetaData(JAXB_OUTPUTSTREAM);
+ if (os != null) {
+ /*
+ * Make sure that current element is closed before passing the
+ * output stream to JAXB. Using Zephyr, it suffices to write
+ * an empty string (TODO: other StAX impls?).
+ */
+ writer.writeCharacters("");
+
+ // Flush output of StAX serializer
+ writer.flush();
+
+ NamespaceContext nsc = writer.getNamespaceContext();
+
+ // Let JAXB serialize each param to the output stream
+ for (JAXBBridgeInfo param : obj.getBridgeParameters()) {
+ param.serialize(bridgeContext, os, nsc);
+ }
+ }
+ else {
+ // Otherwise, use a StAX writer
+ for (JAXBBridgeInfo param : obj.getBridgeParameters()) {
+ param.serialize(bridgeContext, writer);
+ }
+ }
+
+ writer.writeEndElement(); // </ans:operation>
+ }
+ catch (XMLStreamException e) {
+ throw new SerializationException(e);
+ }
+ }
+
+ public static void serialize(RpcLitPayload obj, BridgeContext bridgeContext,
OutputStream writer) {
+ QName op = obj.getOperation();
+ String opURI = op.getNamespaceURI();
+ String startElm = "<ans:"+op.getLocalPart()+"
xmlns:ans=\""+opURI+"\">";
+ String endElm="</ans:"+op.getLocalPart()+">";
+ try {
+ writer.write(startElm.getBytes());
+ for (JAXBBridgeInfo param : obj.getBridgeParameters()) {
+ param.serialize(bridgeContext,writer,null);
+ }
+ writer.write(endElm.getBytes());
+ } catch (IOException e) {
+ throw new SerializationException(e);
+ }
+ }
+
+ /*
+ * Uses BridgeContext to deserialize the rpc/lit payload. First it reads
+ * the operation element, and then it deserializes each parameter. If the
+ * expected parameter is not found, it throws an exception
+ */
+ public static void deserialize(XMLStreamReader reader, RpcLitPayload payload,
+ BridgeContext bridgeContext)
+ {
+ XMLStreamReaderUtil.nextElementContent(reader); // </operation> or
<partName>
+ for (JAXBBridgeInfo param: payload.getBridgeParameters()) {
+ // throw exception if the part accessor name is not what we expect
+ QName partName = reader.getName();
+ if (!partName.equals(param.getName())) {
+ throw new
DeserializationException("xsd.unexpectedElementName",
+ new Object[]{param.getName(), partName});
+ }
+ param.deserialize(reader, bridgeContext);
+
+ // reader could be left on CHARS token rather than <partName>
+ if (reader.getEventType() == XMLStreamConstants.CHARACTERS &&
+ reader.isWhiteSpace()) {
+ XMLStreamReaderUtil.nextContent(reader);
+ }
+ }
+ XMLStreamReaderUtil.nextElementContent(reader); // </env:body>
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/jaxb/RpcLitPayloadSerializer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/simpletype/EncoderUtils.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/simpletype/EncoderUtils.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/simpletype/EncoderUtils.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,139 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.encoding.simpletype;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class EncoderUtils {
+ public static boolean needsCollapsing(String str) {
+ int len = str.length();
+ int spanLen = 0;
+
+ for (int idx = 0; idx < len; ++idx) {
+ if (Character.isWhitespace(str.charAt(idx))) {
+ ++spanLen;
+ } else if (spanLen > 0) {
+ if (spanLen == idx) {
+ // leading whitespace
+ return true;
+ } else {
+ // non-leading, non-trailing whitespace
+ if (str.charAt(idx - spanLen) != ' ') {
+ // first whitespace character is not a space
+ return true;
+ }
+ if (spanLen > 1) {
+ // there is a span of multiple whitespace characters
+ return true;
+ }
+ }
+
+ spanLen = 0;
+ }
+ }
+
+ if (spanLen > 0) {
+ // trailing whitespace
+ return true;
+ }
+
+ return false;
+ }
+
+ public static String collapseWhitespace(String str) {
+ if (!needsCollapsing(str)) {
+ return str;
+ }
+
+ // the assumption is that most strings will not need to be collapsed,
+ // so the code below will usually not be reached
+
+ int len = str.length();
+ char[] buf = new char[len];
+ str.getChars(0, len, buf, 0);
+
+ int leadingWSLen = 0;
+ int trailingWSLen = 0;
+ int spanLen = 0;
+
+ for (int idx = 0; idx < len; ++idx) {
+ if (Character.isWhitespace(buf[idx])) {
+ ++spanLen;
+ } else if (spanLen > 0) {
+ if (spanLen == idx) {
+ // leading whitespace
+ leadingWSLen = spanLen;
+ } else {
+ // non-leading, non-trailing whitespace
+
+ // ensure that the first whitespace character is a space
+ int firstWSIdx = idx - spanLen;
+ buf[firstWSIdx] = ' ';
+
+ if (spanLen > 1) {
+ // remove all but the first whitespace character
+ System.arraycopy(
+ buf,
+ idx,
+ buf,
+ firstWSIdx + 1,
+ len - idx);
+ len -= (spanLen - 1);
+ idx = firstWSIdx + 1;
+ }
+ }
+
+ spanLen = 0;
+ }
+ }
+
+ if (spanLen > 0) {
+ // trailing whitespace
+ trailingWSLen = spanLen;
+ }
+
+ return new String(
+ buf,
+ leadingWSLen,
+ len - leadingWSLen - trailingWSLen);
+ }
+
+ public static String removeWhitespace(String str) {
+ int len = str.length();
+ StringBuffer buf = new StringBuffer();
+ int firstNonWS = 0;
+ int idx = 0;
+ for (; idx < len; ++idx) {
+ if (Character.isWhitespace(str.charAt(idx))) {
+ if (firstNonWS < idx)
+ buf.append(str.substring(firstNonWS, idx));
+ firstNonWS = idx + 1;
+ }
+ }
+ if (firstNonWS < idx)
+ buf.append(str.substring(firstNonWS, idx));
+ return buf.toString();
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/simpletype/EncoderUtils.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/simpletype/SimpleTypeConstants.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/simpletype/SimpleTypeConstants.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/simpletype/SimpleTypeConstants.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,44 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+
+package org.jboss.com.sun.xml.ws.encoding.simpletype;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.xml.ws.encoding.soap.SerializerConstants;
+import org.jboss.com.sun.xml.ws.encoding.soap.streaming.SOAPNamespaceConstants;
+
+
+/**
+ *
+ * @author WS Development Team
+ */
+public interface SimpleTypeConstants extends SerializerConstants {
+
+ public static final String URI_XSI = SOAPNamespaceConstants.XSI;
+ public static final String URI_XSD = SOAPNamespaceConstants.XSD;
+
+ public static final QName QNAME_XSI_TYPE = new QName(URI_XSI, "type");
+ public static final QName QNAME_XSI_NIL = new QName(URI_XSI, "nil");
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/simpletype/SimpleTypeConstants.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/ClientEncoderDecoder.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/ClientEncoderDecoder.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/ClientEncoderDecoder.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,342 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.encoding.soap;
+
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.soap.SOAPFaultException;
+import javax.xml.ws.handler.MessageContext;
+import javax.activation.DataHandler;
+
+import org.jboss.com.sun.xml.ws.client.BindingProviderProperties;
+import org.jboss.com.sun.xml.ws.client.RequestContext;
+import org.jboss.com.sun.xml.ws.encoding.internal.InternalEncoder;
+import org.jboss.com.sun.xml.ws.encoding.jaxb.JAXBBridgeInfo;
+import org.jboss.com.sun.xml.ws.encoding.jaxb.RpcLitPayload;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.AttachmentBlock;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.BodyBlock;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.HeaderBlock;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.InternalMessage;
+import org.jboss.com.sun.xml.ws.encoding.soap.message.FaultReasonText;
+import org.jboss.com.sun.xml.ws.encoding.soap.message.SOAP12FaultInfo;
+import org.jboss.com.sun.xml.ws.encoding.soap.message.SOAPFaultInfo;
+import org.jboss.com.sun.xml.ws.handler.HandlerContext;
+import org.jboss.com.sun.xml.ws.model.CheckedException;
+import org.jboss.com.sun.xml.ws.model.ExceptionType;
+import org.jboss.com.sun.xml.ws.model.JavaMethod;
+import org.jboss.com.sun.xml.ws.model.Parameter;
+import org.jboss.com.sun.xml.ws.model.ParameterBinding;
+import org.jboss.com.sun.xml.ws.model.RuntimeModel;
+import org.jboss.com.sun.xml.ws.model.WrapperParameter;
+import org.jboss.com.sun.xml.ws.model.soap.SOAPBinding;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.pept.presentation.MessageStruct;
+import org.jboss.com.sun.xml.ws.server.RuntimeContext;
+import org.jboss.com.sun.xml.ws.util.StringUtils;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Vivek Pandey
+ *
+ * SOAP Client side encoder/decoder.
+ */
+public class ClientEncoderDecoder extends EncoderDecoder implements InternalEncoder {
+ public ClientEncoderDecoder() {
+ }
+
+ /* (non-Javadoc)
+ * @see
org.jboss.com.sun.xml.ws.rt.encoding.EncoderDecoderBase#toMessageInfo(java.lang.Object,
com.sun.pept.ept.MessageInfo)
+ */
+ public void toMessageInfo(Object intMessage, MessageInfo mi) {
+ InternalMessage im = (InternalMessage) intMessage;
+ BodyBlock bodyBlock = im.getBody();
+ RuntimeContext rtContext = (RuntimeContext)
mi.getMetaData(BindingProviderProperties.JAXWS_RUNTIME_CONTEXT);
+ JavaMethod jm = rtContext.getModel().getJavaMethod(mi.getMethod());
+ mi.setMEP(jm.getMEP());
+
+ Object bodyValue = (bodyBlock == null) ? null : bodyBlock.getValue();
+
+ if(bodyValue instanceof SOAPFaultInfo){
+ SOAPFaultInfo sfi = (SOAPFaultInfo)bodyValue;
+ Object detail = sfi.getDetail();
+ if(detail == null || detail instanceof javax.xml.soap.Detail) {
+ SOAPFaultException sfe = new SOAPFaultException(sfi.getSOAPFault());
+ mi.setResponseType(MessageStruct.CHECKED_EXCEPTION_RESPONSE);
+ mi.setResponse(sfe);
+ return;
+ }
+ JAXBBridgeInfo bi = (JAXBBridgeInfo)detail;
+ CheckedException ce = jm.getCheckedException(bi.getType());
+ Exception ex = createCheckedException(sfi.getString(), ce, bi.getValue());
+ mi.setResponseType(MessageStruct.CHECKED_EXCEPTION_RESPONSE);
+ mi.setResponse(ex);
+ return;
+ }
+
+ if(bodyValue instanceof SOAP12FaultInfo){
+ SOAP12FaultInfo sfi = (SOAP12FaultInfo)bodyValue;
+ Object detail = sfi.getDetail();
+ if(detail == null || detail instanceof javax.xml.soap.Detail) {
+// javax.xml.soap.Detail sfeDetail = null;
+// if(detail != null)
+// sfeDetail = (javax.xml.soap.Detail)detail;
+// String reason = null;
+// List<FaultReasonText> frt =
sfi.getReasons().getFaultReasonTexts();
+//
+// //for now we pickup onkly the first Reason Text
+// if(frt != null && !frt.isEmpty())
+// reason = frt.get(0).getValue();
+
+ SOAPFaultException sfe = new SOAPFaultException(sfi.getSOAPFault());
+ mi.setResponseType(MessageStruct.CHECKED_EXCEPTION_RESPONSE);
+ mi.setResponse(sfe);
+ return;
+ }
+ JAXBBridgeInfo bi = (JAXBBridgeInfo)detail;
+ CheckedException ce = jm.getCheckedException(bi.getType());
+ String reason = null;
+ List<FaultReasonText> frt = sfi.getReasons().getFaultReasonTexts();
+ //for now we pickup onkly the first Reason Text
+ if(frt != null && !frt.isEmpty())
+ reason = frt.get(0).getValue();
+ Exception ex = createCheckedException(reason, ce, bi.getValue());
+ mi.setResponseType(MessageStruct.CHECKED_EXCEPTION_RESPONSE);
+ mi.setResponse(ex);
+ return;
+ }
+
+ // process body/headers/attachments
+ List<HeaderBlock> headers = im.getHeaders();
+ Map<String, AttachmentBlock> attachments = im.getAttachments();
+ Object[] data = mi.getData();
+ SOAPBinding soapBinding = (SOAPBinding)jm.getBinding();
+
+ // TODO: why is the binding determined by the instance?
+ //what happens when client receives unsolicited headers?
+ int bBlocks = (bodyValue != null)?1:0;
+ int hBlocks = (im.getHeaders() != null)?im.getHeaders().size():0;
+ int mBlocks = (im.getAttachments() != null)?im.getAttachments().size():0;
+
+ boolean isResponseAsynWrapper = (bBlocks + hBlocks + mBlocks) > 1;
+
+ //for rpclit there could be more than one parts but only one bodyblock
+ // so we use different rule for rpclit
+ if((bodyValue instanceof RpcLitPayload) && !isResponseAsynWrapper){
+ isResponseAsynWrapper =
(((RpcLitPayload)bodyValue).getBridgeParameters().size() > 1);
+ }
+
+ if(jm.isAsync() && isResponseAsynWrapper){
+ Object asyncWrapper =
createAsyncResponseClass(jm.getResponseParameters().get(0));
+ if(bodyValue instanceof RpcLitPayload){
+ RpcLitPayload payload = (RpcLitPayload)bodyValue;
+ for(JAXBBridgeInfo bi : payload.getBridgeParameters()){
+ setAsyncResponseWrapperValue(rtContext, asyncWrapper, bi.getValue(),
bi.getType().tagName);
+ }
+ }else {
+ JAXBBridgeInfo value = (JAXBBridgeInfo)bodyValue;
+ setAsyncResponseWrapperValue(rtContext, asyncWrapper, value.getValue(),
value.getType().tagName);
+ }
+
+ if(im.getHeaders() != null) {
+ for(HeaderBlock hb : im.getHeaders()){
+ JAXBBridgeInfo value = (JAXBBridgeInfo)hb.getValue();
+ setAsyncResponseWrapperValue(rtContext, asyncWrapper,
value.getValue(), value.getType().tagName);
+ }
+ }else if(attachments != null){
+ for(String id : attachments.keySet()){
+ AttachmentBlock ab = attachments.get(id);
+ if(ab == null)
+ return;
+ String part = ab.getWSDLPartName();
+
+ // TODO: this isn't correct
+ setAsyncResponseWrapperValue(rtContext, asyncWrapper,
ab.asDataHandler(), new QName("", part));
+ }
+ }
+ mi.setResponse(asyncWrapper);
+ return;
+ }else if(jm.isAsync() && ((bBlocks+hBlocks+mBlocks) == 1)){
+ //there is only 1 response part
+ Object value = null;
+ if(bodyValue instanceof RpcLitPayload){
+ RpcLitPayload payload = (RpcLitPayload)bodyValue;
+ for(JAXBBridgeInfo bi:payload.getBridgeParameters()){
+ value = bi.getValue();
+ break;
+ }
+ }else{
+ value = ((JAXBBridgeInfo)bodyValue).getValue();
+ }
+
+ if(value != null){
+ mi.setResponse(value);
+ return;
+ }
+
+ if(headers != null){
+ for(HeaderBlock hb : headers){
+ value = ((JAXBBridgeInfo)hb.getValue()).getValue();
+ if(value != null){
+ mi.setResponse(value);
+ return;
+ }
+ }
+ }
+
+ if(attachments != null){
+ for(String id:attachments.keySet()){
+ AttachmentBlock ab = attachments.get(id);
+ if(ab == null) continue;
+
+ // TODO: this isn't correct
+ mi.setResponse(ab.asDataHandler());
+ return;
+ }
+ }
+
+ // bBlocks+hBlocks+mBlocks==1, so we shall never get here
+ assert false;
+ }
+
+
+ for (Parameter param : jm.getResponseParameters()) {
+ Object obj = null;
+ ParameterBinding paramBinding = param.getOutBinding();
+ if (paramBinding.isBody()) {
+ //TODO: check if the bodyValue qname is the one we expect!
+ obj = bodyValue;
+ } else if (headers != null && paramBinding.isHeader()) {
+ HeaderBlock header = getHeaderBlock(param.getName(), headers);
+ obj = (header != null) ? header.getValue() : null;
+ } else if (paramBinding.isAttachment()) {
+ obj = getAttachment(rtContext, attachments, param, paramBinding);
+ }
+ Object resp = fillData(rtContext, param, obj, data, soapBinding,
paramBinding);
+ if (param.isResponse()) {
+ mi.setResponse(resp);
+ }
+ }
+ }
+
+ private void setAsyncResponseWrapperValue(RuntimeContext rtContext, Object bean,
Object value, QName tag){
+ if(value != null){
+ setWrapperChildValue(rtContext, bean, value, tag.getNamespaceURI(),
tag.getLocalPart());
+ }
+ }
+
+ private Object createAsyncResponseClass(Parameter parameter) {
+ Class asyncWrapper = (Class)parameter.getTypeReference().type;
+ if(RpcLitPayload.class.isAssignableFrom(asyncWrapper)){
+ WrapperParameter wp = (WrapperParameter)parameter;
+ if(wp.getWrapperChildren().size() > 0){
+ Parameter p = wp.getWrapperChildren().get(0);
+ asyncWrapper = (Class) p.getTypeReference().type;
+ }
+ }
+
+ try {
+ return asyncWrapper.newInstance();
+ } catch(Exception e){
+ throw new SerializationException(e);
+ }
+ }
+
+ private Exception createCheckedException(String message, CheckedException ce, Object
detail) {
+ if(ce.getExceptionType().equals(ExceptionType.UserDefined)){
+ return createUserDefinedException(message, ce, detail);
+
+ }
+ Class exceptionClass = ce.getExcpetionClass();
+ try {
+ Constructor constructor = exceptionClass.getConstructor(new
Class[]{String.class, (Class) ce.getDetailType().type});
+ Object exception = constructor.newInstance(new Object[]{message, detail});
+ return (Exception)exception;
+ } catch(Exception e){
+ throw new SerializationException(e);
+ }
+ }
+
+ /**
+ * @param message
+ * @param ce
+ * @param detail
+ */
+ private Exception createUserDefinedException(String message, CheckedException ce,
Object detail) {
+ Class exceptionClass = ce.getExcpetionClass();
+ try {
+ Constructor constructor = exceptionClass.getConstructor(new
Class[]{String.class});
+ Object exception = constructor.newInstance(new Object[]{message});
+ Field[] fields = detail.getClass().getFields();
+ for(Field f : fields){
+ Method m = exceptionClass.getMethod(getWriteMethod(f));
+ m.invoke(exception, new Object[]{f.get(detail)});
+ }
+ return (Exception)exception;
+ } catch(Exception e){
+ throw new SerializationException(e);
+ }
+ }
+
+ /**
+ * @param f
+ */
+ private String getWriteMethod(Field f){
+ return "set" + StringUtils.capitalize(f.getName());
+ }
+
+ /* (non-Javadoc)
+ * @see
org.jboss.com.sun.xml.ws.rt.encoding.EncoderDecoderBase#toInternalMessage(com.sun.pept.ept.MessageInfo)
+ */
+ public InternalMessage toInternalMessage(MessageInfo mi) {
+ RuntimeContext rtContext = (RuntimeContext)
mi.getMetaData(BindingProviderProperties.JAXWS_RUNTIME_CONTEXT);
+ RuntimeModel model = rtContext.getModel();
+
+ JavaMethod jm = model.getJavaMethod(mi.getMethod());
+ Object[] data = mi.getData();
+ InternalMessage im = new InternalMessage();
+ //copy the attachments from the outbound attachments to InternalMessage
+ RequestContext ctxt =
(RequestContext)mi.getMetaData(BindingProviderProperties.JAXWS_CONTEXT_PROPERTY);
+ copyAttachmentProperty(ctxt, im);
+ Iterator<Parameter> iter = jm.getRequestParameters().iterator();
+ SOAPBinding soapBinding = (SOAPBinding)jm.getBinding();
+ while (iter.hasNext()) {
+ Parameter param = iter.next();
+ ParameterBinding paramBinding = param.getInBinding();
+ Object obj = createPayload(rtContext, param, data, null, soapBinding,
paramBinding);
+ if (paramBinding.isBody()) {
+ im.setBody(new BodyBlock(obj));
+ } else if (paramBinding.isHeader()) {
+ im.addHeader(new HeaderBlock((JAXBBridgeInfo)obj));
+ } else if (paramBinding.isAttachment()) {
+ addAttachmentPart(rtContext, im, obj, param);
+ }
+ }
+ return im;
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/ClientEncoderDecoder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/DeserializationException.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/DeserializationException.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/DeserializationException.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,53 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.encoding.soap;
+
+import org.jboss.com.sun.xml.ws.util.exception.JAXWSExceptionBase;
+import org.jboss.com.sun.xml.ws.util.localization.Localizable;
+
+/**
+ * DeserializationException represents an exception that occurred while
+ * deserializing a Java value from XML.
+ *
+ * @see JAXWSExceptionBase
+ *
+ * @author WS Development Team
+ */
+public class DeserializationException extends JAXWSExceptionBase {
+
+ public DeserializationException(String key, Object... args) {
+ super(key, args);
+ }
+
+ public DeserializationException(Throwable throwable) {
+ super(throwable);
+ }
+
+ public DeserializationException(Localizable arg) {
+ super("nestedDeserializationError", arg);
+ }
+
+ public String getResourceBundleName() {
+ return "org.jboss.com.sun.xml.ws.resources.encoding";
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/DeserializationException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/EncoderDecoder.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/EncoderDecoder.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/EncoderDecoder.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,405 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.encoding.soap;
+
+
+import javax.activation.DataHandler;
+import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.WebServiceException;
+
+import org.jboss.com.sun.xml.ws.client.BindingProviderProperties;
+import org.jboss.com.sun.xml.ws.client.RequestContext;
+import org.jboss.com.sun.xml.ws.encoding.EncoderDecoderBase;
+import org.jboss.com.sun.xml.ws.encoding.jaxb.JAXBBridgeInfo;
+import org.jboss.com.sun.xml.ws.encoding.jaxb.RpcLitPayload;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.AttachmentBlock;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.HeaderBlock;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.InternalMessage;
+import org.jboss.com.sun.xml.ws.handler.HandlerContext;
+import org.jboss.com.sun.xml.ws.handler.MessageContextUtil;
+import org.jboss.com.sun.xml.ws.model.*;
+import org.jboss.com.sun.xml.ws.model.soap.SOAPBinding;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.server.RuntimeContext;
+
+import java.awt.Image;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.lang.reflect.Type;
+import java.net.URLEncoder;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+/**
+ * @author Vivek Pandey
+ *
+ * Base SOAP encoder decoder class.
+ */
+public abstract class EncoderDecoder extends EncoderDecoderBase {
+
+ /**
+ * Fills the data[] which is ordered list of java method parameters.
+ *
+ * @param context
+ * will be used if needed
+ * @param obj
+ * @param data
+ * @return if the parameter is a return
+ */
+ protected Object fillData(RuntimeContext context, Parameter param, Object obj,
Object[] data,
+ SOAPBinding binding, ParameterBinding paramBinding) {
+ if (param.isWrapperStyle()) {
+ Object resp = null;
+ for (Parameter p : ((WrapperParameter) param).getWrapperChildren()) {
+ QName name = p.getName();
+ Object value = null;
+ if (binding.isDocLit()){
+ value = super.getWrapperChildValue(context,
((JAXBBridgeInfo)obj).getValue(),
+ name.getNamespaceURI(), name.getLocalPart());
+ }else if (binding.isRpcLit()){
+ value = getWrapperChildValue(context, obj, name.getNamespaceURI(),
name
+ .getLocalPart());
+ if(value == null)
+ value = setIfPrimitive(p.getTypeReference().type);
+ }
+ if (p.isResponse())
+ resp = value;
+ else {
+ if (data[p.getIndex()] != null) {
+ Parameter.setHolderValue(data[p.getIndex()], value);
+ } else {
+ data[p.getIndex()] = p.createHolderValue(value);
+ }
+ }
+ }
+ return resp;
+ }
+
+ if(!paramBinding.isAttachment()){
+ if(paramBinding.isUnbound())
+ obj = setIfPrimitive(param.getTypeReference().type);
+ else
+ obj = (obj != null)?((JAXBBridgeInfo)obj).getValue():null;
+ }
+ if (param.isResponse()) {
+ if(paramBinding.isUnbound())
+ return setIfPrimitive(param.getTypeReference().type);
+ return obj;
+ } else if (data[param.getIndex()] != null) {
+ Parameter.setHolderValue(data[param.getIndex()], obj);
+ } else {
+ data[param.getIndex()] = param.createHolderValue(obj);
+ }
+ return null;
+ }
+
+ /**
+ * Returns the default values of primitive types. To be called when the object
referene by this type is null.
+ * @param type
+ * @return default values of primitive types if type is primitive else null
+ */
+ private Object setIfPrimitive(Type type) {
+ if(type instanceof Class){
+ Class cls = (Class)type;
+ if(cls.isPrimitive()){
+ if(cls.getName().equals(boolean.class.getName())){
+ return false;
+ }
+ return 0;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * creates the payload to be serilized over the wire. It can be constructed
+ * from the parameters in data[] or from the result.
+ *
+ * @param context
+ * runtime context. It can be used to get access to the
+ * JAXBContext.
+ * @param data
+ * parameters
+ * @param result
+ * it could be null if there are no response object,for example
+ * incase of outgoing client message.
+ * @return Payload - decided by the binding used
+ */
+ protected Object createPayload(RuntimeContext context, Parameter param, Object[]
data,
+ Object result, SOAPBinding binding, ParameterBinding
paramBinding) {
+ if(paramBinding.isAttachment()){
+ Object obj = null;
+ if(param.isResponse())
+ obj = result;
+ else
+ obj = param.getHolderValue(data[param.getIndex()]);
+ return obj;
+ }
+ if (binding.isRpcLit() && paramBinding.isBody()) {
+ return createRpcLitPayload(context, (WrapperParameter) param, data, result);
+ }
+ Object obj = createDocLitPayloadValue(context, param, data, result);
+ RuntimeModel model = context.getModel();
+ return new JAXBBridgeInfo(model.getBridge(param.getTypeReference()), obj);
+ }
+
+ /*
+ * Returns the value corresponding to the localName or part accessor from
+ * rpclit structure.
+ *
+ * @see EncoderDecoderBase#getWrapperChildValue(RuntimeContext,
+ * Object, String, String)
+ */
+ @Override
+ protected Object getWrapperChildValue(RuntimeContext context, Object obj, String
nsURI,
+ String localName) {
+ RpcLitPayload payload = (RpcLitPayload) obj;
+ JAXBBridgeInfo rpcParam = payload.getBridgeParameterByName(localName);
+ if(rpcParam != null)
+ return rpcParam.getValue();
+ return null;
+ }
+
+ /**
+ * Gives the binding specific object to be serialized.
+ *
+ * @param context
+ * @param data
+ * @param result
+ */
+ private Object createDocLitPayloadValue(RuntimeContext context, Parameter param,
Object[] data, Object result) {
+ if (param.isWrapperStyle()) {
+ return createJAXBBeanPayload(context, (WrapperParameter) param, data,
result);
+ }
+ return getBarePayload(param, data, result);
+ }
+
+ /**
+ * Gets the HeaderBlock corresponding to the given QName.
+ *
+ * @param name
+ * @param headers
+ * @return the <code>HeaderBlock</code> corresponding to the given
+ * <code>QName name</code>
+ */
+ protected HeaderBlock getHeaderBlock(QName name, List<HeaderBlock> headers) {
+ for (HeaderBlock header : headers) {
+ if (name.equals(header.getName()))
+ return header;
+ }
+ return null;
+ }
+
+ /**
+ * Returns either the value corresponding to the parameter or result.
+ *
+ * @param param
+ * @param data
+ * @param result
+ * @return Either the value of response of the parameter corresponding to
+ * the parameter index, takes care of Holder.value.
+ *
+ */
+ private Object getBarePayload(Parameter param, Object[] data, Object result) {
+ Object obj = null;
+ if (param.isResponse()) {
+ obj = result;
+ } else {
+ obj = param.getHolderValue(data[param.getIndex()]);
+ }
+ return obj;
+ }
+
+ /**
+ * Creates JAXB style wrapper bean from the parameters or result.
+ *
+ * @param context
+ * @param param
+ * WrapperParameter
+ * @param data
+ * @param result
+ * @return non-null JAXB style bean.
+ */
+ private Object createJAXBBeanPayload(RuntimeContext context, WrapperParameter param,
+ Object[] data, Object result) {
+ Class bean = (Class) param.getTypeReference().type;
+ try {
+ Object obj = bean.newInstance();
+ for( Parameter p : param.getWrapperChildren() ) {
+ Object value;
+ if (p.isResponse())
+ value = result;
+ else
+ value = p.getHolderValue(data[p.getIndex()]);
+ QName name = p.getName();
+ setWrapperChildValue(context, obj, value,
+ name.getNamespaceURI(), name.getLocalPart());
+ }
+ return obj;
+ } catch(Exception e){
+ throw new SerializationException(e);
+ }
+ }
+
+ /**
+ * Creates RpcLitPayload from the parameters or response.
+ *
+ * @param context
+ * @param param
+ * @param data
+ * @param result
+ * @return non-null RpcLitPayload
+ */
+ private Object createRpcLitPayload(RuntimeContext context, WrapperParameter param,
+ Object[] data, Object result) {
+ RpcLitPayload payload = new RpcLitPayload(param.getName());
+
+ for (Parameter p : param.getWrapperChildren()) {
+ if(p.getBinding().isUnbound())
+ continue;
+ Object value = null;
+ if (p.isResponse())
+ value = result;
+ else
+ value = p.getHolderValue(data[p.getIndex()]);
+ checkRPCLitNullableParameter(p, value);
+ RuntimeModel model = context.getModel();
+ JAXBBridgeInfo bi = new JAXBBridgeInfo(model.getBridge(p.getTypeReference()),
value);
+ payload.addParameter(bi);
+ }
+ return payload;
+ }
+
+ protected Object getAttachment(RuntimeContext rtContext, Map<String,
AttachmentBlock> attachments,
+ Parameter param, ParameterBinding paramBinding){
+ try {
+ for (Map.Entry<String,AttachmentBlock> entry : attachments.entrySet())
{
+ AttachmentBlock ab = entry.getValue();
+ String part = ab.getWSDLPartName();
+ // part can be null if the Content-Id is not encoded as per AP 1.0 R2933.
Which is ok since there could be attachments
+ // other than WSDL MIME bound
+ if(part == null)
+ continue;
+
+ if(part.equals(param.getPartName()) ||
part.equals("<"+param.getPartName())){
+ Class type = (Class)param.getTypeReference().type;
+
+ if(DataHandler.class.isAssignableFrom(type))
+ return ab.asDataHandler();
+ if(byte[].class==type)
+ return ab.asByteArray();
+ if(Source.class.isAssignableFrom(type))
+ return ab.asSource();
+ if(Image.class.isAssignableFrom(type))
+ return ab.asImage();
+ if(InputStream.class==type)
+ return ab.asDataHandler().getInputStream();
+ if(isXMLMimeType(paramBinding.getMimeType())) {
+ JAXBBridgeInfo bi =
(JAXBBridgeInfo)rtContext.getDecoderInfo(param.getName());
+ ab.deserialize(rtContext.getBridgeContext(),bi);
+ return bi.getValue();
+ }
+ }
+ }
+ return null;
+ } catch (IOException e) {
+ throw new SerializationException(e);
+ }
+ }
+
+ protected void addAttachmentPart(RuntimeContext rtContext, InternalMessage im, Object
obj, Parameter mimeParam){
+ if(obj == null)
+ return;
+ RuntimeModel model = rtContext.getModel();
+ String mimeType = mimeParam.getBinding().getMimeType();
+ String contentId;
+ try {
+ contentId = URLEncoder.encode(mimeParam.getPartName(), "UTF-8")+
'=' +UUID.randomUUID()+"(a)jaxws.sun.com";
+ contentId="<"+contentId+">";
+ } catch (UnsupportedEncodingException e) {
+ throw new SerializationException(e);
+ }
+
+ AttachmentBlock ab;
+
+ if(obj instanceof DataHandler)
+ ab = AttachmentBlock.fromDataHandler(contentId,(DataHandler)obj);
+ else
+ if(obj instanceof Source)
+ // this is potentially broken, as there's no guarantee this will work.
+ // we should have our own AttachmentBlock implementation for this.
+ ab = AttachmentBlock.fromDataHandler(contentId, new
DataHandler(obj,mimeType));
+ else
+ if(obj instanceof byte[])
+ ab = AttachmentBlock.fromByteArray(contentId,(byte[])obj,mimeType);
+ else
+ if(isXMLMimeType(mimeType))
+ ab = AttachmentBlock.fromJAXB(contentId,
+ new JAXBBridgeInfo(model.getBridge(mimeParam.getTypeReference()),
obj),
+ rtContext, mimeType );
+ else
+ // this is also broken, as there's no guarantee that the object type and
the MIME type
+ // matches. But most of the time it matches, so it mostly works.
+ ab = AttachmentBlock.fromDataHandler(contentId,new
DataHandler(obj,mimeType));
+
+ //populate the attachment map in the message context
+ HandlerContext hc = rtContext.getHandlerContext();
+ if(hc != null){
+ MessageContext mc = hc.getMessageContext();
+ if(mc != null){
+ MessageContextUtil.addMessageAttachment(mc, ab.getId(),
ab.asDataHandler());
+ }
+ }
+
+ im.addAttachment(ab);
+ }
+
+ protected void copyAttachmentProperty(Map<String, Object> ctxt, InternalMessage
im) {
+ if(ctxt == null)
+ return;
+ Map<String, DataHandler> attMap = (Map<String, DataHandler>)
ctxt.get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);
+ if (attMap == null)
+ return;
+ for (Map.Entry<String, DataHandler> att : attMap.entrySet()) {
+ im.addAttachment(AttachmentBlock.fromDataHandler(att.getKey(),
att.getValue()));
+ }
+ }
+
+ private boolean isXMLMimeType(String mimeType){
+ if(mimeType.equals("text/xml") ||
mimeType.equals("application/xml"))
+ return true;
+ return false;
+ }
+
+ /**
+ * Checks rpclit body parts for nullability
+ */
+ void checkRPCLitNullableParameter(Parameter param, Object value) {
+ if(value == null)
+ throw new WebServiceException("Method Parameter: "+param.getName()
+" cannot be null. This is BP 1.1 R2211 violation.");
+ }
+
+}
\ No newline at end of file
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/EncoderDecoder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/SOAP12Constants.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/SOAP12Constants.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/SOAP12Constants.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,76 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.encoding.soap;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.xml.ws.encoding.soap.streaming.SOAP12NamespaceConstants;
+
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class SOAP12Constants {
+
+ public static final String URI_ENVELOPE = SOAP12NamespaceConstants.ENVELOPE;
+ public static final String URI_ENCODING =
"http://schemas.xmlsoap.org/soap/encoding/";
+ public static final String URI_HTTP = SOAP12NamespaceConstants.TRANSPORT_HTTP;
+ public static final String URI_SOAP_RPC = SOAP12NamespaceConstants.SOAP_RPC;
+
+
+ public static final QName QNAME_SOAP_RPC = new QName(URI_SOAP_RPC, "rpc");
+ public static final QName QNAME_SOAP_RESULT = new QName(URI_SOAP_RPC,
"result");
+
+ public static final QName QNAME_SOAP_ENVELOPE = new QName(URI_ENVELOPE,
"Envelope");
+ public static final QName QNAME_SOAP_BODY = new QName(URI_ENVELOPE,
"Body");
+ public static final QName QNAME_SOAP_HEADER = new QName(URI_ENVELOPE,
"Header");
+ public static final QName QNAME_ENVELOPE_ENCODINGSTYLE = new QName(URI_ENVELOPE,
"encodingStyle");
+ public static final QName QNAME_SOAP_FAULT = new QName(URI_ENVELOPE,
"Fault");
+ public static final QName QNAME_MUSTUNDERSTAND = new QName(URI_ENVELOPE,
"mustUnderstand");
+ public static final QName QNAME_ROLE = new QName(URI_ENVELOPE,
"role");
+
+ public static final QName QNAME_NOT_UNDERSTOOD = new QName(URI_ENVELOPE,
"NotUnderstood");
+
+ //fault
+ public static final QName QNAME_FAULT_CODE = new QName(URI_ENVELOPE,
"Code");
+ public static final QName QNAME_FAULT_SUBCODE = new QName(URI_ENVELOPE,
"Subcode");
+ public static final QName QNAME_FAULT_VALUE = new QName(URI_ENVELOPE,
"Value");
+ public static final QName QNAME_FAULT_REASON = new QName(URI_ENVELOPE,
"Reason");
+ public static final QName QNAME_FAULT_NODE = new QName(URI_ENVELOPE,
"Node");
+ public static final QName QNAME_FAULT_ROLE = new QName(URI_ENVELOPE,
"Role");
+ public static final QName QNAME_FAULT_DETAIL = new QName(URI_ENVELOPE,
"Detail");
+ public static final QName QNAME_FAULT_REASON_TEXT = new
QName(URI_ENVELOPE, "Text");
+ public final static QName QNAME_UPGRADE = new QName(URI_ENVELOPE,
"Upgrade");
+ public final static QName QNAME_UPGRADE_SUPPORTED_ENVELOPE = new
QName(URI_ENVELOPE, "SupportedEnvelope");
+
+
+ //fault codes
+ public final static QName FAULT_CODE_CLIENT = new QName(URI_ENVELOPE,
"Sender");
+ public final static QName FAULT_CODE_SERVER = new QName(URI_ENVELOPE,
"Receiver");
+ public final static QName FAULT_CODE_MUST_UNDERSTAND = new QName(URI_ENVELOPE,
"MustUnderstand");
+ public final static QName FAULT_CODE_MISUNDERSTOOD = new QName(URI_ENVELOPE,
"Misunderstood");
+ public final static QName FAULT_CODE_VERSION_MISMATCH = new QName(URI_ENVELOPE,
"VersionMismatch");
+ public final static QName FAULT_CODE_DATA_ENCODING_UNKNOWN = new QName(URI_ENVELOPE,
"DataEncodingUnknown");
+ public final static QName FAULT_CODE_PROCEDURE_NOT_PRESENT = new QName(URI_ENVELOPE,
"ProcedureNotPresent");
+ public final static QName FAULT_CODE_BAD_ARGUMENTS = new QName(URI_ENVELOPE,
"BadArguments");
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/SOAP12Constants.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/SOAPConstants.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/SOAPConstants.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/SOAPConstants.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,61 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+
+package org.jboss.com.sun.xml.ws.encoding.soap;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.xml.ws.encoding.soap.streaming.SOAPNamespaceConstants;
+
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class SOAPConstants {
+
+ public static final String URI_ENVELOPE = SOAPNamespaceConstants.ENVELOPE;
+ public static final String URI_HTTP = SOAPNamespaceConstants.TRANSPORT_HTTP;
+ public static final String URI_ENCODING =
"http://schemas.xmlsoap.org/soap/encoding/";
+ public static final String NS_WSDL_SOAP =
"http://schemas.xmlsoap.org/wsdl/soap/";
+ public static final QName QNAME_ENVELOPE_ENCODINGSTYLE = new QName(URI_ENVELOPE,
"encodingStyle");
+
+ public final static QName QNAME_SOAP_ENVELOPE = new QName(URI_ENVELOPE,
"Envelope");
+ public final static QName QNAME_SOAP_HEADER = new QName(URI_ENVELOPE,
"Header");
+ public static final QName QNAME_MUSTUNDERSTAND = new QName(URI_ENVELOPE,
"mustUnderstand");
+ public static final QName QNAME_ROLE = new QName(URI_ENVELOPE,
"actor");
+ public final static QName QNAME_SOAP_BODY = new QName(URI_ENVELOPE,
"Body");
+ public final static QName QNAME_SOAP_FAULT = new QName(URI_ENVELOPE,
"Fault");
+ public final static QName QNAME_SOAP_FAULT_CODE = new QName("",
"faultcode");
+ public final static QName QNAME_SOAP_FAULT_STRING = new
QName("", "faultstring");
+ public final static QName QNAME_SOAP_FAULT_ACTOR = new
QName("", "faultactor");
+ public final static QName QNAME_SOAP_FAULT_DETAIL = new
QName("", "detail");
+ public final static QName FAULT_CODE_CLIENT = new QName(URI_ENVELOPE,
"Client");
+ public final static QName FAULT_CODE_SERVER = new QName(URI_ENVELOPE,
"Server");
+ public final static QName FAULT_CODE_MUST_UNDERSTAND = new QName(URI_ENVELOPE,
"MustUnderstand");
+
+ public final static QName FAULT_CODE_VERSION_MISMATCH = new QName(URI_ENVELOPE,
"VersionMismatch");
+ public final static QName FAULT_CODE_DATA_ENCODING_UNKNOWN = new QName(URI_ENVELOPE,
"DataEncodingUnknown");
+ public final static QName FAULT_CODE_PROCEDURE_NOT_PRESENT = new QName(URI_ENVELOPE,
"ProcedureNotPresent");
+ public final static QName FAULT_CODE_BAD_ARGUMENTS = new QName(URI_ENVELOPE,
"BadArguments");
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/SOAPConstants.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/SOAPDecoder.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/SOAPDecoder.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/SOAPDecoder.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,678 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.encoding.soap;
+
+import com.sun.xml.bind.api.BridgeContext;
+import org.jboss.com.sun.xml.messaging.saaj.packaging.mime.internet.ContentType;
+import org.jboss.com.sun.xml.messaging.saaj.packaging.mime.internet.ParseException;
+import org.jboss.com.sun.xml.messaging.saaj.util.ByteInputStream;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.AttachmentPart;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFault;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.soap.SOAPPart;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.ws.soap.SOAPBinding;
+import javax.xml.ws.soap.SOAPFaultException;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import static javax.xml.stream.XMLStreamReader.*;
+import javax.xml.bind.Unmarshaller;
+
+import org.jboss.com.sun.xml.ws.client.BindingProviderProperties;
+import org.jboss.com.sun.xml.ws.client.dispatch.DispatchContext;
+import org.jboss.com.sun.xml.ws.client.dispatch.impl.encoding.DispatchUtil;
+import org.jboss.com.sun.xml.ws.encoding.JAXWSAttachmentUnmarshaller;
+import org.jboss.com.sun.xml.ws.encoding.jaxb.JAXBBridgeInfo;
+import org.jboss.com.sun.xml.ws.encoding.jaxb.RpcLitPayload;
+import org.jboss.com.sun.xml.ws.encoding.jaxb.RpcLitPayloadSerializer;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.AttachmentBlock;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.BodyBlock;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.HeaderBlock;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.InternalMessage;
+import org.jboss.com.sun.xml.ws.encoding.soap.message.SOAPFaultInfo;
+import org.jboss.com.sun.xml.ws.encoding.soap.streaming.SOAPNamespaceConstants;
+import org.jboss.com.sun.xml.ws.handler.HandlerChainCaller;
+import org.jboss.com.sun.xml.ws.handler.HandlerContext;
+import org.jboss.com.sun.xml.ws.model.soap.SOAPRuntimeModel;
+import org.jboss.com.sun.xml.ws.pept.encoding.Decoder;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.pept.presentation.MessageStruct;
+import org.jboss.com.sun.xml.ws.server.RuntimeContext;
+import org.jboss.com.sun.xml.ws.streaming.SourceReaderFactory;
+import org.jboss.com.sun.xml.ws.streaming.XMLReaderException;
+import org.jboss.com.sun.xml.ws.streaming.XMLStreamReaderException;
+import org.jboss.com.sun.xml.ws.streaming.XMLStreamReaderUtil;
+import org.jboss.com.sun.xml.ws.util.FastInfosetReflection;
+import org.jboss.com.sun.xml.ws.util.MessageInfoUtil;
+import org.jboss.com.sun.xml.ws.util.SOAPUtil;
+
+/**
+ * @author WS Development Team
+ */
+public abstract class SOAPDecoder implements Decoder {
+
+ public final static String NOT_UNDERSTOOD_HEADERS =
+ "not-understood soap headers";
+
+ protected static final Logger logger = Logger.getLogger(
+ org.jboss.com.sun.xml.ws.util.Constants.LoggingDomain +
".soap.decoder");
+
+ protected final static String MUST_UNDERSTAND_FAULT_MESSAGE_STRING =
+ "SOAP must understand error";
+
+ /* (non-Javadoc)
+ * @see com.sun.pept.encoding.Decoder#decode(com.sun.pept.ept.MessageInfo)
+ */
+ public void decode(MessageInfo arg0) {
+ throw new UnsupportedOperationException();
+ }
+
+ /* (non-Javadoc)
+ * @see
com.sun.pept.encoding.Decoder#receieveAndDecode(com.sun.pept.ept.MessageInfo)
+ */
+ public void receiveAndDecode(MessageInfo arg0) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * parses and binds headers, body from SOAPMessage.
+ *
+ * @param soapMessage
+ * @return the <code>InternalMessage</code> for the
<code>soapMessage</code>
+ */
+ public InternalMessage toInternalMessage(SOAPMessage soapMessage,
+ MessageInfo messageInfo) {
+ return null;
+ }
+
+ /**
+ * Returns the roles required for the type of binding. Returns
+ * an empty set if there are none.
+ */
+ public Set<String> getRequiredRoles() {
+ return new HashSet<String>();
+ }
+
+ /**
+ * Parses and binds headers from SOAPMessage.
+ *
+ * @param soapMessage
+ * @param internalMessage
+ * @param messageInfo
+ * @return the InternalMessage representation of the SOAPMessage
+ */
+ public InternalMessage toInternalMessage(SOAPMessage soapMessage,
+ InternalMessage internalMessage, MessageInfo
messageInfo) {
+ return null;
+ }
+
+ public SOAPMessage toSOAPMessage(MessageInfo messageInfo) {
+ return null;
+ }
+
+ public void toMessageInfo(InternalMessage internalMessage, MessageInfo messageInfo)
{
+ }
+
+ protected QName getEnvelopeTag() {
+ return SOAPConstants.QNAME_SOAP_ENVELOPE;
+ }
+
+ protected QName getBodyTag() {
+ return SOAPConstants.QNAME_SOAP_BODY;
+ }
+
+ protected QName getHeaderTag() {
+ return SOAPConstants.QNAME_SOAP_HEADER;
+ }
+
+ protected QName getMUAttrQName() {
+ return SOAPConstants.QNAME_MUSTUNDERSTAND;
+ }
+
+ protected QName getRoleAttrQName() {
+ return SOAPConstants.QNAME_ROLE;
+ }
+
+ protected QName getFaultTag() {
+ return SOAPConstants.QNAME_SOAP_FAULT;
+ }
+
+ protected QName getFaultDetailTag() {
+ return SOAPConstants.QNAME_SOAP_FAULT_DETAIL;
+ }
+
+
+ protected void skipBody(XMLStreamReader reader) {
+ XMLStreamReaderUtil.verifyReaderState(reader, START_ELEMENT);
+ XMLStreamReaderUtil.verifyTag(reader, getBodyTag());
+ XMLStreamReaderUtil.skipElement(reader); // Moves to </Body>
+ XMLStreamReaderUtil.nextElementContent(reader);
+ }
+
+ protected void skipHeader(XMLStreamReader reader, MessageInfo messageInfo) {
+ XMLStreamReaderUtil.verifyReaderState(reader, START_ELEMENT);
+ if (!isDispatch(messageInfo))
+ return;
+
+ if (!SOAPNamespaceConstants.TAG_HEADER.equals(reader.getLocalName())) {
+ return;
+ }
+
+ //XMLStreamReaderUtil.verifyTag(reader, getHeaderTag());
+
+ dispatchUtil.collectPrefixes(reader);
+
+ XMLStreamReaderUtil.skipElement(reader); // Moves to </Header>
+
+ try {
+ reader.next();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ protected boolean skipHeader(MessageInfo messageInfo) {
+ if (messageInfo.getMetaData(DispatchContext.DISPATCH_MESSAGE_MODE) ==
+ Service.Mode.PAYLOAD) {
+ return true;
+ }
+ return false;
+ }
+
+ /*
+ * skipBody is true, the body is skipped during parsing.
+ */
+ protected void decodeEnvelope(XMLStreamReader reader, InternalMessage request,
+ boolean skipBody, MessageInfo messageInfo) {
+ XMLStreamReaderUtil.verifyReaderState(reader, START_ELEMENT);
+ XMLStreamReaderUtil.verifyTag(reader, getEnvelopeTag());
+ XMLStreamReaderUtil.nextElementContent(reader);
+ if (skipHeader(messageInfo))
+ skipHeader(reader, messageInfo);
+ else
+ decodeHeader(reader, messageInfo, request);
+
+
+ if (skipBody) {
+ skipBody(reader);
+ } else {
+ decodeBody(reader, request, messageInfo);
+ }
+
+
+ XMLStreamReaderUtil.verifyReaderState(reader, END_ELEMENT);
+ XMLStreamReaderUtil.verifyTag(reader, getEnvelopeTag());
+ XMLStreamReaderUtil.nextElementContent(reader);
+ XMLStreamReaderUtil.verifyReaderState(reader, END_DOCUMENT);
+ }
+
+ protected void decodeHeader(XMLStreamReader reader, MessageInfo messageInfo,
+ InternalMessage request) {
+ XMLStreamReaderUtil.verifyReaderState(reader, START_ELEMENT);
+
+
+ if (!SOAPNamespaceConstants.TAG_HEADER.equals(reader.getLocalName())) {
+ return;
+ }
+ XMLStreamReaderUtil.verifyTag(reader, getHeaderTag());
+ if (isDispatch(messageInfo))
+ dispatchUtil.collectPrefixes(reader);
+ XMLStreamReaderUtil.nextElementContent(reader);
+ while (true) {
+ if (reader.getEventType() == START_ELEMENT) {
+ decodeHeaderElement(reader, messageInfo, request);
+ } else {
+ break;
+ }
+ }
+ XMLStreamReaderUtil.verifyReaderState(reader, END_ELEMENT);
+ XMLStreamReaderUtil.verifyTag(reader, getHeaderTag());
+ XMLStreamReaderUtil.nextElementContent(reader);
+ }
+
+/*
+* If JAXB can deserialize a header, deserialize it.
+* Otherwise, just ignore the header
+*/
+
+ protected void decodeHeaderElement(XMLStreamReader reader, MessageInfo messageInfo,
+ InternalMessage msg) {
+ RuntimeContext rtCtxt = MessageInfoUtil.getRuntimeContext(messageInfo);
+ if (rtCtxt == null) {
+
+ XMLStreamReaderUtil.skipElement(reader); // Moves to END state
+ XMLStreamReaderUtil.nextElementContent(reader);
+ return;
+ }
+ BridgeContext bridgeContext = rtCtxt.getBridgeContext();
+ Set<QName> knownHeaders = ((SOAPRuntimeModel)
rtCtxt.getModel()).getKnownHeaders();
+ QName name = reader.getName();
+ if (knownHeaders != null && knownHeaders.contains(name)) {
+ QName headerName = reader.getName();
+ if (msg.isHeaderPresent(name)) {
+ // More than one instance of header whose QName is mapped to a
+ // method parameter. Generates a runtime error.
+ raiseFault(getSenderFaultCode(), DUPLICATE_HEADER + headerName);
+ }
+ Object decoderInfo = rtCtxt.getDecoderInfo(name);
+ if (decoderInfo != null && decoderInfo instanceof JAXBBridgeInfo) {
+ JAXBBridgeInfo bridgeInfo = (JAXBBridgeInfo) decoderInfo;
+// JAXB leaves on </env:Header> or <nextHeaderElement>
+ bridgeInfo.deserialize(reader, bridgeContext);
+ HeaderBlock headerBlock = new HeaderBlock(bridgeInfo);
+ msg.addHeader(headerBlock);
+ }
+ } else {
+ XMLStreamReaderUtil.skipElement(reader); // Moves to END state
+ XMLStreamReaderUtil.nextElementContent(reader);
+ }
+ }
+
+ protected void decodeBody(XMLStreamReader reader, InternalMessage response,
+ MessageInfo messageInfo) {
+ XMLStreamReaderUtil.verifyReaderState(reader, START_ELEMENT);
+ XMLStreamReaderUtil.verifyTag(reader, getBodyTag());
+ int state = XMLStreamReaderUtil.nextElementContent(reader);
+ decodeBodyContent(reader, response, messageInfo);
+ XMLStreamReaderUtil.verifyReaderState(reader, END_ELEMENT);
+ XMLStreamReaderUtil.verifyTag(reader, getBodyTag());
+ XMLStreamReaderUtil.nextElementContent(reader);
+ }
+
+ protected void decodeBodyContent(XMLStreamReader reader, InternalMessage response,
+ MessageInfo messageInfo) {
+ RuntimeContext rtCtxt = MessageInfoUtil.getRuntimeContext(messageInfo);
+ BridgeContext bridgeContext = rtCtxt.getBridgeContext();
+ decodeDispatchMethod(reader, response, messageInfo);
+ if (reader.getEventType() == START_ELEMENT) {
+ QName name = reader.getName(); // Operation name
+ if (name.getNamespaceURI().equals(getEnvelopeTag().getNamespaceURI())
&&
+ name.getLocalPart().equals(SOAPNamespaceConstants.TAG_FAULT)) {
+ SOAPFaultInfo soapFaultInfo = decodeFault(reader, response,
messageInfo);
+ BodyBlock responseBody = new BodyBlock(soapFaultInfo);
+ response.setBody(responseBody);
+ } else {
+ Object decoderInfo = rtCtxt.getDecoderInfo(name);
+ if (decoderInfo != null && decoderInfo instanceof
JAXBBridgeInfo)
+ {
+ JAXBBridgeInfo bridgeInfo = (JAXBBridgeInfo) decoderInfo;
+ bridgeInfo.deserialize(reader, bridgeContext);
+ BodyBlock responseBody = new BodyBlock(bridgeInfo);
+ response.setBody(responseBody);
+ } else
+ if (decoderInfo != null && decoderInfo instanceof RpcLitPayload)
+ {
+ RpcLitPayload rpcLitPayload = (RpcLitPayload) decoderInfo;
+ RpcLitPayloadSerializer.deserialize(reader, rpcLitPayload,
bridgeContext);
+ BodyBlock responseBody = new BodyBlock(rpcLitPayload);
+ response.setBody(responseBody);
+ }
+ }
+ }
+ }
+
+ public void decodeDispatchMethod(XMLStreamReader reader, InternalMessage request,
MessageInfo messageInfo) {
+ }
+
+ protected SOAPFaultInfo decodeFault(XMLStreamReader reader, InternalMessage
internalMessage,
+ MessageInfo messageInfo) {
+ return null;
+ }
+
+/*
+*
+*/
+
+ protected void convertBodyBlock(InternalMessage request, MessageInfo messageInfo) {
+ BodyBlock bodyBlock = request.getBody();
+ if (bodyBlock != null) {
+ Object value = bodyBlock.getValue();
+ if (value instanceof JAXBBridgeInfo || value instanceof RpcLitPayload)
+ {
+ // Nothing to do
+ } else if (value instanceof Source) {
+ Source source = (Source) value;
+ XMLStreamReader reader = SourceReaderFactory.createSourceReader(source,
true);
+ XMLStreamReaderUtil.nextElementContent(reader);
+ decodeBodyContent(reader, request, messageInfo);
+ } else {
+ throw new WebServiceException("Shouldn't happen. Unknown type in
BodyBlock =" + value.getClass());
+ }
+ }
+ }
+
+ /**
+ * @param mi
+ * @param im
+ * @param message
+ * @throws SOAPException
+ * @throws ParseException
+ */
+ protected void processAttachments(MessageInfo mi, InternalMessage im, SOAPMessage
message) throws SOAPException, ParseException, IOException {
+ Iterator iter = message.getAttachments();
+ if (iter.hasNext()) {
+ JAXWSAttachmentUnmarshaller au = null;
+ if (MessageInfoUtil.getRuntimeContext(mi) != null)
+ au = (JAXWSAttachmentUnmarshaller)
MessageInfoUtil.getRuntimeContext(mi).getBridgeContext().getAttachmentUnmarshaller();
+ else {
+ //for dispatch
+ Unmarshaller m =
(Unmarshaller)mi.getMetaData(BindingProviderProperties.DISPATCH_UNMARSHALLER);
+ if (m != null)
+ au = (JAXWSAttachmentUnmarshaller) m.getAttachmentUnmarshaller();
+ }
+ if (au != null){
+ au.setXOPPackage(isXOPPackage(message));
+ au.setAttachments(im.getAttachments());
+ }
+ }
+
+ while (iter.hasNext()) {
+ AttachmentPart ap = (AttachmentPart) iter.next();
+ im.addAttachment(AttachmentBlock.fromSAAJ(ap));
+ }
+ }
+
+ /**
+ * From the SOAP message header find out if its a XOP package.
+ *
+ * @param sm
+ * @return
+ * @throws ParseException
+ */
+ private boolean isXOPPackage(SOAPMessage sm) throws ParseException {
+ String ct = getContentType(sm.getSOAPPart());
+ ContentType contentType = new ContentType(ct);
+ String primary = contentType.getPrimaryType();
+ String sub = contentType.getSubType();
+ if (primary.equalsIgnoreCase("application") &&
sub.equalsIgnoreCase("xop+xml"))
+ {
+ String type = contentType.getParameter("type");
+ if (type.toLowerCase().startsWith("text/xml") ||
type.toLowerCase().startsWith("application/soap+xml"))
+ return true;
+ }
+ return false;
+ }
+
+ private String getContentType(SOAPPart part) {
+ String[] values = part.getMimeHeader("Content-Type");
+ if (values == null)
+ return null;
+ else
+ return values[0];
+ }
+
+/*
+* It does mustUnderstand processing, and does best guess of MEP
+*
+* Avoids SAAJ call that create DOM.
+*
+*/
+
+ public boolean doMustUnderstandProcessing(SOAPMessage soapMessage,
+ MessageInfo mi, HandlerContext
handlerContext, boolean getMEP)
+ throws SOAPException, IOException {
+ try {
+ boolean oneway = false;
+ Source source = soapMessage.getSOAPPart().getContent();
+ ByteInputStream bis = null;
+
+ if (source instanceof StreamSource) {
+ StreamSource streamSource = (StreamSource) source;
+ InputStream is = streamSource.getInputStream();
+ if (is != null && is instanceof ByteInputStream) {
+ bis = ((ByteInputStream) is);
+ } else {
+ logger.fine("SAAJ StreamSource doesn't have ByteInputStream
" + is);
+ }
+ } else if (FastInfosetReflection.isFastInfosetSource(source)) {
+ try {
+ bis = (ByteInputStream) FastInfosetReflection.
+ FastInfosetSource_getInputStream(source);
+ }
+ catch (Exception e) {
+ throw new
XMLReaderException("fastinfoset.noImplementation");
+ }
+ } else {
+ logger.fine("Inefficient Use - SOAPMessage is already
parsed");
+ }
+
+ XMLStreamReader reader =
+ SourceReaderFactory.createSourceReader(source, true);
+ XMLStreamReaderUtil.nextElementContent(reader);
+ checkMustUnderstandHeaders(reader, mi, handlerContext);
+
+ if (getMEP) {
+ oneway = isOneway(reader, mi);
+ }
+ XMLStreamReaderUtil.close(reader);
+ if (bis != null) {
+ bis.close(); // resets stream; SAAJ has whole stream
+ }
+
+ return oneway;
+ } catch (XMLStreamReaderException xe) {
+ raiseBadXMLFault(handlerContext);
+ throw xe;
+ }
+ }
+
+/*
+* returns Oneway or not. reader is on <Body>
+*
+* Peek into the body and make a best guess as to whether the request
+* is one-way or not. Assume request-response if it cannot be determined.
+*
+*/
+
+ private boolean isOneway(XMLStreamReader reader, MessageInfo mi) {
+ XMLStreamReaderUtil.verifyReaderState(reader, START_ELEMENT);
+ XMLStreamReaderUtil.verifyTag(reader, getBodyTag()); // <Body>
+ int state = XMLStreamReaderUtil.nextElementContent(reader);
+ QName operationName = null;
+ if (state == START_ELEMENT) { // handles empty Body i.e. <Body/>
+ operationName = reader.getName();
+ }
+ RuntimeContext rtCtxt = MessageInfoUtil.getRuntimeContext(mi);
+ rtCtxt.setMethodAndMEP(operationName, mi);
+ return (mi.getMEP() == MessageStruct.ONE_WAY_MEP);
+ }
+
+ /*
+ * Does MU processing. reader is on <Envelope>, at the end of this method
+ * leaves it on <Body>. Once the roles and understood headers are
+ * known, this calls a separate method to check the message headers
+ * since a different behavior is expected with different bindings.
+ *
+ * Also assume handler chain caller is null unless one is found.
+ */
+ private void checkMustUnderstandHeaders(XMLStreamReader reader,
+ MessageInfo mi, HandlerContext context) {
+
+ // Decode envelope
+ XMLStreamReaderUtil.verifyReaderState(reader, START_ELEMENT);
+ QName got = reader.getName();
+ QName exp = getEnvelopeTag();
+ if (got.getLocalPart().equals(exp.getLocalPart())) {
+ if (!got.getNamespaceURI().equals(exp.getNamespaceURI())) {
+ raiseFault(getVersionMismatchFaultCode(),
+ "Invalid SOAP envelope version");
+ }
+ }
+ XMLStreamReaderUtil.verifyTag(reader, getEnvelopeTag());
+ XMLStreamReaderUtil.nextElementContent(reader);
+
+
+ XMLStreamReaderUtil.verifyReaderState(reader, START_ELEMENT);
+ if (!SOAPNamespaceConstants.TAG_HEADER.equals(reader.getLocalName())) {
+ return; // No Header, no MU processing
+ }
+ XMLStreamReaderUtil.verifyTag(reader, getHeaderTag());
+ XMLStreamReaderUtil.nextElementContent(reader);
+
+ RuntimeContext rtCtxt = MessageInfoUtil.getRuntimeContext(mi);
+
+ // start with just the endpoint roles
+ Set<String> roles = new HashSet<String>();
+ roles.addAll(getRequiredRoles());
+ HandlerChainCaller hcCaller = MessageInfoUtil.getHandlerChainCaller(mi);
+ if (hcCaller != null) {
+ roles.addAll(hcCaller.getRoles());
+ }
+
+ if (logger.isLoggable(Level.FINEST)) {
+ logger.finest("roles:");
+ for (String r : roles) {
+ logger.finest("\t\"" + r + "\"");
+ }
+ }
+
+ // keep set=null if there are no understood headers
+ Set<QName> understoodHeaders = null;
+ if (rtCtxt != null) {
+ SOAPRuntimeModel model = (SOAPRuntimeModel) rtCtxt.getModel();
+ if (model != null && model.getKnownHeaders() != null) {
+ understoodHeaders = new HashSet<QName>(
+ ((SOAPRuntimeModel) rtCtxt.getModel()).getKnownHeaders());
+ }
+ }
+ if (understoodHeaders == null) {
+ if (hcCaller != null) {
+ understoodHeaders = hcCaller.getUnderstoodHeaders();
+ }
+ } else {
+ if (hcCaller != null) {
+ understoodHeaders.addAll(hcCaller.getUnderstoodHeaders());
+ }
+ }
+
+ if (logger.isLoggable(Level.FINEST)) {
+ logger.finest("understood headers:");
+ if (understoodHeaders == null || understoodHeaders.isEmpty()) {
+ logger.finest("\tnone");
+ } else {
+ for (QName nameX : understoodHeaders) {
+ logger.finest("\t" + nameX.toString());
+ }
+ }
+ }
+
+ checkHeadersAgainstKnown(reader, roles, understoodHeaders, mi);
+
+ XMLStreamReaderUtil.verifyReaderState(reader, END_ELEMENT);
+ XMLStreamReaderUtil.verifyTag(reader, getHeaderTag());
+ XMLStreamReaderUtil.nextElementContent(reader);
+ }
+
+ /*
+ * This method is overridden for other bindings
+ */
+ protected void checkHeadersAgainstKnown(XMLStreamReader reader,
+ Set<String> roles, Set<QName>
understoodHeaders, MessageInfo mi) {
+
+ while (true) {
+ if (reader.getEventType() == START_ELEMENT) {
+ // check MU header for each role
+ QName qName = reader.getName();
+ String mu = reader.getAttributeValue(
+ getMUAttrQName().getNamespaceURI(),
+ getMUAttrQName().getLocalPart());
+ if (mu != null && (mu.equals("1") ||
+ mu.equalsIgnoreCase("true"))) {
+ String role = reader.getAttributeValue(
+ getRoleAttrQName().getNamespaceURI(),
+ getRoleAttrQName().getLocalPart());
+ if (role != null && roles.contains(role)) {
+ logger.finest("Element=" + qName +
+ " targeted at=" + role);
+ if (understoodHeaders == null ||
+ !understoodHeaders.contains(qName)) {
+ logger.finest("Element not understood=" + qName);
+
+ SOAPFault sf = SOAPUtil.createSOAPFault(
+ MUST_UNDERSTAND_FAULT_MESSAGE_STRING,
+ SOAPConstants.FAULT_CODE_MUST_UNDERSTAND,
+ role, null, SOAPBinding.SOAP11HTTP_BINDING);
+ throw new SOAPFaultException(sf);
+ }
+ }
+ }
+ XMLStreamReaderUtil.skipElement(reader); // Moves to END state
+ XMLStreamReaderUtil.nextElementContent(reader);
+ } else {
+ break;
+ }
+ }
+ }
+
+ protected boolean isDispatch(MessageInfo messageInfo) {
+
+ DispatchContext context = (DispatchContext)
+ messageInfo.getMetaData(BindingProviderProperties.DISPATCH_CONTEXT);
+ if (context != null)
+ return true;
+ return false;
+ }
+
+ protected String getSOAPMessageCharsetEncoding(SOAPMessage sm) throws SOAPException
{
+ String charset = (String) sm.getProperty(SOAPMessage.CHARACTER_SET_ENCODING);
+ return (charset != null) ? charset : "UTF-8";
+ }
+
+ protected final void raiseFault(QName faultCode, String faultString) {
+ throw new SOAPFaultException(SOAPUtil.createSOAPFault(faultString, faultCode,
null, null, getBindingId()));
+ }
+
+ protected void raiseBadXMLFault(HandlerContext ctxt) {
+ }
+
+ protected abstract QName getSenderFaultCode();
+
+ protected abstract QName getReceiverFaultCode();
+
+ protected abstract QName getVersionMismatchFaultCode();
+
+ public abstract String getBindingId();
+
+ private final static String DUPLICATE_HEADER =
+ "Duplicate Header in the message:";
+
+ public DispatchUtil getDispatchUtil() {
+ return dispatchUtil;
+ }
+
+ protected DispatchUtil dispatchUtil = new DispatchUtil();
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/SOAPDecoder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/SOAPEPTFactory.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/SOAPEPTFactory.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/SOAPEPTFactory.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,42 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.encoding.soap;
+
+import org.jboss.com.sun.xml.ws.encoding.internal.InternalEncoder;
+import org.jboss.com.sun.xml.ws.encoding.jaxb.*;
+
+/**
+ * Change the name of this class to JaxwsEPTFactory or something else. OR
+ * split into multiple factories.
+ */
+public interface SOAPEPTFactory {
+ public InternalEncoder getInternalEncoder();
+
+ /**
+ * @return the SOAPEncoder
+ */
+ public SOAPEncoder getSOAPEncoder();
+ /**
+ * @return the SOAPDecoder
+ */
+ public SOAPDecoder getSOAPDecoder();
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/SOAPEPTFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/SOAPEncoder.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/SOAPEncoder.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/SOAPEncoder.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,779 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.encoding.soap;
+
+import com.sun.xml.bind.api.BridgeContext;
+import com.sun.xml.bind.api.JAXBRIContext;
+
+import static
org.jboss.com.sun.xml.ws.client.BindingProviderProperties.JAXB_OUTPUTSTREAM;
+
+import org.jboss.com.sun.xml.ws.client.BindingProviderProperties;
+import org.jboss.com.sun.xml.ws.client.ContextMap;
+import org.jboss.com.sun.xml.ws.client.RequestContext;
+import org.jboss.com.sun.xml.ws.client.dispatch.DispatchContext;
+import org.jboss.com.sun.xml.ws.developer.JAXWSProperties;
+import org.jboss.com.sun.xml.ws.encoding.JAXWSAttachmentMarshaller;
+import org.jboss.com.sun.xml.ws.encoding.JAXWSAttachmentUnmarshaller;
+import org.jboss.com.sun.xml.ws.encoding.jaxb.JAXBBeanInfo;
+import org.jboss.com.sun.xml.ws.encoding.jaxb.JAXBBridgeInfo;
+import org.jboss.com.sun.xml.ws.encoding.jaxb.RpcLitPayload;
+import org.jboss.com.sun.xml.ws.encoding.jaxb.RpcLitPayloadSerializer;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.*;
+import org.jboss.com.sun.xml.ws.encoding.soap.message.SOAPFaultInfo;
+import org.jboss.com.sun.xml.ws.encoding.soap.streaming.SOAPNamespaceConstants;
+import org.jboss.com.sun.xml.ws.handler.HandlerContext;
+import org.jboss.com.sun.xml.ws.handler.SOAPHandlerContext;
+import org.jboss.com.sun.xml.ws.pept.encoding.Encoder;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.pept.presentation.MessageStruct;
+import org.jboss.com.sun.xml.ws.server.RuntimeContext;
+import org.jboss.com.sun.xml.ws.server.ServerRtException;
+import org.jboss.com.sun.xml.ws.spi.runtime.InternalSoapEncoder;
+import org.jboss.com.sun.xml.ws.spi.runtime.MtomCallback;
+import org.jboss.com.sun.xml.ws.streaming.SourceReaderFactory;
+import org.jboss.com.sun.xml.ws.streaming.XMLStreamWriterFactory;
+import org.jboss.com.sun.xml.ws.util.ByteArrayBuffer;
+import org.jboss.com.sun.xml.ws.util.DOMUtil;
+import org.jboss.com.sun.xml.ws.util.MessageInfoUtil;
+import org.jboss.com.sun.xml.ws.util.xml.XmlUtil;
+import org.w3c.dom.Document;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.soap.SOAPBinding;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author WS Development Team
+ */
+public abstract class SOAPEncoder implements Encoder, InternalSoapEncoder {
+
+ /*
+ * @see Encoder#encodeAndSend(MessageInfo)
+ */
+ public void encodeAndSend(MessageInfo messageInfo) {
+ throw new UnsupportedOperationException();
+ }
+
+ /*
+ * @see Encoder#encode(MessageInfo)
+ */
+ public ByteBuffer encode(MessageInfo messageInfo) {
+ throw new UnsupportedOperationException();
+ }
+
+ public InternalMessage toInternalMessage(MessageInfo messageInfo) {
+ return null;
+ }
+
+ public DOMSource toDOMSource(JAXBBridgeInfo bridgeInfo, MessageInfo messageInfo) {
+ RuntimeContext rtCtxt = MessageInfoUtil.getRuntimeContext(messageInfo);
+ BridgeContext bridgeContext = rtCtxt.getBridgeContext();
+ Document doc = DOMUtil.createDom();
+ bridgeInfo.serialize(bridgeContext, doc);
+ return new DOMSource(doc);
+ }
+
+ public DOMSource toDOMSource(RpcLitPayload rpcLitPayload, MessageInfo messageInfo) {
+ try {
+ ByteArrayBuffer baos = new ByteArrayBuffer();
+ XMLStreamWriter writer = XMLStreamWriterFactory.createXMLStreamWriter(baos);
+ writeRpcLitPayload(rpcLitPayload, messageInfo, writer);
+ writer.close();
+ baos.close();
+ Transformer transformer = XmlUtil.newTransformer();
+ StreamSource source = new StreamSource(baos.newInputStream());
+ DOMResult domResult = new DOMResult();
+ transformer.transform(source, domResult);
+ return new DOMSource(domResult.getNode());
+ } catch (TransformerException te) {
+ throw new WebServiceException(te);
+ } catch (XMLStreamException e) {
+ throw new WebServiceException(e);
+ }
+ }
+
+ public DOMSource toDOMSource(SOAPFaultInfo faultInfo, MessageInfo messageInfo) {
+ try {
+ ByteArrayBuffer baos = new ByteArrayBuffer();
+ XMLStreamWriter writer = XMLStreamWriterFactory.createXMLStreamWriter(baos);
+ writeFault(faultInfo, messageInfo, writer);
+ writer.writeEndDocument();
+ writer.close();
+ baos.close();
+ Transformer transformer = XmlUtil.newTransformer();
+ StreamSource source = new StreamSource(baos.newInputStream());
+ DOMResult domResult = new DOMResult();
+ transformer.transform(source, domResult);
+ return new DOMSource(domResult.getNode());
+ }
+ catch (TransformerException te) {
+ throw new WebServiceException(te);
+ }
+ catch (XMLStreamException xe) {
+ throw new WebServiceException(xe);
+ }
+ }
+
+ protected void writeRpcLitPayload(RpcLitPayload rpcLitPayload, MessageInfo
messageInfo,
+ XMLStreamWriter writer) {
+ RuntimeContext rtCtxt = MessageInfoUtil.getRuntimeContext(messageInfo);
+ BridgeContext bridgeContext = rtCtxt.getBridgeContext();
+ RpcLitPayloadSerializer.serialize(rpcLitPayload, bridgeContext, messageInfo,
writer);
+ }
+
+ protected void writeRpcLitPayload(RpcLitPayload rpcLitPayload, MessageInfo
messageInfo,
+ OutputStream writer) {
+ RuntimeContext rtCtxt = MessageInfoUtil.getRuntimeContext(messageInfo);
+ BridgeContext bridgeContext = rtCtxt.getBridgeContext();
+ RpcLitPayloadSerializer.serialize(rpcLitPayload, bridgeContext, writer);
+ }
+ protected JAXBContext getJAXBContext(MessageInfo messageInfo) {
+ JAXBContext jc = null;
+ RequestContext context = (RequestContext)
messageInfo.getMetaData(BindingProviderProperties.JAXWS_CONTEXT_PROPERTY);
+ if (context != null)
+ jc = (JAXBContext)
context.get(BindingProviderProperties.JAXB_CONTEXT_PROPERTY);
+
+ return jc;
+ }
+
+ private void writeJAXBBeanInfo(JAXBBeanInfo beanInfo, MessageInfo messageInfo,
+ XMLStreamWriter writer) {
+ // Pass output stream directly to JAXB when available
+ OutputStream os = (OutputStream) messageInfo.getMetaData(JAXB_OUTPUTSTREAM);
+
+ Marshaller m = (Marshaller)
messageInfo.getMetaData(BindingProviderProperties.DISPATCH_MARSHALLER);
+ Unmarshaller u = (Unmarshaller)
messageInfo.getMetaData(BindingProviderProperties.DISPATCH_UNMARSHALLER);
+ beanInfo.setMarshallers(m, u);
+
+ if (os != null) {
+ try {
+ /*
+ * Make sure that current element is closed before passing the
+ * output stream to JAXB. Using Zephyr, it suffices to write
+ * an empty string (TODO: other StAX impls?).
+ */
+ writer.writeCharacters("");
+
+ // Flush output of StAX serializer
+ writer.flush();
+ }
+ catch (XMLStreamException e) {
+ throw new WebServiceException(e);
+ }
+
+ beanInfo.writeTo(os);
+
+ } else {
+
+ beanInfo.writeTo(writer);
+ }
+ }
+
+ private void writeJAXBBeanInfo(JAXBBeanInfo beanInfo, OutputStream writer) {
+ beanInfo.writeTo(writer);
+ }
+
+ /*
+ protected void writeJAXBTypeInfo(JAXBTypeInfo typeInfo, XMLStreamWriter writer) {
+ QName name = typeInfo.getName();
+ Object value = typeInfo.getType();
+ writeJAXBTypeInfo(name, value, writer);
+ }
+
+
+ protected void writeJAXBTypeInfo(QName name, Object value, XMLStreamWriter writer) {
+ JAXBContext jaxbContext = encoderDecoderUtil.getJAXBContext();
+ Map<QName, Class> typeMapping = encoderDecoderUtil.getTypeMapping();
+ Class type = typeMapping.get(name);
+ JAXBTypeSerializer.getInstance().serialize(name, type, value,
+ writer, jaxbContext);
+ }
+ */
+
+ protected void writeJAXBBridgeInfo(JAXBBridgeInfo bridgeInfo,
+ MessageInfo messageInfo, XMLStreamWriter writer)
{
+ RuntimeContext rtCtxt = MessageInfoUtil.getRuntimeContext(messageInfo);
+ BridgeContext bridgeContext = rtCtxt.getBridgeContext();
+
+ // Pass output stream directly to JAXB when available
+ OutputStream os = (OutputStream) messageInfo.getMetaData(JAXB_OUTPUTSTREAM);
+ if (os != null) {
+ try {
+ /*
+ * Make sure that current element is closed before passing the
+ * output stream to JAXB. Using Zephyr, it suffices to write
+ * an empty string (TODO: other StAX impls?).
+ */
+ writer.writeCharacters("");
+
+ // Flush output of StAX serializer
+ writer.flush();
+ }
+ catch (XMLStreamException e) {
+ throw new WebServiceException(e);
+ }
+
+ bridgeInfo.serialize(bridgeContext, os, writer.getNamespaceContext());
+ } else {
+ bridgeInfo.serialize(bridgeContext, writer);
+ }
+ }
+
+ protected void writeJAXBBridgeInfo(JAXBBridgeInfo bridgeInfo,
+ MessageInfo messageInfo, OutputStream writer) {
+ RuntimeContext rtCtxt = MessageInfoUtil.getRuntimeContext(messageInfo);
+ BridgeContext bridgeContext = rtCtxt.getBridgeContext();
+ bridgeInfo.serialize(bridgeContext, writer, null);
+ }
+
+
+ public SOAPMessage toSOAPMessage(InternalMessage internalMessage, MessageInfo
messageInfo) {
+ return null;
+ }
+
+ /*
+ * Replace the body in SOAPMessage with the BodyBlock of InternalMessage
+ */
+ public SOAPMessage toSOAPMessage(InternalMessage internalMessage,
+ SOAPMessage soapMessage) {
+ try {
+ BodyBlock bodyBlock = internalMessage.getBody();
+ if (bodyBlock == null)
+ return soapMessage;
+ Object value = bodyBlock.getValue();
+ if (value == null) {
+ return soapMessage;
+ }
+ if (value instanceof Source) {
+ Source source = (Source) value;
+ SOAPBody body = soapMessage.getSOAPBody();
+ body.removeContents();
+
+ Transformer transformer = XmlUtil.newTransformer();
+ transformer.transform(source, new DOMResult(body));
+ } else {
+ throw new UnsupportedOperationException("Unknown object in
BodyBlock:" + value.getClass());
+ }
+ return soapMessage;
+ } catch (Exception e) {
+ throw new ServerRtException("soapencoder.err", new Object[]{e});
+ }
+ }
+
+ public static void serializeReader(XMLStreamReader reader, XMLStreamWriter writer) {
+ try {
+ int state;
+ do {
+ state = reader.next();
+ switch (state) {
+ case XMLStreamConstants.START_ELEMENT:
+ /*
+ * TODO: Is this necessary, shouldn't zephyr return
"" instead of
+ * null for getNamespaceURI() and getPrefix()?
+ */
+ String uri = reader.getNamespaceURI();
+ String prefix = reader.getPrefix();
+ String localName = reader.getLocalName();
+
+ if (prefix == null) {
+ if (uri == null) {
+ writer.writeStartElement(localName);
+ } else {
+ writer.writeStartElement(uri, localName);
+ }
+ } else {
+ assert uri != null;
+
+ if (prefix.length() > 0) {
+ /**
+ * Before we write the
+ */
+ String writerURI = null;
+ if (writer.getNamespaceContext() != null)
+ writerURI =
writer.getNamespaceContext().getNamespaceURI(prefix);
+ String writerPrefix = writer.getPrefix(uri);
+ if (declarePrefix(prefix, uri, writerPrefix, writerURI))
+ {
+ writer.writeStartElement(prefix, localName, uri);
+ writer.setPrefix(prefix, uri != null ? uri :
"");
+ writer.writeNamespace(prefix, uri);
+ } else {
+ writer.writeStartElement(prefix, localName, uri);
+ }
+ } else {
+ writer.writeStartElement(prefix, localName, uri);
+ }
+ }
+
+ int n = reader.getNamespaceCount();
+ // Write namespace declarations
+ for (int i = 0; i < n; i++) {
+ String nsPrefix = reader.getNamespacePrefix(i);
+ if (nsPrefix == null) nsPrefix = "";
+ // StAX returns null for default ns
+ String writerURI = null;
+ if (writer.getNamespaceContext() != null)
+ writerURI =
writer.getNamespaceContext().getNamespaceURI(nsPrefix);
+
+ // Zephyr: Why is this returning null?
+ // Compare nsPrefix with prefix because of [1] (above)
+ String readerURI = reader.getNamespaceURI(i);
+
+ /**
+ * write the namespace in 3 conditions
+ * - when the namespace URI is not bound to the prefix in
writer(writerURI == 0)
+ * - when the readerPrefix and writerPrefix are
""
+ * - when readerPrefix and writerPrefix are not equal and
the URI bound to them
+ * are different
+ */
+ if (writerURI == null || ((nsPrefix.length() == 0) ||
(prefix.length() == 0)) ||
+ (!nsPrefix.equals(prefix) &&
!writerURI.equals(readerURI)))
+ {
+ writer.setPrefix(nsPrefix, readerURI != null ? readerURI
: "");
+ writer.writeNamespace(nsPrefix, readerURI != null ?
readerURI : "");
+ }
+ }
+
+ // Write attributes
+ n = reader.getAttributeCount();
+ for (int i = 0; i < n; i++) {
+ String attrPrefix = reader.getAttributePrefix(i);
+ String attrURI = reader.getAttributeNamespace(i);
+
+ writer.writeAttribute(attrPrefix != null ? attrPrefix :
"",
+ attrURI != null ? attrURI : "",
+ reader.getAttributeLocalName(i),
+ reader.getAttributeValue(i));
+ // if the attribute prefix is undeclared in current writer
scope then declare it
+ setUndeclaredPrefix(attrPrefix, attrURI, writer);
+ }
+ break;
+ case XMLStreamConstants.END_ELEMENT:
+ writer.writeEndElement();
+ break;
+ case XMLStreamConstants.CHARACTERS:
+ writer.writeCharacters(reader.getText());
+ }
+ } while (state != XMLStreamConstants.END_DOCUMENT);
+ }
+ catch (XMLStreamException e) {
+ throw new WebServiceException(e);
+ }
+ }
+
+ /**
+ * sets undeclared prefixes on the writer
+ *
+ * @param prefix
+ * @param writer
+ * @throws XMLStreamException
+ */
+ private static void setUndeclaredPrefix(String prefix, String readerURI,
XMLStreamWriter writer) throws XMLStreamException {
+ String writerURI = null;
+ if (writer.getNamespaceContext() != null)
+ writerURI = writer.getNamespaceContext().getNamespaceURI(prefix);
+
+ if (writerURI == null) {
+ writer.setPrefix(prefix, readerURI != null ? readerURI : "");
+ writer.writeNamespace(prefix, readerURI != null ? readerURI : "");
+ }
+ }
+
+ /**
+ * check if we need to declare
+ *
+ * @param rPrefix
+ * @param rUri
+ * @param wPrefix
+ * @param wUri
+ * @return
+ */
+ private static boolean declarePrefix(String rPrefix, String rUri, String wPrefix,
String wUri) {
+ if (wUri == null || ((wPrefix != null) && !rPrefix.equals(wPrefix)) ||
+ (rUri != null && !wUri.equals(rUri)))
+ return true;
+ return false;
+ }
+
+ protected void serializeSource(Source source, XMLStreamWriter writer) {
+ try {
+ XMLStreamReader reader = SourceReaderFactory.createSourceReader(source,
true);
+ serializeReader(reader, writer);
+ reader.close();
+ }
+ catch (XMLStreamException e) {
+ throw new WebServiceException(e);
+ }
+ }
+
+ protected void serializeSource(Source source, OutputStream writer) {
+ try {
+ Transformer t = XmlUtil.newTransformer();
+ t.transform(source, new StreamResult(writer));
+ }
+ catch (Exception e) {
+ throw new WebServiceException(e);
+ }
+ }
+
+ /*
+ * writes start tag of envelope: <env:Envelope>
+ */
+ protected void startEnvelope(XMLStreamWriter writer) {
+ try {
+ //write SOAP Envelope
+ writer.writeStartElement(SOAPNamespaceConstants.NSPREFIX_SOAP_ENVELOPE,
+ SOAPNamespaceConstants.TAG_ENVELOPE, SOAPNamespaceConstants.ENVELOPE);
+ writer.setPrefix(SOAPNamespaceConstants.NSPREFIX_SOAP_ENVELOPE,
+ SOAPNamespaceConstants.ENVELOPE);
+ writer.writeNamespace(SOAPNamespaceConstants.NSPREFIX_SOAP_ENVELOPE,
+ SOAPNamespaceConstants.ENVELOPE);
+ }
+ catch (XMLStreamException e) {
+ throw new WebServiceException(e);
+ }
+ }
+
+ /*
+ * write the known namespace declaration to the envelope
+ */
+ protected void writeEnvelopeNamespaces(XMLStreamWriter writer, MessageInfo
messageInfo)
+ throws XMLStreamException {
+
+ RuntimeContext rtCtxt = MessageInfoUtil.getRuntimeContext(messageInfo);
+ if (rtCtxt != null && rtCtxt.getModel() != null) {
+ writer.setPrefix("xsd", SOAPNamespaceConstants.XSD);
+ writer.writeNamespace("xsd", SOAPNamespaceConstants.XSD);
+ int i = 1;
+ String prefix;
+ for (String namespace : rtCtxt.getModel().getKnownNamespaceURIs()) {
+ prefix = "ns" + i++;
+ writer.setPrefix(prefix, namespace);
+ writer.writeNamespace(prefix, namespace);
+ }
+ writer.writeCharacters("");
+ }
+ }
+
+ /*
+ * writes start tag of Body: <env:Body>
+ */
+ protected void startBody(XMLStreamWriter writer) {
+ try {
+ //write SOAP Body
+ writer.writeStartElement(SOAPNamespaceConstants.NSPREFIX_SOAP_ENVELOPE,
+ SOAPNamespaceConstants.TAG_BODY, SOAPNamespaceConstants.ENVELOPE);
+ }
+ catch (XMLStreamException e) {
+ throw new WebServiceException(e);
+ }
+ }
+
+ /*
+ * writes start tag of Header: <env:Header>
+ */
+ protected void startHeader(XMLStreamWriter writer) {
+ try {
+ writer.writeStartElement(SOAPNamespaceConstants.NSPREFIX_SOAP_ENVELOPE,
+ SOAPNamespaceConstants.TAG_HEADER, SOAPNamespaceConstants.ENVELOPE); //
<env:Header>
+ }
+ catch (XMLStreamException e) {
+ throw new WebServiceException(e);
+ }
+ }
+
+ /*
+ * writes multiple header elements in <env:Header> ... </env:Header>
+ */
+ protected void writeHeaders(XMLStreamWriter writer, InternalMessage response,
+ MessageInfo messageInfo) {
+ try {
+ List<HeaderBlock> headerBlocks = response.getHeaders();
+ if (headerBlocks == null || headerBlocks.isEmpty()) {
+ return;
+ }
+ startHeader(writer); // <env:Header>
+ for (HeaderBlock headerBlock : headerBlocks) {
+ Object value = headerBlock.getValue();
+ if (value != null) {
+ if (value instanceof JAXBBridgeInfo) {
+ writeJAXBBridgeInfo((JAXBBridgeInfo) value,
+ messageInfo, writer);
+ } else {
+ throw new SerializationException("unknown.object",
+ value.getClass().getName());
+ }
+ } else {
+ // currently only in soap 1.2
+ if (headerBlock instanceof SOAP12NotUnderstoodHeaderBlock) {
+ ((SOAP12NotUnderstoodHeaderBlock) headerBlock).write(
+ writer);
+ }
+ }
+ }
+ writer.writeEndElement(); //
</env:Header>
+ }
+ catch (XMLStreamException e) {
+ throw new WebServiceException(e);
+ }
+ }
+
+ /*
+ * writes <env:Body> ... </env:Body>
+ */
+ protected void writeBody(XMLStreamWriter writer, InternalMessage response,
+ MessageInfo messageInfo) {
+ try {
+ startBody(writer);
+ BodyBlock bodyBlock = response.getBody();
+ // BodyBlock can be null if there is no part in wsdl:message
+ if (bodyBlock != null) {
+ Object value = bodyBlock.getValue();
+ if (value instanceof JAXBBridgeInfo) {
+ writeJAXBBridgeInfo((JAXBBridgeInfo) value, messageInfo, writer);
+ } else if (value instanceof RpcLitPayload) {
+ writeRpcLitPayload((RpcLitPayload) value, messageInfo, writer);
+ } else if (value instanceof Source) {
+ serializeSource((Source) value, writer);
+ } else if (value instanceof SOAPFaultInfo) {
+ writeFault((SOAPFaultInfo) value, messageInfo, writer);
+ } else if (value instanceof JAXBBeanInfo) {
+
+ if (((JAXBBeanInfo)value).getBean() != null &&
(DispatchContext)
+ messageInfo.getMetaData(BindingProviderProperties.DISPATCH_CONTEXT)
!= null)
+ writeJAXBBeanInfo((JAXBBeanInfo) value, messageInfo, writer);
+ } else if (value == null && (DispatchContext)
+ messageInfo.getMetaData(BindingProviderProperties.DISPATCH_CONTEXT)
!= null) {
+ //bug 6400596 -Dispatch and null invocation parameter payload mode
+ //can skip this here as we want to write and empty SOAPBody
+ //writeJAXBBeanInfo((JAXBBeanInfo) value, messageInfo, writer);
+ } else {
+ throw new SerializationException("unknown.object",
+ value.getClass().getName());
+ }
+ }
+ writer.writeEndElement(); // </env:body>
+ }
+ catch (XMLStreamException e) {
+ throw new WebServiceException(e);
+ }
+ }
+
+ /**
+ * Pass reference of attachments Map from InternalMessage to
JAXWSAttachmentMarshaller.
+ *
+ * @param mi
+ * @param im
+ */
+ public void setAttachmentsMap(MessageInfo mi, InternalMessage im) {
+ Object rtc = mi.getMetaData(BindingProviderProperties.JAXWS_RUNTIME_CONTEXT);
+ if (rtc != null) {
+ BridgeContext bc = ((RuntimeContext) rtc).getBridgeContext();
+ if (bc == null)
+ return;
+ JAXWSAttachmentMarshaller am = (JAXWSAttachmentMarshaller)
bc.getAttachmentMarshaller();
+ am.setAttachments(im.getAttachments());
+ am.setHandlerContaxt(((RuntimeContext) rtc).getHandlerContext());
+
+ HandlerContext hc = ((RuntimeContext) rtc).getHandlerContext();
+ Object mtomThreshold;
+ if (hc == null) {
+ //to be removed when client guarantees handlerContext
+ mtomThreshold = mi.getMetaData(JAXWSProperties.MTOM_THRESHOLOD_VALUE);
+ } else {
+ mtomThreshold =
hc.getMessageContext().get(JAXWSProperties.MTOM_THRESHOLOD_VALUE);
+ }
+ if (mtomThreshold != null)
+ am.setMtomThresholdValue((Integer) mtomThreshold);
+ } else if (mi.getMetaData(BindingProviderProperties.DISPATCH_CONTEXT) != null){
+ ContextMap map = (ContextMap)
mi.getMetaData(BindingProviderProperties.JAXWS_CONTEXT_PROPERTY);
+ BindingProvider provider = (BindingProvider)
+ map.get(BindingProviderProperties.JAXWS_CLIENT_HANDLE_PROPERTY);
+
+ JAXBContext jc = (JAXBContext)
map.get(BindingProviderProperties.JAXB_CONTEXT_PROPERTY);
+
+ if (jc != null) {
+ try {
+ Marshaller m = jc.createMarshaller();
+ Unmarshaller um = jc.createUnmarshaller();
+ JAXWSAttachmentMarshaller am =
+ new JAXWSAttachmentMarshaller(((SOAPBinding)
provider.getBinding()).isMTOMEnabled());
+ JAXWSAttachmentUnmarshaller uam = new JAXWSAttachmentUnmarshaller();
+ am.setAttachments(im.getAttachments());
+ m.setAttachmentMarshaller(am);
+ um.setAttachmentUnmarshaller(uam);
+ mi.setMetaData(BindingProviderProperties.DISPATCH_MARSHALLER, m);
+ mi.setMetaData(BindingProviderProperties.DISPATCH_UNMARSHALLER, um);
+ //set handlerContext
+ am.setHandlerContaxt((SOAPHandlerContext)
+
mi.getMetaData(BindingProviderProperties.JAXWS_HANDLER_CONTEXT_PROPERTY));
+
+ HandlerContext hc =
+
(HandlerContext)mi.getMetaData(BindingProviderProperties.JAXWS_HANDLER_CONTEXT_PROPERTY);
+ //set XOP optimization to true for jaxb
+
am.setXOPPackage(((SOAPBinding)provider.getBinding()).isMTOMEnabled());
+
uam.setXOPPackage(((SOAPBinding)provider.getBinding()).isMTOMEnabled());
+
+ Object mtomThreshold;
+ if (hc == null) {
+ //to be removed when client guarantees handlerContext
+ mtomThreshold =
mi.getMetaData(JAXWSProperties.MTOM_THRESHOLOD_VALUE);
+ } else {
+ mtomThreshold =
hc.getMessageContext().get(JAXWSProperties.MTOM_THRESHOLOD_VALUE);
+ }
+ if (mtomThreshold != null)
+ am.setMtomThresholdValue((Integer) mtomThreshold);
+ } catch (Exception e) {
+ throw new WebServiceException(e);
+ }
+
+ }
+
+ }
+ }
+
+ /**
+ * Add all the attachments in the InternalMessage to the SOAPMessage
+ *
+ * @param im
+ * @param msg
+ */
+ protected void processAttachments(InternalMessage im, SOAPMessage msg) throws
SOAPException {
+ for (Map.Entry<String, AttachmentBlock> e : im.getAttachments().entrySet())
{
+ AttachmentBlock block = e.getValue();
+ block.addTo(msg);
+ }
+ }
+
+ /*
+ * writes end tag of envelope: </env:Envelope>
+ */
+ protected void endEnvelope(XMLStreamWriter writer) {
+ try {
+ writer.writeEndElement();
+ }
+ catch (XMLStreamException e) {
+ throw new WebServiceException(e);
+ }
+ }
+
+ protected void writeFault(SOAPFaultInfo instance, MessageInfo messageInfo,
XMLStreamWriter writer) {
+ throw new UnsupportedOperationException();
+ }
+
+ protected void writeFault(SOAPFaultInfo instance, MessageInfo messageInfo,
OutputStream out) {
+ XMLStreamWriter writer = XMLStreamWriterFactory.createXMLStreamWriter(out);
+ writeFault(instance, messageInfo, writer);
+ }
+
+
+ public void write(Object value, Object obj, OutputStream writer, MtomCallback
mtomCallback) {
+ if (!(obj instanceof MessageInfo))
+ throw new SerializationException("incorrect.messageinfo",
obj.getClass().getName());
+ MessageInfo mi = (MessageInfo) obj;
+ Object rtc = mi.getMetaData(BindingProviderProperties.JAXWS_RUNTIME_CONTEXT);
+ if (rtc != null) {
+ BridgeContext bc = ((RuntimeContext) rtc).getBridgeContext();
+ if (bc != null) {
+ JAXWSAttachmentMarshaller am = (JAXWSAttachmentMarshaller)
+ ((RuntimeContext)
rtc).getBridgeContext().getAttachmentMarshaller();
+ am.setMtomCallback(mtomCallback);
+ }
+ } else {
+ //dispatch
+ Marshaller m =
(Marshaller)mi.getMetaData(BindingProviderProperties.DISPATCH_MARSHALLER);
+ if (m != null) {
+ JAXWSAttachmentMarshaller am =
(JAXWSAttachmentMarshaller)m.getAttachmentMarshaller();
+ am.setMtomCallback(mtomCallback);
+ }
+ }
+ if (value instanceof JAXBBridgeInfo) {
+ writeJAXBBridgeInfo((JAXBBridgeInfo) value, mi, writer);
+ } else if (value instanceof RpcLitPayload) {
+ writeRpcLitPayload((RpcLitPayload) value, mi, writer);
+ } else if (value instanceof Source) {
+ serializeSource((Source) value, writer);
+ } else if (value instanceof SOAPFaultInfo) {
+ writeFault((SOAPFaultInfo) value, mi, writer);
+ } else if (value instanceof JAXBBeanInfo) {
+ writeJAXBBeanInfo((JAXBBeanInfo) value, writer);
+ } else {
+ throw new SerializationException("unknown.object",
value.getClass().getName());
+ }
+ }
+
+ public void write(Object value, Object obj, XMLStreamWriter writer, MtomCallback
mtomCallback) {
+ if (!(obj instanceof MessageInfo))
+ throw new SerializationException("incorrect.messageinfo",
obj.getClass().getName());
+ MessageInfo mi = (MessageInfo) obj;
+ Object rtc = mi.getMetaData(BindingProviderProperties.JAXWS_RUNTIME_CONTEXT);
+ if (rtc != null) {
+ BridgeContext bc = ((RuntimeContext) rtc).getBridgeContext();
+ if (bc != null) {
+ JAXWSAttachmentMarshaller am = (JAXWSAttachmentMarshaller)
((RuntimeContext) rtc).getBridgeContext().getAttachmentMarshaller();
+ am.setMtomCallback(mtomCallback);
+ }
+ } else {
+ //dispatch
+ Marshaller m =
(Marshaller)mi.getMetaData(BindingProviderProperties.DISPATCH_MARSHALLER);
+ if (m != null) {
+ JAXWSAttachmentMarshaller am =
(JAXWSAttachmentMarshaller)m.getAttachmentMarshaller();
+ am.setMtomCallback(mtomCallback);
+ }
+ }
+ if (value instanceof JAXBBridgeInfo) {
+ writeJAXBBridgeInfo((JAXBBridgeInfo) value, mi, writer);
+ } else if (value instanceof RpcLitPayload) {
+ writeRpcLitPayload((RpcLitPayload) value, mi, writer);
+ } else if (value instanceof Source) {
+ serializeSource((Source) value, writer);
+ } else if (value instanceof SOAPFaultInfo) {
+ writeFault((SOAPFaultInfo) value, mi, writer);
+ } else if (value instanceof JAXBBeanInfo) {
+ writeJAXBBeanInfo((JAXBBeanInfo) value, mi, writer);
+ } else {
+ throw new SerializationException("unknown.object",
value.getClass().getName());
+ }
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/SOAPEncoder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/SOAPVersion.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/SOAPVersion.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/SOAPVersion.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,50 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.encoding.soap;
+
+import javax.xml.ws.soap.SOAPBinding;
+
+
+/**
+ * @author WS Development Team
+ */
+
+public class SOAPVersion {
+
+ private final String version;
+
+ private SOAPVersion(String ver) {
+ this.version = ver;
+ }
+
+ public String toString() {
+ return this.version;
+ }
+
+ public boolean equals(String strVersion) {
+ return version.equals(strVersion);
+ }
+
+ public static final SOAPVersion SOAP_11 = new
SOAPVersion(SOAPBinding.SOAP11HTTP_BINDING);
+ public static final SOAPVersion SOAP_12 = new
SOAPVersion(SOAPBinding.SOAP12HTTP_BINDING);
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/SOAPVersion.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/SerializationException.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/SerializationException.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/SerializationException.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,53 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.encoding.soap;
+import org.jboss.com.sun.xml.ws.util.exception.JAXWSExceptionBase;
+import org.jboss.com.sun.xml.ws.util.localization.Localizable;
+
+/**
+ * SerializationException represents an exception that occurred while
+ * serializing a Java value as XML.
+ *
+ * @see JAXWSExceptionBase
+ *
+ * @author WS Development Team
+ */
+public class SerializationException extends JAXWSExceptionBase {
+
+ public SerializationException(String key, Object... args) {
+ super(key, args);
+ }
+
+ public SerializationException(Localizable arg) {
+ super("nestedSerializationError", arg);
+ }
+
+ public SerializationException(Throwable throwable) {
+ super(throwable);
+ }
+
+ public String getResourceBundleName() {
+ return "org.jboss.com.sun.xml.ws.resources.encoding";
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/SerializationException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/SerializerConstants.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/SerializerConstants.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/SerializerConstants.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,41 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+
+package org.jboss.com.sun.xml.ws.encoding.soap;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public interface SerializerConstants {
+ public static final boolean ENCODE_TYPE = true;
+ public static final boolean DONT_ENCODE_TYPE = false;
+ public static final boolean SERIALIZE_AS_REF = true;
+ public static final boolean DONT_SERIALIZE_AS_REF = false;
+ public static final boolean REFERENCEABLE = true;
+ public static final boolean NOT_REFERENCEABLE = false;
+ public static final boolean NULLABLE = true;
+ public static final boolean NOT_NULLABLE = false;
+ public static final boolean REFERENCED_INSTANCE = true;
+ public static final boolean UNREFERENCED_INSTANCE = false;
+}
\ No newline at end of file
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/SerializerConstants.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/ServerEncoderDecoder.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/ServerEncoderDecoder.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/ServerEncoderDecoder.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,235 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.encoding.soap;
+
+
+import javax.xml.ws.Holder;
+
+import org.jboss.com.sun.xml.ws.binding.BindingImpl;
+import org.jboss.com.sun.xml.ws.client.BindingProviderProperties;
+import org.jboss.com.sun.xml.ws.encoding.internal.InternalEncoder;
+import org.jboss.com.sun.xml.ws.encoding.jaxb.JAXBBridgeInfo;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.AttachmentBlock;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.BodyBlock;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.HeaderBlock;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.InternalMessage;
+import org.jboss.com.sun.xml.ws.model.CheckedException;
+import org.jboss.com.sun.xml.ws.model.ExceptionType;
+import org.jboss.com.sun.xml.ws.model.JavaMethod;
+import org.jboss.com.sun.xml.ws.model.Parameter;
+import org.jboss.com.sun.xml.ws.model.ParameterBinding;
+import org.jboss.com.sun.xml.ws.model.RuntimeModel;
+import org.jboss.com.sun.xml.ws.model.WrapperParameter;
+import org.jboss.com.sun.xml.ws.model.soap.SOAPBinding;
+import org.jboss.com.sun.xml.ws.model.soap.SOAPRuntimeModel;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.pept.presentation.MessageStruct;
+import org.jboss.com.sun.xml.ws.server.RuntimeContext;
+import org.jboss.com.sun.xml.ws.util.MessageInfoUtil;
+import org.jboss.com.sun.xml.ws.util.StringUtils;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Vivek Pandey
+ *
+ * Server SOAP encoder decoder
+ */
+public class ServerEncoderDecoder extends EncoderDecoder implements InternalEncoder {
+ public ServerEncoderDecoder() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.jboss.com.sun.xml.ws.encoding.util.EncoderDecoderBase#toMessageInfo(java.lang.Object,
+ * com.sun.pept.ept.MessageInfo)
+ */
+ public void toMessageInfo(Object intMessage, MessageInfo mi) {
+ InternalMessage im = (InternalMessage) intMessage;
+ RuntimeContext rtContext = (RuntimeContext)
mi.getMetaData(BindingProviderProperties.JAXWS_RUNTIME_CONTEXT);
+
+ BodyBlock bodyBlock = im.getBody();
+ JavaMethod jm = rtContext.getModel().getJavaMethod(mi.getMethod());
+ mi.setMEP(jm.getMEP());
+ List<HeaderBlock> headers = im.getHeaders();
+ Map<String, AttachmentBlock> attachments = im.getAttachments();
+
+ Iterator<Parameter> iter = jm.getRequestParameters().iterator();
+ Object bodyValue = (bodyBlock == null) ? null : bodyBlock.getValue();
+
+ int numInputParams = jm.getInputParametersCount();
+ Object data[] = new Object[numInputParams];
+ SOAPBinding soapBinding = (SOAPBinding)jm.getBinding();
+ while (iter.hasNext()) {
+ Parameter param = iter.next();
+ ParameterBinding paramBinding = param.getInBinding();
+ Object obj = null;
+ if (paramBinding.isBody()) {
+ obj = bodyValue;
+ } else if (headers != null && paramBinding.isHeader()) {
+ HeaderBlock header = getHeaderBlock(param.getName(), headers);
+ obj = (header != null)?header.getValue():null;
+ } else if (paramBinding.isAttachment()) {
+ obj = getAttachment(rtContext, attachments, param, paramBinding);
+ }
+ fillData(rtContext, param, obj, data, soapBinding, paramBinding);
+ }
+ Iterator<Parameter> resIter = jm.getResponseParameters().iterator();
+ while(resIter.hasNext()){
+ Parameter p = resIter.next();
+ createOUTHolders(p, data);
+ }
+ mi.setData(data);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.jboss.com.sun.xml.ws.encoding.util.EncoderDecoderBase#toInternalMessage(com.sun.pept.ept.MessageInfo)
+ */
+ public Object toInternalMessage(MessageInfo mi) {
+ RuntimeContext rtContext = MessageInfoUtil.getRuntimeContext(mi);
+ RuntimeModel model = rtContext.getModel();
+ JavaMethod jm = model.getJavaMethod(mi.getMethod());
+ Object[] data = mi.getData();
+ Object result = mi.getResponse();
+ InternalMessage im = new InternalMessage();
+ if(rtContext.getHandlerContext() != null){
+ copyAttachmentProperty(rtContext.getHandlerContext().getMessageContext(),
im);
+ }
+ BindingImpl bindingImpl =
+ (BindingImpl)rtContext.getRuntimeEndpointInfo().getBinding();
+ String bindingId = bindingImpl.getBindingId();
+
+ switch (mi.getResponseType()) {
+ case MessageStruct.CHECKED_EXCEPTION_RESPONSE:
+ if(!(result instanceof java.lang.Exception)){
+ throw new SerializationException("exception.incorrectType",
result.getClass().toString());
+ }
+ CheckedException ce = jm.getCheckedException(result.getClass());
+ if(ce == null){
+ throw new SerializationException("exception.notfound",
result.getClass().toString());
+ }
+ Object detail = getDetail(jm.getCheckedException(result.getClass()),
result);
+ JAXBBridgeInfo di = new
JAXBBridgeInfo(model.getBridge(ce.getDetailType()), detail);
+
+ if (bindingId.equals(javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING))
{
+ SOAPRuntimeModel.createFaultInBody(result, null, di, im);
+ } else if
(bindingId.equals(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING)){
+ SOAPRuntimeModel.createSOAP12FaultInBody(result, null, null, di,
im);
+ }
+
+ return im;
+ case MessageStruct.UNCHECKED_EXCEPTION_RESPONSE:
+ if (bindingId.equals(javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING))
+ SOAPRuntimeModel.createFaultInBody(result, getActor(), null, im);
+ else if
(bindingId.equals(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING))
+ SOAPRuntimeModel.createSOAP12FaultInBody(result, null, null, null,
im);
+ return im;
+ }
+
+ SOAPBinding soapBinding = (SOAPBinding)jm.getBinding();
+ Iterator<Parameter> iter = jm.getResponseParameters().iterator();
+ while (iter.hasNext()) {
+ Parameter param = iter.next();
+ ParameterBinding paramBinding = param.getOutBinding();
+ Object obj = createPayload(rtContext, param, data, result, soapBinding,
paramBinding);
+ if (paramBinding.isBody()) {
+ im.setBody(new BodyBlock(obj));
+ } else if (paramBinding.isHeader()) {
+ im.addHeader(new HeaderBlock((JAXBBridgeInfo)obj));
+ } else if (paramBinding.isAttachment()) {
+ addAttachmentPart(rtContext, im, obj, param);
+ }
+ }
+ return im;
+ }
+
+ private Object getDetail(CheckedException ce, Object exception) {
+ if(ce.getExceptionType().equals(ExceptionType.UserDefined)){
+ return createDetailFromUserDefinedException(ce, exception);
+ }
+ try {
+ Method m = exception.getClass().getMethod("getFaultInfo");
+ return m.invoke(exception);
+ } catch(Exception e){
+ throw new SerializationException(e);
+ }
+ }
+
+ private Object createDetailFromUserDefinedException(CheckedException ce, Object
exception) {
+ Class detailBean = ce.getDetailBean();
+ Field[] fields = detailBean.getDeclaredFields();
+ try {
+ Object detail = detailBean.newInstance();
+ for(Field f : fields){
+ Method em = exception.getClass().getMethod(getReadMethod(f));
+ Method sm = detailBean.getMethod(getWriteMethod(f), em.getReturnType());
+ sm.invoke(detail, em.invoke(exception));
+ }
+ return detail;
+ } catch(Exception e){
+ throw new SerializationException(e);
+ }
+ }
+
+ private String getReadMethod(Field f){
+ if(f.getType().isAssignableFrom(boolean.class))
+ return "is" + StringUtils.capitalize(f.getName());
+ return "get" + StringUtils.capitalize(f.getName());
+ }
+
+ private String getWriteMethod(Field f){
+ return "set" + StringUtils.capitalize(f.getName());
+ }
+
+ /**
+ * @return the actor
+ */
+ public String getActor() {
+ return null;
+ }
+
+ /**
+ * To be used by the incoming message on the server side to set the OUT
+ * holders with Holder instance.
+ *
+ * @param data
+ */
+ private void createOUTHolders(Parameter param, Object[] data) {
+ if(param.isWrapperStyle()){
+ for(Parameter p : ((WrapperParameter)param).getWrapperChildren()){
+ if(!p.isResponse() && p.isOUT())
+ data[p.getIndex()] = new Holder();
+ }
+ return;
+ }
+ //its BARE
+ if (!param.isResponse() && param.isOUT())
+ data[param.getIndex()] = new Holder();
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/ServerEncoderDecoder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/client/SOAP12XMLDecoder.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/client/SOAP12XMLDecoder.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/client/SOAP12XMLDecoder.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,349 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.encoding.soap.client;
+
+import com.sun.xml.bind.api.BridgeContext;
+
+import javax.xml.namespace.QName;
+import static javax.xml.stream.XMLStreamConstants.*;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.ws.soap.SOAPBinding;
+
+import org.jboss.com.sun.xml.ws.client.dispatch.impl.encoding.DispatchSerializer;
+import org.jboss.com.sun.xml.ws.encoding.jaxb.JAXBBridgeInfo;
+import org.jboss.com.sun.xml.ws.encoding.simpletype.EncoderUtils;
+import org.jboss.com.sun.xml.ws.encoding.soap.DeserializationException;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAP12Constants;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.HeaderBlock;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.InternalMessage;
+import org.jboss.com.sun.xml.ws.encoding.soap.message.FaultCode;
+import org.jboss.com.sun.xml.ws.encoding.soap.message.FaultCodeEnum;
+import org.jboss.com.sun.xml.ws.encoding.soap.message.FaultReason;
+import org.jboss.com.sun.xml.ws.encoding.soap.message.FaultReasonText;
+import org.jboss.com.sun.xml.ws.encoding.soap.message.FaultSubcode;
+import org.jboss.com.sun.xml.ws.encoding.soap.message.SOAP12FaultInfo;
+import org.jboss.com.sun.xml.ws.encoding.soap.message.SOAPFaultInfo;
+import org.jboss.com.sun.xml.ws.encoding.soap.streaming.SOAP12NamespaceConstants;
+import org.jboss.com.sun.xml.ws.encoding.soap.streaming.SOAPNamespaceConstants;
+import org.jboss.com.sun.xml.ws.model.soap.SOAPRuntimeModel;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.server.RuntimeContext;
+import org.jboss.com.sun.xml.ws.streaming.XMLStreamReaderUtil;
+import org.jboss.com.sun.xml.ws.util.MessageInfoUtil;
+import org.jboss.com.sun.xml.ws.util.xml.XmlUtil;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+import java.util.Set;
+import java.util.logging.Logger;
+
+/**
+ * @author WS Development Team
+ */
+public class SOAP12XMLDecoder extends SOAPXMLDecoder {
+
+ //needs further cleanup
+ private static final Logger logger =
+ Logger.getLogger (new StringBuffer ().append
(org.jboss.com.sun.xml.ws.util.Constants.LoggingDomain).append
(".client.dispatch").toString ());
+
+ public SOAP12XMLDecoder () {
+ }
+
+ protected DispatchSerializer getSerializerInstance (){
+ return DispatchSerializer.SOAP_1_2;
+ }
+
+ /*
+ *
+ * @see SOAPXMLDecoder#decodeFault(XMLStreamReader, InternalMessage, MessageInfo)
+ */
+ @Override
+ protected SOAPFaultInfo decodeFault (XMLStreamReader reader, InternalMessage
internalMessage, MessageInfo messageInfo) {
+ XMLStreamReaderUtil.verifyReaderState (reader, START_ELEMENT);
+ XMLStreamReaderUtil.verifyTag (reader, SOAP12Constants.QNAME_SOAP_FAULT);
+
+ // env:Code
+ XMLStreamReaderUtil.nextElementContent (reader);
+ XMLStreamReaderUtil.verifyReaderState (reader, START_ELEMENT);
+ XMLStreamReaderUtil.verifyTag (reader, SOAP12Constants.QNAME_FAULT_CODE);
+ XMLStreamReaderUtil.nextElementContent (reader);
+
+ //env:Value
+ QName faultcode = readFaultValue (reader);
+ FaultCodeEnum codeValue = FaultCodeEnum.get (faultcode);
+ if(codeValue == null)
+ throw new DeserializationException ("unknown fault code:",
faultcode.toString ());
+
+
+ //Subcode
+ FaultSubcode subcode = null;
+ if(reader.getEventType () == START_ELEMENT)
+ subcode = readFaultSubcode (reader);
+ FaultCode code = new FaultCode (codeValue, subcode);
+
+ XMLStreamReaderUtil.verifyReaderState (reader, END_ELEMENT);
+ XMLStreamReaderUtil.verifyTag (reader, SOAP12Constants.QNAME_FAULT_CODE);
+ XMLStreamReaderUtil.nextElementContent (reader);
+
+ FaultReason reason = readFaultReason (reader);
+ String node = null;
+ String role = null;
+ Object detail = null;
+
+ QName name = reader.getName ();
+ if(name.equals (SOAP12Constants.QNAME_FAULT_NODE)){
+ node = reader.getText ();
+ }
+
+ if(name.equals (SOAP12Constants.QNAME_FAULT_ROLE)){
+ XMLStreamReaderUtil.nextContent (reader);
+ role = reader.getText ();
+ XMLStreamReaderUtil.nextElementContent (reader);
+ XMLStreamReaderUtil.nextElementContent (reader);
+ }
+
+ if(name.equals (SOAP12Constants.QNAME_FAULT_DETAIL)){
+ //TODO: process encodingStyle attribute information item
+ XMLStreamReaderUtil.nextElementContent (reader);
+ detail = readFaultDetail (reader, messageInfo);
+ XMLStreamReaderUtil.nextElementContent (reader);
+ }
+
+ XMLStreamReaderUtil.verifyReaderState (reader, END_ELEMENT);
+ XMLStreamReaderUtil.verifyTag (reader, SOAP12Constants.QNAME_SOAP_FAULT);
+ XMLStreamReaderUtil.nextElementContent (reader);
+
+ return new SOAP12FaultInfo (code, reason, node, role, detail);
+ }
+
+ protected QName readFaultValue (XMLStreamReader reader){
+ XMLStreamReaderUtil.verifyReaderState (reader, START_ELEMENT);
+ XMLStreamReaderUtil.verifyTag (reader, SOAP12Constants.QNAME_FAULT_VALUE);
+
+ XMLStreamReaderUtil.nextContent (reader);
+
+ String tokens = reader.getText ();
+
+ XMLStreamReaderUtil.next (reader);
+ XMLStreamReaderUtil.verifyReaderState (reader, END_ELEMENT);
+ XMLStreamReaderUtil.verifyTag (reader, SOAP12Constants.QNAME_FAULT_VALUE);
+ XMLStreamReaderUtil.nextElementContent (reader);
+
+ String uri = "";
+ tokens = EncoderUtils.collapseWhitespace (tokens);
+ String prefix = XmlUtil.getPrefix (tokens);
+ if (prefix != null) {
+ uri = reader.getNamespaceURI (prefix);
+ if (uri == null) {
+ throw new DeserializationException ("xsd.unknownPrefix",
prefix);
+ }
+ }
+ String localPart = XmlUtil.getLocalPart (tokens);
+ return new QName (uri, localPart);
+ }
+
+ protected FaultSubcode readFaultSubcode (XMLStreamReader reader){
+ FaultSubcode code = null;
+ QName name = reader.getName ();
+ if(name.equals (SOAP12Constants.QNAME_FAULT_SUBCODE)){
+ XMLStreamReaderUtil.nextElementContent (reader);
+ QName faultcode = readFaultValue (reader);
+ FaultSubcode subcode = null;
+ if(reader.getEventType () == START_ELEMENT)
+ subcode = readFaultSubcode (reader);
+ code = new FaultSubcode (faultcode, subcode);
+ XMLStreamReaderUtil.verifyReaderState (reader, END_ELEMENT);
+ XMLStreamReaderUtil.verifyTag (reader, SOAP12Constants.QNAME_FAULT_SUBCODE);
+ XMLStreamReaderUtil.nextElementContent (reader);
+ }
+ return code;
+ }
+
+ protected FaultReason readFaultReason (XMLStreamReader reader){
+ XMLStreamReaderUtil.verifyReaderState (reader, START_ELEMENT);
+ XMLStreamReaderUtil.verifyTag (reader, SOAP12Constants.QNAME_FAULT_REASON);
+ XMLStreamReaderUtil.nextElementContent (reader);
+
+ //soapenv:Text
+ List<FaultReasonText> texts = new ArrayList<FaultReasonText>();
+ readFaultReasonTexts (reader, texts);
+
+ XMLStreamReaderUtil.verifyReaderState (reader, END_ELEMENT);
+ XMLStreamReaderUtil.verifyTag (reader, SOAP12Constants.QNAME_FAULT_REASON);
+ XMLStreamReaderUtil.nextElementContent (reader);
+
+ FaultReasonText[] frt = texts.toArray (new FaultReasonText[0]);
+ return new FaultReason (frt);
+ }
+
+ protected void readFaultReasonTexts (XMLStreamReader reader,
List<FaultReasonText> texts) {
+ QName name = reader.getName ();
+ if (!name.equals (SOAP12Constants.QNAME_FAULT_REASON_TEXT)) {
+ return;
+ }
+ String lang = reader.getAttributeValue (SOAP12NamespaceConstants.XML_NS,
"lang");
+ //lets be more forgiving, if its null lets assume its 'en'
+ if(lang == null)
+ lang = "en";
+
+ //TODO: what to do when the lang is other than 'en', for example
clingon?
+
+ //get the text value
+ XMLStreamReaderUtil.nextContent (reader);
+ String text = null;
+ if (reader.getEventType () == CHARACTERS) {
+ text = reader.getText ();
+ XMLStreamReaderUtil.next (reader);
+ }
+ XMLStreamReaderUtil.verifyReaderState (reader, END_ELEMENT);
+ XMLStreamReaderUtil.verifyTag (reader, SOAP12Constants.QNAME_FAULT_REASON_TEXT);
+ XMLStreamReaderUtil.nextElementContent (reader);
+ Locale loc = new Locale(lang);
+
+ texts.add (new FaultReasonText (text, loc));
+
+ //call again to see if there are more soapenv:Text elements
+ readFaultReasonTexts (reader, texts);
+ }
+
+ /* (non-Javadoc)
+ * @see
org.jboss.com.sun.xml.ws.rt.encoding.soap.SOAPDecoder#decodeHeader(org.jboss.com.sun.xml.ws.streaming.XMLStreamReader,
com.sun.pept.ept.MessageInfo, org.jboss.com.sun.xml.ws.soap.internal.InternalMessage)
+ */
+ @Override
+ protected void decodeHeader (XMLStreamReader reader, MessageInfo messageInfo,
InternalMessage request) {
+ XMLStreamReaderUtil.verifyReaderState (reader, START_ELEMENT);
+ if (!SOAPNamespaceConstants.TAG_HEADER.equals (reader.getLocalName ())) {
+ return;
+ }
+ XMLStreamReaderUtil.verifyTag (reader, getHeaderTag ());
+ XMLStreamReaderUtil.nextElementContent (reader);
+ while (true) {
+ if (reader.getEventType () == START_ELEMENT) {
+ decodeHeaderElement (reader, messageInfo, request);
+ } else {
+ break;
+ }
+ }
+ XMLStreamReaderUtil.verifyReaderState (reader, END_ELEMENT);
+ XMLStreamReaderUtil.verifyTag (reader, getHeaderTag ());
+ XMLStreamReaderUtil.nextElementContent (reader);
+ }
+
+ /*
+ * If JAXB can deserialize a header, deserialize it.
+ * Otherwise, just ignore the header
+ */
+ protected void decodeHeaderElement (XMLStreamReader reader, MessageInfo messageInfo,
+ InternalMessage msg) {
+ RuntimeContext rtCtxt = MessageInfoUtil.getRuntimeContext (messageInfo);
+ BridgeContext bridgeContext = rtCtxt.getBridgeContext ();
+ Set<QName> knownHeaders = ((SOAPRuntimeModel) rtCtxt.getModel
()).getKnownHeaders ();
+ QName name = reader.getName ();
+ if (knownHeaders != null && knownHeaders.contains (name)) {
+ QName headerName = reader.getName ();
+ if (msg.isHeaderPresent (name)) {
+ // More than one instance of header whose QName is mapped to a
+ // method parameter. Generates a runtime error.
+ raiseFault (getSenderFaultCode(), "Duplicate Header" +
headerName);
+ }
+ Object decoderInfo = rtCtxt.getDecoderInfo (name);
+ if (decoderInfo != null && decoderInfo instanceof JAXBBridgeInfo) {
+ JAXBBridgeInfo bridgeInfo = (JAXBBridgeInfo) decoderInfo;
+ // JAXB leaves on </env:Header> or <nextHeaderElement>
+ bridgeInfo.deserialize(reader,bridgeContext);
+ HeaderBlock headerBlock = new HeaderBlock (bridgeInfo);
+ msg.addHeader (headerBlock);
+ }
+ } else {
+ XMLStreamReaderUtil.skipElement (reader); // Moves to END
state
+ XMLStreamReaderUtil.nextElementContent (reader);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.com.sun.xml.ws.rt.encoding.soap.SOAPDecoder#getFaultTag()
+ */
+ @Override
+ protected QName getFaultTag (){
+ return SOAP12Constants.QNAME_SOAP_FAULT;
+ }
+ /* (non-Javadoc)
+ * @see org.jboss.com.sun.xml.ws.rt.encoding.soap.SOAPDecoder#getBodyTag()
+ */
+ @Override
+ protected QName getBodyTag () {
+ return SOAP12Constants.QNAME_SOAP_BODY;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.com.sun.xml.ws.rt.encoding.soap.SOAPDecoder#getEnvelopeTag()
+ */
+ @Override
+ protected QName getEnvelopeTag () {
+ return SOAP12Constants.QNAME_SOAP_ENVELOPE;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.com.sun.xml.ws.rt.encoding.soap.SOAPDecoder#getHeaderTag()
+ */
+ @Override
+ protected QName getHeaderTag () {
+ return SOAP12Constants.QNAME_SOAP_HEADER;
+ }
+
+ @Override
+ protected QName getMUAttrQName (){
+ return SOAP12Constants.QNAME_MUSTUNDERSTAND;
+ }
+
+ @Override
+ protected QName getRoleAttrQName (){
+ return SOAP12Constants.QNAME_ROLE;
+ }
+
+ @Override
+ protected QName getFaultDetailTag() {
+ return SOAP12Constants.QNAME_FAULT_DETAIL;
+ }
+
+ @Override
+ public String getBindingId() {
+ return SOAPBinding.SOAP12HTTP_BINDING;
+ }
+
+ @Override
+ protected QName getSenderFaultCode() {
+ return SOAP12Constants.FAULT_CODE_SERVER;
+ }
+
+ @Override
+ protected QName getReceiverFaultCode() {
+ return SOAP12Constants.FAULT_CODE_CLIENT;
+ }
+
+ @Override
+ protected QName getVersionMismatchFaultCode() {
+ return SOAP12Constants.FAULT_CODE_VERSION_MISMATCH;
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/client/SOAP12XMLDecoder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/client/SOAP12XMLEncoder.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/client/SOAP12XMLEncoder.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/client/SOAP12XMLEncoder.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,132 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.encoding.soap.client;
+
+import static java.util.logging.Logger.getLogger;
+import static org.jboss.com.sun.xml.ws.client.BindingProviderProperties.*;
+
+
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.ws.soap.SOAPBinding;
+import javax.xml.bind.JAXBContext;
+
+import org.jboss.com.sun.xml.ws.client.BindingProviderProperties;
+import org.jboss.com.sun.xml.ws.client.SenderException;
+import org.jboss.com.sun.xml.ws.encoding.JAXWSAttachmentMarshaller;
+import org.jboss.com.sun.xml.ws.encoding.soap.streaming.SOAP12NamespaceConstants;
+import org.jboss.com.sun.xml.ws.encoding.soap.streaming.SOAPNamespaceConstants;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.server.RuntimeContext;
+import org.jboss.com.sun.xml.ws.util.MessageInfoUtil;
+
+import com.sun.xml.bind.api.BridgeContext;
+
+
+import java.util.logging.Logger;
+import java.util.List;
+import java.io.ByteArrayOutputStream;
+import java.nio.ByteBuffer;
+import java.lang.reflect.Method;
+
+
+/**
+ * @author WS Development Team
+ */
+public class SOAP12XMLEncoder extends SOAPXMLEncoder {
+
+
+ private static final Logger logger =
+ getLogger(new
StringBuffer().append(org.jboss.com.sun.xml.ws.util.Constants.LoggingDomain).append(".client.dispatch.util").toString());
+
+ /*
+ * @see SOAPEncoder#startEnvelope(XMLStreamWriter)
+ */
+ @Override
+ protected void startEnvelope(XMLStreamWriter writer) {
+ try {
+ writer.writeStartElement(SOAPNamespaceConstants.NSPREFIX_SOAP_ENVELOPE,
+ SOAPNamespaceConstants.TAG_ENVELOPE, SOAP12NamespaceConstants.ENVELOPE);
+ writer.setPrefix(SOAPNamespaceConstants.NSPREFIX_SOAP_ENVELOPE,
+ SOAP12NamespaceConstants.ENVELOPE);
+ writer.writeNamespace(SOAPNamespaceConstants.NSPREFIX_SOAP_ENVELOPE,
+ SOAP12NamespaceConstants.ENVELOPE);
+ } catch (XMLStreamException e) {
+ throw new SenderException(e);
+ }
+ }
+
+ /*
+ * @see SOAPEncoder#startBody(XMLStreamWriter)
+ */
+ @Override
+ protected void startBody(XMLStreamWriter writer) {
+ try {
+ writer.writeStartElement(SOAPNamespaceConstants.NSPREFIX_SOAP_ENVELOPE,
+ SOAPNamespaceConstants.TAG_BODY, SOAP12NamespaceConstants.ENVELOPE);
+ } catch (XMLStreamException e) {
+ throw new SenderException(e);
+ }
+ }
+
+ /*
+ * @see SOAPEncoder#startHeader(XMLStreamWriter)
+ */
+ @Override
+ protected void startHeader(XMLStreamWriter writer) {
+ try {
+ writer.writeStartElement(SOAPNamespaceConstants.NSPREFIX_SOAP_ENVELOPE,
+ SOAPNamespaceConstants.TAG_HEADER,
+ SOAP12NamespaceConstants.ENVELOPE); // <env:Header>
+ } catch (XMLStreamException e) {
+ throw new SenderException(e);
+ }
+ }
+
+ protected String getContentType(MessageInfo messageInfo,
+ JAXWSAttachmentMarshaller marshaller)
+ {
+ String contentNegotiation = (String)
+
messageInfo.getMetaData(BindingProviderProperties.CONTENT_NEGOTIATION_PROPERTY);
+
+ if (marshaller == null) {
+ marshaller = MessageInfoUtil.getAttachmentMarshaller(messageInfo);
+ }
+
+ if (marshaller != null && marshaller.isXopped()) {
+ return XOP_SOAP12_XML_TYPE_VALUE;
+ }
+ else {
+ return (contentNegotiation == "optimistic") ?
+ FAST_INFOSET_TYPE_SOAP12 : SOAP12_XML_CONTENT_TYPE_VALUE;
+ }
+ }
+
+ /**
+ * This method is used to create the appropriate SOAPMessage (1.1 or 1.2 using SAAJ
api).
+ * @return the BindingID associated with this encoder
+ */
+ @Override
+ protected String getBindingId (){
+ return SOAPBinding.SOAP12HTTP_BINDING;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/client/SOAP12XMLEncoder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/client/SOAPXMLDecoder.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/client/SOAPXMLDecoder.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/client/SOAPXMLDecoder.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,581 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.encoding.soap.client;
+
+import com.sun.xml.bind.api.BridgeContext;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.namespace.QName;
+import javax.xml.soap.Detail;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import static javax.xml.stream.XMLStreamConstants.*;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.stream.XMLStreamException;
+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.dom.DOMResult;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.Service;
+import javax.xml.ws.soap.SOAPBinding;
+import javax.xml.ws.soap.SOAPFaultException;
+
+import org.jboss.com.sun.xml.ws.client.BindingProviderProperties;
+import org.jboss.com.sun.xml.ws.client.RequestContext;
+import org.jboss.com.sun.xml.ws.client.dispatch.DispatchContext;
+import org.jboss.com.sun.xml.ws.client.dispatch.impl.encoding.DispatchSerializer;
+import org.jboss.com.sun.xml.ws.client.dispatch.impl.encoding.DispatchUtil;
+import org.jboss.com.sun.xml.ws.encoding.internal.InternalEncoder;
+import org.jboss.com.sun.xml.ws.encoding.jaxb.JAXBBeanInfo;
+import org.jboss.com.sun.xml.ws.encoding.jaxb.JAXBBridgeInfo;
+import org.jboss.com.sun.xml.ws.encoding.simpletype.EncoderUtils;
+import org.jboss.com.sun.xml.ws.encoding.soap.DeserializationException;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAP12Constants;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPConstants;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPDecoder;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPEPTFactory;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.BodyBlock;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.HeaderBlock;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.InternalMessage;
+import org.jboss.com.sun.xml.ws.encoding.soap.message.SOAPFaultInfo;
+import org.jboss.com.sun.xml.ws.encoding.soap.streaming.SOAPNamespaceConstants;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.pept.presentation.MessageStruct;
+import org.jboss.com.sun.xml.ws.server.RuntimeContext;
+import org.jboss.com.sun.xml.ws.spi.runtime.WSConnection;
+import org.jboss.com.sun.xml.ws.streaming.Attributes;
+import org.jboss.com.sun.xml.ws.streaming.SourceReaderFactory;
+import org.jboss.com.sun.xml.ws.streaming.XMLStreamReaderUtil;
+import org.jboss.com.sun.xml.ws.streaming.XMLStreamWriterFactory;
+import org.jboss.com.sun.xml.ws.util.ByteArrayBuffer;
+import org.jboss.com.sun.xml.ws.util.MessageInfoUtil;
+import org.jboss.com.sun.xml.ws.util.SOAPConnectionUtil;
+import org.jboss.com.sun.xml.ws.util.SOAPUtil;
+import org.jboss.com.sun.xml.ws.util.xml.StAXSource;
+import org.jboss.com.sun.xml.ws.util.xml.XmlUtil;
+
+import java.lang.reflect.Method;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author WS Development Team
+ */
+
+public class SOAPXMLDecoder extends SOAPDecoder {
+ public SOAPXMLDecoder() {
+ }
+
+ protected DispatchSerializer getSerializerInstance() {
+ return DispatchSerializer.SOAP_1_0;
+ }
+
+ @Override
+ public SOAPMessage toSOAPMessage(MessageInfo messageInfo) {
+ WSConnection connection = (WSConnection) messageInfo.getConnection();
+ return SOAPConnectionUtil.getSOAPMessage(connection, messageInfo,
getBindingId());
+ }
+
+ /*protected void decodeBody(XMLStreamReader reader, InternalMessage response,
+ MessageInfo messageInfo) {
+ XMLStreamReaderUtil.verifyReaderState(reader, START_ELEMENT);
+ XMLStreamReaderUtil.verifyTag(reader, getBodyTag());
+ int state = XMLStreamReaderUtil.nextElementContent(reader);
+ decodeBodyContent(reader, response, messageInfo);
+ XMLStreamReaderUtil.verifyReaderState(reader, END_ELEMENT);
+ XMLStreamReaderUtil.verifyTag(reader, getBodyTag());
+ XMLStreamReaderUtil.nextElementContent(reader);
+ }
+ */
+
+
+ /*
+ * skipBody is true, the body is skipped during parsing.
+ */
+ protected void decodeEnvelope(XMLStreamReader reader, InternalMessage request,
+ boolean skipBody, MessageInfo messageInfo) {
+
+ XMLStreamReaderUtil.verifyReaderState(reader, START_ELEMENT);
+ //XMLStreamReaderUtil.verifyTag(reader, getEnvelopeTag());
+ if (isDispatch(messageInfo))
+ dispatchUtil.collectPrefixes(reader);
+
+ XMLStreamReaderUtil.nextElementContent(reader);
+
+ if (skipHeader(messageInfo)) {
+ //System.out.println("Skipping header");
+ skipHeader(reader, messageInfo);
+ } else {
+ //System.out.println("Decoding header");
+ decodeHeader(reader, messageInfo, request);
+ }
+
+ if (skipBody) {
+ //System.out.println("Skipping body");
+ skipBody(reader);
+ } else {
+ //System.out.println("Decodong body");
+ decodeBody(reader, request, messageInfo);
+ }
+
+ XMLStreamReaderUtil.verifyReaderState(reader, END_ELEMENT);
+ XMLStreamReaderUtil.verifyTag(reader, getEnvelopeTag());
+ XMLStreamReaderUtil.nextElementContent(reader);
+ XMLStreamReaderUtil.verifyReaderState(reader, END_DOCUMENT);
+ }
+
+ private static String convertNull(String s) {
+ return (s != null) ? s : "";
+ }
+
+ //@Override
+ protected void decodeBody(XMLStreamReader reader, InternalMessage response,
MessageInfo messageInfo) {
+ DispatchContext context = (DispatchContext)
messageInfo.getMetaData(BindingProviderProperties.DISPATCH_CONTEXT);
+ if (context != null) {
+ //System.out.println("Dispatch context not null");
+ XMLStreamReaderUtil.verifyReaderState(reader, START_ELEMENT);
+ XMLStreamReaderUtil.verifyTag(reader, getBodyTag());
+ int state = XMLStreamReaderUtil.nextElementContent(reader);
+ // if Body is not empty, then deserialize the Body
+ if (state != END_ELEMENT) {
+ BodyBlock responseBody;
+ QName responseBodyName = reader.getName(); // Operation name
+
+ if (responseBodyName.equals(getFaultTag())) {
+ SOAPFaultInfo soapFaultInfo = decodeFault(reader, response,
messageInfo);
+ responseBody = new BodyBlock(soapFaultInfo);
+ } else {
+ // System.out.println("Deserializing body");
+ JAXBContext jaxbContext = getJAXBContext(messageInfo);
+ if (jaxbContext == null) {
+ //System.out.println("JAXBContext == null");
+ responseBody = new
BodyBlock(getSerializerInstance().deserializeSource(reader, dispatchUtil));
+ } else {
+ //jaxb will leave reader on ending </body> element
+ //System.out.println("Doing a jaxb bean");
+ JAXBBeanInfo jaxBean = null;
+ Unmarshaller um =
(Unmarshaller)messageInfo.getMetaData(BindingProviderProperties.DISPATCH_UNMARSHALLER);
+ if (um != null)
+ jaxBean = JAXBBeanInfo.fromStAX(reader, jaxbContext, um);
+ else
+ jaxBean = JAXBBeanInfo.fromStAX(reader, jaxbContext);
+
+ responseBody = new BodyBlock(jaxBean);
+ }
+ }
+ response.setBody(responseBody);
+ }
+
+ XMLStreamReaderUtil.verifyReaderState(reader, END_ELEMENT);
+ XMLStreamReaderUtil.verifyTag(reader, getBodyTag());
+ XMLStreamReaderUtil.nextElementContent(reader);
+ } //else
+ else super.decodeBody(reader, response, messageInfo);
+ }
+
+ @Override
+ //Todo:kw 102505
+ public void toMessageInfo(InternalMessage internalMessage, MessageInfo messageInfo)
{
+
+ RuntimeContext rtContext =
+ (RuntimeContext)
messageInfo.getMetaData(BindingProviderProperties.JAXWS_RUNTIME_CONTEXT);
+ if (rtContext != null) {
+ SOAPEPTFactory eptf = (SOAPEPTFactory) messageInfo.getEPTFactory();
+ InternalEncoder encoder = eptf.getInternalEncoder();
+ encoder.toMessageInfo(internalMessage, messageInfo);
+
+ } else { //here we need to set attachments in response context
+ if (internalMessage != null && internalMessage.getBody() != null) {
+ if (internalMessage.getBody().getValue() instanceof SOAPFaultInfo)
+ {
+
messageInfo.setResponseType(MessageStruct.CHECKED_EXCEPTION_RESPONSE);
+ messageInfo.setResponse(internalMessage.getBody().getValue());
+ } else
+ if (internalMessage.getBody().getValue() instanceof Exception) {
+
messageInfo.setResponseType(MessageStruct.UNCHECKED_EXCEPTION_RESPONSE);
+ messageInfo.setResponse(internalMessage.getBody().getValue());
+ } else {
+ messageInfo.setResponseType(MessageStruct.NORMAL_RESPONSE);
+ setAttachments(internalMessage, messageInfo);
+ //unfortunately we must do this
+ if (internalMessage.getBody().getValue() instanceof JAXBBeanInfo)
+ messageInfo.setResponse(((JAXBBeanInfo)
internalMessage.getBody().getValue()).getBean());
+ else
+ messageInfo.setResponse(internalMessage.getBody().getValue());
+ }
+ } else
+ messageInfo.setResponseType(MessageStruct.NORMAL_RESPONSE);
+ }
+ }
+
+ private void setAttachments(InternalMessage internalMessage, MessageInfo messageInfo)
{
+
+ }
+
+ protected void decodeEnvelope(XMLStreamReader reader, MessageInfo messageInfo) {
+ InternalMessage im = decodeInternalMessage(reader, messageInfo);
+ toMessageInfo(im, messageInfo);
+ }
+
+ protected InternalMessage decodeInternalMessage(XMLStreamReader reader, MessageInfo
messageInfo) {
+ InternalMessage response = new InternalMessage();
+
+ XMLStreamReaderUtil.verifyReaderState(reader, START_ELEMENT);
+ XMLStreamReaderUtil.verifyTag(reader, getEnvelopeTag());
+ XMLStreamReaderUtil.nextElementContent(reader);
+ decodeHeader(reader, messageInfo, response);
+ decodeBody(reader, response, messageInfo);
+ XMLStreamReaderUtil.verifyReaderState(reader, END_ELEMENT);
+ XMLStreamReaderUtil.verifyTag(reader, getEnvelopeTag());
+ XMLStreamReaderUtil.nextElementContent(reader);
+ XMLStreamReaderUtil.verifyReaderState(reader, END_DOCUMENT);
+
+ return response;
+ }
+
+ @Override
+ public InternalMessage toInternalMessage(SOAPMessage soapMessage, MessageInfo
messageInfo) {
+ // TODO handle exceptions, attachments
+ XMLStreamReader reader = null;
+ try {
+ InternalMessage response = new InternalMessage();
+ processAttachments(messageInfo, response, soapMessage);
+ Source source = soapMessage.getSOAPPart().getContent();
+ reader = SourceReaderFactory.createSourceReader(source, true,
getSOAPMessageCharsetEncoding(soapMessage));
+ XMLStreamReaderUtil.nextElementContent(reader);
+ decodeEnvelope(reader, response, false, messageInfo);
+ return response;
+ } catch (DeserializationException e) {
+ //e.printStackTrace();
+ throw new WebServiceException(e.getCause());
+ } catch (Exception e) {
+ //e.printStackTrace();
+ throw new WebServiceException(e);
+ } finally {
+ if (reader != null) {
+ XMLStreamReaderUtil.close(reader);
+ }
+ }
+ }
+
+ @Override
+ public InternalMessage toInternalMessage(SOAPMessage soapMessage,
+ InternalMessage response, MessageInfo
messageInfo) {
+ // TODO handle exceptions, attachments
+ XMLStreamReader reader = null;
+ try {
+ processAttachments(messageInfo, response, soapMessage);
+ Source source = soapMessage.getSOAPPart().getContent();
+ reader = SourceReaderFactory.createSourceReader(source, true,
getSOAPMessageCharsetEncoding(soapMessage));
+ XMLStreamReaderUtil.nextElementContent(reader);
+ decodeEnvelope(reader, response, !isDispatch(messageInfo), messageInfo);
+
+ if (!isDispatch(messageInfo))
+ convertBodyBlock(response, messageInfo);
+
+ } catch (DeserializationException e) {
+ //e.printStackTrace();
+ throw new WebServiceException(e.getCause());
+ } catch (Exception e) {
+ //e.printStackTrace();
+ throw new WebServiceException(e);
+ } finally {
+ if (reader != null) {
+ XMLStreamReaderUtil.close(reader);
+ }
+ }
+ return response;
+
+ }
+
+ /**
+ * @return Returns the soap binding - SOAP 1.1 namespace.
+ */
+ public String getSOAPBindingId() {
+ return SOAPConstants.NS_WSDL_SOAP;
+ }
+
+ @Override
+ protected SOAPFaultInfo decodeFault(XMLStreamReader reader, InternalMessage
internalMessage,
+ MessageInfo messageInfo) {
+ RuntimeContext rtCtxt = MessageInfoUtil.getRuntimeContext(messageInfo);
+
+ XMLStreamReaderUtil.verifyReaderState(reader, START_ELEMENT);
+ XMLStreamReaderUtil.verifyTag(reader, SOAPConstants.QNAME_SOAP_FAULT);
+ Method methodName = messageInfo.getMethod();
+
+ // faultcode
+ XMLStreamReaderUtil.nextElementContent(reader);
+ XMLStreamReaderUtil.verifyReaderState(reader, START_ELEMENT);
+ XMLStreamReaderUtil.verifyTag(reader, SOAPConstants.QNAME_SOAP_FAULT_CODE);
+ XMLStreamReaderUtil.nextContent(reader);
+ QName faultcode;
+ String tokens = reader.getText();
+ String uri = "";
+ tokens = EncoderUtils.collapseWhitespace(tokens);
+ String prefix = XmlUtil.getPrefix(tokens);
+ if (prefix != null) {
+ uri = reader.getNamespaceURI(prefix);
+ if (uri == null) {
+ throw new DeserializationException("xsd.unknownPrefix",
prefix);
+ }
+ }
+ String localPart = XmlUtil.getLocalPart(tokens);
+ faultcode = new QName(uri, localPart);
+ XMLStreamReaderUtil.next(reader);
+ XMLStreamReaderUtil.verifyReaderState(reader, END_ELEMENT);
+ XMLStreamReaderUtil.verifyTag(reader, SOAPConstants.QNAME_SOAP_FAULT_CODE);
+
+ // faultstring
+ XMLStreamReaderUtil.nextElementContent(reader);
+ XMLStreamReaderUtil.verifyReaderState(reader, START_ELEMENT);
+ XMLStreamReaderUtil.verifyTag(reader, SOAPConstants.QNAME_SOAP_FAULT_STRING);
+ XMLStreamReaderUtil.nextContent(reader);
+ String faultstring = "";
+ //reader may give more than one char events so coalesc them all.
+ if (reader.getEventType() == CHARACTERS) {
+ do {
+ faultstring += reader.getText();
+ XMLStreamReaderUtil.next(reader);
+ }while(reader.getEventType() == CHARACTERS);
+ }
+ XMLStreamReaderUtil.verifyReaderState(reader, END_ELEMENT);
+ XMLStreamReaderUtil.verifyTag(reader, SOAPConstants.QNAME_SOAP_FAULT_STRING);
+
+ String faultactor = null;
+ Object faultdetail = null;
+ QName faultName;
+ if (XMLStreamReaderUtil.nextElementContent(reader) == START_ELEMENT) {
+ QName elementName = reader.getName();
+ // faultactor
+ if (elementName.equals(SOAPConstants.QNAME_SOAP_FAULT_ACTOR)) {
+ XMLStreamReaderUtil.nextContent(reader);
+ // faultactor may be empty
+ if (reader.getEventType() == CHARACTERS) {
+ faultactor = reader.getText();
+ XMLStreamReaderUtil.next(reader);
+ }
+ XMLStreamReaderUtil.verifyReaderState(reader, END_ELEMENT);
+ XMLStreamReaderUtil.verifyTag(reader,
SOAPConstants.QNAME_SOAP_FAULT_ACTOR);
+ XMLStreamReaderUtil.nextElementContent(reader);
+ elementName = reader.getName();
+ }
+
+ // faultdetail
+ if (elementName.equals(SOAPConstants.QNAME_SOAP_FAULT_DETAIL)) {
+ //skip <detail/>
+ if(XMLStreamReaderUtil.nextContent(reader) == START_ELEMENT){
+ if
(messageInfo.getMetaData(BindingProviderProperties.DISPATCH_CONTEXT) == null)
+ faultdetail = readFaultDetail(reader, messageInfo);
+ else {
+ XMLStreamReaderUtil.skipElement(reader);
+ XMLStreamReaderUtil.next(reader);
+ }
+ }
+ // move from </detail> to </Fault>.
+ XMLStreamReaderUtil.nextContent(reader);
+ } else {
+ if (internalMessage.getHeaders() != null) {
+ boolean isHeaderFault = false;
+ // could be a header fault or a protocol exception with no detail
+ for (HeaderBlock headerBlock : internalMessage.getHeaders())
+ {
+ if (rtCtxt.getModel().isKnownFault(headerBlock.getName(),
methodName))
+ {
+ isHeaderFault = true;
+ faultdetail = headerBlock.getValue();
+ }
+ }
+
+ // if not a header fault, then it is a protocol exception with no
detail
+ if (!isHeaderFault) {
+ faultdetail = null;
+ }
+ XMLStreamReaderUtil.next(reader);
+ }
+ }
+ } else {
+ // a header fault (with no faultactor)
+ if (internalMessage.getHeaders() != null) {
+ for (HeaderBlock headerBlock : internalMessage.getHeaders()) {
+ if (rtCtxt.getModel().isKnownFault(headerBlock.getName(),
methodName))
+ {
+ faultdetail = headerBlock.getValue();
+ }
+ }
+ }
+ }
+
+
+ SOAPFaultInfo soapFaultInfo = new SOAPFaultInfo(faultstring, faultcode,
faultactor, faultdetail, getBindingId());
+
+ // reader could be left on CHARS token rather than </fault>
+ if (reader.getEventType() == CHARACTERS && reader.isWhiteSpace()) {
+ XMLStreamReaderUtil.nextContent(reader);
+ }
+
+ XMLStreamReaderUtil.verifyReaderState(reader, END_ELEMENT);
+ XMLStreamReaderUtil.verifyTag(reader, SOAPConstants.QNAME_SOAP_FAULT);
+ XMLStreamReaderUtil.nextElementContent(reader);
+
+ return soapFaultInfo;
+ }
+
+ /**
+ * Decodes the fault <detail> into a {@link Detail} object or a JAXB
object.
+ * <p/>
+ * Upon entry the cursor must be at the start tag of the first child element of
<detail>.
+ * Upon a successful completion, the cursor is left at </detail>.
+ */
+ protected final Object readFaultDetail(XMLStreamReader reader, MessageInfo mi) {
+ RuntimeContext rtCtxt = MessageInfoUtil.getRuntimeContext(mi);
+ if (rtCtxt == null){
+ XMLStreamReaderUtil.skipElement(reader);
+ XMLStreamReaderUtil.nextElementContent(reader);
+ return null;
+ }
+ QName faultName = reader.getName();
+ if (rtCtxt.getModel().isKnownFault(faultName, mi.getMethod())) {
+ Object decoderInfo = rtCtxt.getDecoderInfo(faultName);
+ if (decoderInfo != null && decoderInfo instanceof JAXBBridgeInfo) {
+ JAXBBridgeInfo bridgeInfo = (JAXBBridgeInfo) decoderInfo;
+ // JAXB leaves on </env:Header> or <nextHeaderElement>
+ bridgeInfo.deserialize(reader, rtCtxt.getBridgeContext());
+
+ // skip other detail entries
+ int event = reader.getEventType();
+ if (!(event == START_ELEMENT || event == END_ELEMENT)) {
+ XMLStreamReaderUtil.nextElementContent(reader);
+ }
+ while(reader.getEventType() == START_ELEMENT) {
+ XMLStreamReaderUtil.skipElement(reader);
+ XMLStreamReaderUtil.nextElementContent(reader);
+ }
+
+ XMLStreamReaderUtil.verifyReaderState(reader, END_ELEMENT);
+ XMLStreamReaderUtil.verifyTag(reader, getFaultDetailTag());
+ return bridgeInfo;
+ }
+ }
+
+ return decodeFaultDetail(reader);
+ }
+
+ /**
+ * Decodes the fault <detail> into a {@link Detail} object.
+ * <p/>
+ * Upon entry the cursor must be at the start tag of the first child element of
<detail>.
+ * Upon a successful completion, the cursor is left at </detail>.
+ */
+ protected Detail decodeFaultDetail(XMLStreamReader reader) {
+ try {
+ // parse the current element that the reader is pointing to
+ Transformer trans = XmlUtil.newTransformer();
+
+ MessageFactory messageFactory = MessageFactory.newInstance();
+ SOAPMessage soapMessage = messageFactory.createMessage();
+ Detail detail = soapMessage.getSOAPBody().addFault().addDetail();
+
+ // repeatedly copy all the child elements of <detail>.
+ do {
+ trans.transform(new StAXSource(reader, true), new DOMResult(detail));
+ } while (XMLStreamReaderUtil.nextContent(reader) == START_ELEMENT);
+
+ // now we should be at </detail>.
+ return detail;
+ } catch (SOAPException e) {
+ throw new
WebServiceException("sender.response.cannotDecodeFaultDetail", e);
+ } catch (TransformerException e) {
+ throw new
WebServiceException("sender.response.cannotDecodeFaultDetail", e);
+ } catch (TransformerFactoryConfigurationError e) {
+ throw new
WebServiceException("sender.response.cannotDecodeFaultDetail", e);
+ }
+ }
+
+ /* protected static String getCurrentPrefix(XMLStreamReader reader, String tokens,
String namespaceURI) {
+ tokens = reader.getText();
+ String uri = "";
+ tokens = EncoderUtils.collapseWhitespace(tokens);
+ String prefix = XmlUtil.getPrefix(tokens);
+ if (prefix != null) {
+ uri = reader.getNamespaceURI(prefix);
+ if (uri == null) {
+ throw new DeserializationException("xsd.unknownPrefix",
prefix);
+ }
+ }
+ String localPart = XmlUtil.getLocalPart(tokens);
+ return prefix;
+ }
+ */
+
+ protected JAXBContext getJAXBContext(MessageInfo messageInfo) {
+ JAXBContext jc = null;
+
+ RequestContext requestContext = (RequestContext)
messageInfo.getMetaData(BindingProviderProperties.JAXWS_CONTEXT_PROPERTY);
+ if (requestContext != null)
+ // TODO: does this really need to be copied?
+ jc = (JAXBContext)
requestContext.copy().get(BindingProviderProperties.JAXB_CONTEXT_PROPERTY);
+ return jc;
+ }
+
+ protected String getBindingId(MessageInfo messageInfo) {
+ RequestContext requestContext = (RequestContext)
messageInfo.getMetaData(BindingProviderProperties.JAXWS_CONTEXT_PROPERTY);
+ if (requestContext != null) {
+ String bindingId = (String)
requestContext.get(BindingProviderProperties.BINDING_ID_PROPERTY);
+ if (bindingId != null)
+ return bindingId;
+ }
+ return getBindingId();
+ }
+
+
+ @Override
+ public String getBindingId() {
+ return SOAPBinding.SOAP11HTTP_BINDING;
+ }
+
+ @Override
+ protected QName getSenderFaultCode() {
+ return SOAPConstants.FAULT_CODE_SERVER;
+ }
+
+ @Override
+ protected QName getReceiverFaultCode() {
+ return SOAPConstants.FAULT_CODE_CLIENT;
+ }
+
+ @Override
+ protected QName getVersionMismatchFaultCode() {
+ return SOAPConstants.FAULT_CODE_VERSION_MISMATCH;
+ }
+
+}
+
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/client/SOAPXMLDecoder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/client/SOAPXMLEncoder.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/client/SOAPXMLEncoder.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/client/SOAPXMLEncoder.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,264 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.encoding.soap.client;
+
+
+import javax.activation.DataHandler;
+import javax.xml.bind.JAXBContext;
+import javax.xml.namespace.QName;
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.Source;
+import javax.xml.ws.Service;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.soap.SOAPBinding;
+
+import org.jboss.com.sun.xml.ws.client.BindingProviderProperties;
+import org.jboss.com.sun.xml.ws.client.RequestContext;
+import org.jboss.com.sun.xml.ws.client.SenderException;
+import org.jboss.com.sun.xml.ws.client.dispatch.DispatchContext;
+import org.jboss.com.sun.xml.ws.encoding.JAXWSAttachmentMarshaller;
+import org.jboss.com.sun.xml.ws.encoding.internal.InternalEncoder;
+import org.jboss.com.sun.xml.ws.encoding.jaxb.JAXBBeanInfo;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPConstants;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPEPTFactory;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPEncoder;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.AttachmentBlock;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.BodyBlock;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.InternalMessage;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.streaming.XMLStreamWriterFactory;
+import org.jboss.com.sun.xml.ws.util.ByteArrayBuffer;
+import org.jboss.com.sun.xml.ws.util.MessageInfoUtil;
+import org.jboss.com.sun.xml.ws.util.SOAPUtil;
+
+import java.io.IOException;
+import java.util.Map;
+import java.util.logging.Logger;
+import static java.util.logging.Logger.getLogger;
+import static org.jboss.com.sun.xml.ws.client.BindingProviderProperties.*;
+
+/**
+ * @author WS Development Team
+ */
+public class SOAPXMLEncoder extends SOAPEncoder {
+
+ private static final Logger logger =
+ getLogger(new
StringBuffer().append(org.jboss.com.sun.xml.ws.util.Constants.LoggingDomain).append(".client.dispatch.util").toString());
+
+ public SOAPXMLEncoder() {
+ }
+ /* moved to super
+ protected JAXBContext getJAXBContext(MessageInfo messageInfo) {
+ JAXBContext jc = null;
+ RequestContext context = (RequestContext)
messageInfo.getMetaData(BindingProviderProperties.JAXWS_CONTEXT_PROPERTY);
+ if (context != null)
+ jc = (JAXBContext)
context.get(BindingProviderProperties.JAXB_CONTEXT_PROPERTY);
+
+ return jc;
+ }
+ */
+ protected boolean skipHeader(MessageInfo messageInfo) {
+ if (messageInfo.getMetaData(DispatchContext.DISPATCH_MESSAGE_MODE) ==
+ Service.Mode.PAYLOAD) {
+ return true;
+ }
+ return false;
+ }
+
+ protected QName getHeaderTag() {
+ return SOAPConstants.QNAME_SOAP_HEADER;
+ }
+
+ protected void skipHeader(XMLStreamReader writer) {
+ //XMLStreamReaderUtil.verifyReaderState(reader, START_ELEMENT);
+ //if (!SOAPNamespaceConstants.TAG_HEADER.equals(reader.getLocalName())) {
+ // return;
+ //}
+ //XMLStreamReaderUtil.verifyTag(reader, getHeaderTag());
+ //XMLStreamReaderUtil.skipElement(reader); // Moves to </Header>
+ //XMLStreamReaderUtil.nextElementContent(reader);
+ }
+
+ @Override
+ public InternalMessage toInternalMessage(MessageInfo messageInfo) {
+ InternalMessage internalMessage = new InternalMessage();
+ DispatchContext context = (DispatchContext)
messageInfo.getMetaData(BindingProviderProperties.DISPATCH_CONTEXT);
+ if (context != null) {
+ DispatchContext.MessageType type =
+ (DispatchContext.MessageType)
context.getProperty(DispatchContext.DISPATCH_MESSAGE);
+ Object[] data = messageInfo.getData();
+ BodyBlock bodyBlock = null;
+ switch (type) {
+ case JAXB_MESSAGE:
+ break;
+ case JAXB_PAYLOAD:
+ JAXBBeanInfo jaxbInfo = new JAXBBeanInfo(data[0],
getJAXBContext(messageInfo));
+ bodyBlock = new BodyBlock(jaxbInfo);
+ break;
+ case SOURCE_PAYLOAD:
+ data = messageInfo.getData();
+ bodyBlock = new BodyBlock((Source) data[0]);
+ break;
+ default:
+ }
+ if (bodyBlock != null)
+ internalMessage.setBody(bodyBlock);
+
+ //look for attachments here
+ Map<String, DataHandler> attMap = (Map<String, DataHandler>)
((Map<String, Object>)
+
messageInfo.getMetaData(BindingProviderProperties.JAXWS_CONTEXT_PROPERTY)).get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);
+
+ if (attMap != null)
+ for (Map.Entry<String, DataHandler> att : attMap.entrySet()) {
+
internalMessage.addAttachment(AttachmentBlock.fromDataHandler(att.getKey(),
att.getValue()));
+ }
+
+ } else {
+ SOAPEPTFactory eptf = (SOAPEPTFactory) messageInfo.getEPTFactory();
+ InternalEncoder internalEncoder = eptf.getInternalEncoder();
+ //processProperties(messageInfo);
+ return (InternalMessage) internalEncoder.toInternalMessage(messageInfo);
+ }
+ return internalMessage;
+ }
+
+ @Override
+ public SOAPMessage toSOAPMessage(InternalMessage internalMessage,
+ MessageInfo messageInfo) {
+ SOAPMessage message = null;
+ XMLStreamWriter writer = null;
+ JAXWSAttachmentMarshaller marshaller = null;
+ boolean xopEnabled = false;
+
+ try {
+ setAttachmentsMap(messageInfo, internalMessage);
+ ByteArrayBuffer bab = new ByteArrayBuffer();
+
+ if (messageInfo.getMetaData(CONTENT_NEGOTIATION_PROPERTY) ==
"optimistic")
+ {
+ writer = XMLStreamWriterFactory.createFIStreamWriter(bab);
+
+ // Turn XOP off for FI
+ marshaller = MessageInfoUtil.getAttachmentMarshaller(messageInfo);
+ if (marshaller != null) {
+ xopEnabled = marshaller.isXOPPackage(); // last value
+ marshaller.setXOPPackage(false);
+ }
+
+ } else {
+ // Store output stream to use in JAXB bridge (not with FI)
+ messageInfo.setMetaData(JAXB_OUTPUTSTREAM, bab);
+ writer = XMLStreamWriterFactory.createXMLStreamWriter(bab);
+ }
+
+ writer.writeStartDocument();
+ startEnvelope(writer);
+ writeEnvelopeNamespaces(writer, messageInfo);
+ if (!skipHeader(messageInfo))
+ writeHeaders(writer, internalMessage, messageInfo);
+ writeBody(writer, internalMessage, messageInfo);
+ endEnvelope(writer);
+ writer.writeEndDocument();
+ writer.close();
+
+ // TODO: Copy the mime headers from messageInfo.METADATA
+ MimeHeaders mh = new MimeHeaders();
+ mh.addHeader("Content-Type", getContentType(messageInfo,
marshaller));
+ message = SOAPUtil.createMessage(mh, bab.newInputStream(), getBindingId());
+ processAttachments(internalMessage, message);
+
+ // Restore default XOP processing before returning
+ if (marshaller != null) {
+ marshaller.setXOPPackage(xopEnabled);
+ }
+ }
+ catch (IOException e) {
+ throw new SenderException("sender.request.messageNotReady", e);
+ }
+ catch (SOAPException e) {
+ throw new SenderException(e);
+ }
+ catch (XMLStreamException e) {
+ throw new SenderException(e);
+ }
+ finally {
+ if (writer != null) {
+ try {
+ writer.close();
+ }
+ catch (XMLStreamException e) {
+ throw new SenderException(e);
+ }
+ }
+ }
+
+ return message;
+ }
+
+ public InternalMessage createInternalMessage(MessageInfo messageInfo) {
+
+ InternalMessage internalMessage = new InternalMessage();
+ Object response = messageInfo.getResponse();
+
+ BodyBlock bodyBlock = null;
+ if (getJAXBContext(messageInfo) != null) {
+ JAXBBeanInfo jaxbBean = new JAXBBeanInfo(response,
getJAXBContext(messageInfo));
+ bodyBlock = new BodyBlock(jaxbBean);
+ } else if (response instanceof Source) {
+ bodyBlock = new BodyBlock((Source) response);
+ }
+
+ internalMessage.setBody(bodyBlock);
+ return internalMessage;
+ }
+
+ protected String getContentType(MessageInfo messageInfo,
+ JAXWSAttachmentMarshaller marshaller) {
+ String contentNegotiation = (String)
+
messageInfo.getMetaData(BindingProviderProperties.CONTENT_NEGOTIATION_PROPERTY);
+
+ if (marshaller == null) {
+ marshaller = MessageInfoUtil.getAttachmentMarshaller(messageInfo);
+ }
+
+ if (marshaller != null && marshaller.isXopped()) {
+ return XOP_SOAP11_XML_TYPE_VALUE;
+ } else {
+ return (contentNegotiation == "optimistic") ?
+ FAST_INFOSET_TYPE_SOAP11 : XML_CONTENT_TYPE_VALUE;
+ }
+ }
+
+ /**
+ * This method is used to create the appropriate SOAPMessage (1.1 or 1.2 using SAAJ
api).
+ *
+ * @return the BindingID associated with this encoder
+ */
+ protected String getBindingId() {
+ return SOAPBinding.SOAP11HTTP_BINDING;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/client/SOAPXMLEncoder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/internal/AttachmentBlock.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/internal/AttachmentBlock.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/internal/AttachmentBlock.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,434 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.encoding.soap.internal;
+
+import com.sun.xml.bind.api.BridgeContext;
+import org.jboss.com.sun.xml.messaging.saaj.util.ByteOutputStream;
+
+import javax.activation.DataHandler;
+import javax.activation.DataSource;
+import javax.imageio.ImageIO;
+import javax.xml.soap.AttachmentPart;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.ws.WebServiceException;
+
+import org.jboss.com.sun.xml.ws.encoding.jaxb.JAXBBridgeInfo;
+import org.jboss.com.sun.xml.ws.encoding.soap.SerializationException;
+import org.jboss.com.sun.xml.ws.server.RuntimeContext;
+import org.jboss.com.sun.xml.ws.util.ASCIIUtility;
+import org.jboss.com.sun.xml.ws.util.ByteArrayDataSource;
+
+import java.awt.Image;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+
+/**
+ * Attachment of {@link InternalMessage}.
+ *
+ * <p>
+ * The key idea behind this class is to hide the actual data representation.
+ * The producer of the object may choose the best format it wants, and then
+ * various accessor methods provide the rest of the stack to chose the format
+ * it wants.
+ *
+ * <p>
+ * When receiving from a network, this allows an {@link AttachmentBlock} object
+ * to be constructed without actually even parsing the attachment. When
+ * sending to a network, this allows the conversion to the byte image to happen
+ * lazily, and directly to the network.
+ *
+ * <p>
+ * Even though most of the data access methods have default implementation,
+ * Implementation classes of this class should override them
+ * so that they can run faster, whenever possible. In particular, the default
+ * implementation of {@link #asInputStream()} and {@link #writeTo(OutputStream)}
+ * has a circular dependency, so at least one must be overridden.
+ *
+ * TODO:
+ * in the performance critical path of mapping an attachment to a Java type,
+ * most of the type the Java type to which it binds to is known in advance.
+ * for this reason, it's better to prepare an 'accessor' object for each
+ * kind of conversion. In that way we can avoid the computation of this
+ * in the pritical path, which is redundant.
+ *
+ * @author Kohsuke Kawaguchi
+ */
+public abstract class AttachmentBlock {
+
+ public static AttachmentBlock fromDataHandler(String cid,DataHandler dh) {
+ return new DataHandlerImpl(cid,dh);
+ }
+
+ public static AttachmentBlock fromSAAJ(AttachmentPart part) {
+ return new SAAJImpl(part);
+ }
+
+ public static AttachmentBlock fromByteArray(String cid,byte[] data, int start, int
len, String mimeType ) {
+ return new ByteArrayImpl(cid,data,start,len,mimeType);
+ }
+
+ public static AttachmentBlock fromByteArray(String cid,byte[] data, String mimeType)
{
+ return new ByteArrayImpl(cid,data,0,data.length,mimeType);
+ }
+
+ public static AttachmentBlock fromJAXB(String cid, JAXBBridgeInfo bridgeInfo,
RuntimeContext rtContext, String mimeType) {
+ return new JAXBImpl(cid,bridgeInfo,rtContext,mimeType);
+ }
+
+ /**
+ * No derived class outside this class.
+ */
+ private AttachmentBlock() {}
+
+ /**
+ * Content ID of the attachment. Uniquely identifies an attachment.
+ */
+ public abstract String getId();
+
+ /**
+ * Gets the WSDL part name of this attachment.
+ *
+ * <p>
+ * According to WSI AP 1.0
+ * <PRE>
+ * 3.8 Value-space of Content-Id Header
+ * Definition: content-id part encoding
+ * The "content-id part encoding" consists of the concatenation of:
+ * The value of the name attribute of the wsdl:part element referenced by the
mime:content, in which characters disallowed in content-id headers (non-ASCII characters
as represented by code points above 0x7F) are escaped as follows:
+ * o Each disallowed character is converted to UTF-8 as one or more bytes.
+ * o Any bytes corresponding to a disallowed character are escaped with the URI
escaping mechanism (that is, converted to %HH, where HH is the hexadecimal notation of the
byte value).
+ * o The original character is replaced by the resulting character sequence.
+ * The character '=' (0x3D).
+ * A globally unique value such as a UUID.
+ * The character '@' (0x40).
+ * A valid domain name under the authority of the entity constructing the message.
+ * </PRE>
+ *
+ * So a wsdl:part fooPart will be encoded as:
+ * <fooPart=somereallybignumberlikeauuid(a)example.com>
+ *
+ * @return null
+ * if the parsing fails.
+ */
+ public final String getWSDLPartName(){
+ String cId = getId();
+
+ int index = cId.lastIndexOf('@', cId.length());
+ if(index == -1){
+ return null;
+ }
+ String localPart = cId.substring(0, index);
+ index = localPart.lastIndexOf('=', localPart.length());
+ if(index == -1){
+ return null;
+ }
+ try {
+ return java.net.URLDecoder.decode(localPart.substring(0, index),
"UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ throw new SerializationException(e);
+ }
+ }
+
+ /**
+ * Gets the MIME content-type of this attachment.
+ */
+ public abstract String getContentType();
+
+ /**
+ * Gets the attachment as an exact-length byte array.
+ */
+ // not so fast but useful default implementation
+ public byte[] asByteArray() {
+ try {
+ return ASCIIUtility.getBytes(asInputStream());
+ } catch (IOException e) {
+ throw new WebServiceException(e);
+ }
+ }
+
+ /**
+ * Gets the attachment as a {@link DataHandler}.
+ */
+ public abstract DataHandler asDataHandler();
+
+ /**
+ * Gets the attachment as a {@link Source}.
+ * Note that there's no guarantee that the attachment is actually an XML.
+ */
+ public Source asSource() {
+ return new StreamSource(asInputStream());
+ }
+
+ /**
+ * Obtains this attachment as an {@link InputStream}.
+ */
+ // not-so-efficient but useful default implementation.
+ public InputStream asInputStream() {
+ ByteOutputStream bos = new ByteOutputStream();
+ try {
+ writeTo(bos);
+ } catch (IOException e) {
+ throw new WebServiceException(e);
+ }
+ return bos.newInputStream();
+ }
+
+ /**
+ * Deserializes this attachment by using JAXB into {@link JAXBBridgeInfo}.
+ *
+ * TODO: this abstraction is wrong.
+ */
+ public final void deserialize(BridgeContext bc, JAXBBridgeInfo bi) {
+ bi.deserialize(asInputStream(),bc);
+ }
+
+ /**
+ * Adds this attachment as an {@link AttachmentPart} into the given {@link
SOAPMessage}.
+ */
+ // not so fast but useful default
+ public void addTo(SOAPMessage msg) throws SOAPException {
+ AttachmentPart part = msg.createAttachmentPart(asDataHandler());
+ part.setContentId(getId());
+ //it may be safe to say the encoding is binary meaning the bytes are not
subjected any
+ //specific encoding.
+ part.setMimeHeader("Content-transfer-encoding", "binary");
+ msg.addAttachmentPart(part);
+ }
+
+ /**
+ * Writes the contents of the attachment into the given stream.
+ */
+ // not so fast but useful default
+ public void writeTo(OutputStream os) throws IOException {
+ ASCIIUtility.copyStream(asInputStream(),os);
+ }
+
+ /**
+ * Deserializes this attachment into an {@link Image}.
+ *
+ * @return null if the decoding fails.
+ */
+ public final Image asImage() throws IOException {
+ // technically we should check the MIME type here, but
+ // normally images can be content-sniffed.
+ // so the MIME type check will only make us slower and draconian, both of which
+ // JAXB 2.0 isn't interested.
+ return ImageIO.read(asInputStream());
+ }
+
+
+ /**
+ * {@link AttachmentBlock} stored as SAAJ {@link AttachmentPart}.
+ */
+ private static final class SAAJImpl extends AttachmentBlock {
+ private final AttachmentPart ap;
+
+ public SAAJImpl(AttachmentPart part) {
+ this.ap = part;
+ }
+
+ public String getId() {
+ return ap.getContentId();
+ }
+
+ public String getContentType() {
+ return ap.getContentType();
+ }
+
+ public byte[] asByteArray() {
+ try {
+ return ap.getRawContentBytes();
+ } catch (SOAPException e) {
+ throw new WebServiceException(e);
+ }
+ }
+
+ public DataHandler asDataHandler() {
+ try {
+ return ap.getDataHandler();
+ } catch (SOAPException e) {
+ throw new WebServiceException(e);
+ }
+ }
+
+ public Source asSource() {
+ try {
+ return new StreamSource(ap.getRawContent());
+ } catch (SOAPException e) {
+ throw new WebServiceException(e);
+ }
+ }
+
+ public InputStream asInputStream() {
+ try {
+ return ap.getRawContent();
+ } catch (SOAPException e) {
+ throw new WebServiceException(e);
+ }
+ }
+
+ public void addTo(SOAPMessage msg) {
+ msg.addAttachmentPart(ap);
+ }
+ }
+
+ /**
+ * {@link AttachmentBlock} stored as a {@link DataHandler}.
+ */
+ private static final class DataHandlerImpl extends AttachmentBlock {
+ private final String cid;
+ private final DataHandler dh;
+
+ public DataHandlerImpl(String cid, DataHandler dh) {
+ this.cid = cid;
+ this.dh = dh;
+ }
+
+ public String getId() {
+ return cid;
+ }
+
+ public String getContentType() {
+ return dh.getContentType();
+ }
+
+ public DataHandler asDataHandler() {
+ return dh;
+ }
+
+ public InputStream asInputStream() {
+ try {
+ return dh.getInputStream();
+ } catch (IOException e) {
+ throw new WebServiceException(e);
+ }
+ }
+ }
+
+ private static final class ByteArrayImpl extends AttachmentBlock {
+ private final String cid;
+ private byte[] data;
+ private int start;
+ private int len;
+ private final String mimeType;
+
+ public ByteArrayImpl(String cid, byte[] data, int start, int len, String
mimeType) {
+ this.cid = cid;
+ this.data = data;
+ this.start = start;
+ this.len = len;
+ this.mimeType = mimeType;
+ }
+
+ public String getId() {
+ return cid;
+ }
+
+ public String getContentType() {
+ return mimeType;
+ }
+
+ public byte[] asByteArray() {
+ if(start!=0 || len!=data.length) {
+ // if our buffer isn't exact, switch to the exact one
+ byte[] exact = new byte[len];
+ System.arraycopy(data,start,exact,0,len);
+ start = 0;
+ data = exact;
+ }
+ return data;
+ }
+
+ public DataHandler asDataHandler() {
+ return new DataHandler(new
ByteArrayDataSource(data,start,len,getContentType()));
+ }
+
+ public InputStream asInputStream() {
+ return new ByteArrayInputStream(data,start,len);
+ }
+
+ public void addTo(SOAPMessage msg) throws SOAPException {
+ AttachmentPart part = msg.createAttachmentPart();
+ part.setRawContentBytes(data,start,len,getContentType());
+ part.setContentId(getId());
+ msg.addAttachmentPart(part);
+ }
+
+ public void writeTo(OutputStream os) throws IOException {
+ os.write(data,start,len);
+ }
+ }
+
+ /**
+ * {@link AttachmentPart} that stores the value as a JAXB object.
+ *
+ * TODO: if it's common for an attahchment to be written more than once,
+ * it's better to cache the marshalled result, as it is expensive operation.
+ */
+ private static final class JAXBImpl extends AttachmentBlock implements DataSource {
+ private final String id;
+ private final JAXBBridgeInfo bridgeInfo;
+ private final RuntimeContext rtContext;
+ private final String type;
+
+ public JAXBImpl(String id, JAXBBridgeInfo bridgeInfo, RuntimeContext rtContext,
String type) {
+ this.id = id;
+ this.bridgeInfo = bridgeInfo;
+ this.rtContext = rtContext;
+ this.type = type;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public String getContentType() {
+ return type;
+ }
+
+ public DataHandler asDataHandler() {
+ return new DataHandler(this);
+ }
+
+ public InputStream getInputStream() {
+ return asInputStream();
+ }
+
+ public String getName() {
+ return null;
+ }
+
+ public OutputStream getOutputStream() {
+ throw new UnsupportedOperationException();
+ }
+
+ public void writeTo(OutputStream os) {
+ bridgeInfo.serialize(rtContext.getBridgeContext(),os,null);
+ }
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/internal/AttachmentBlock.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/internal/BodyBlock.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/internal/BodyBlock.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/internal/BodyBlock.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,84 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.encoding.soap.internal;
+
+import javax.xml.transform.Source;
+
+import org.jboss.com.sun.xml.ws.encoding.jaxb.JAXBBeanInfo;
+import org.jboss.com.sun.xml.ws.encoding.jaxb.JAXBBridgeInfo;
+import org.jboss.com.sun.xml.ws.encoding.jaxb.RpcLitPayload;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPConstants;
+import org.jboss.com.sun.xml.ws.encoding.soap.message.SOAP12FaultInfo;
+import org.jboss.com.sun.xml.ws.encoding.soap.message.SOAPFaultInfo;
+
+
+/**
+ * @author WS Development Team
+ */
+public class BodyBlock {
+
+ private Object value;
+
+ public BodyBlock(Object value) {
+ this.value = value;
+ }
+
+ public BodyBlock(JAXBBeanInfo beanInfo) {
+ this.value = beanInfo;
+ }
+
+ public BodyBlock(JAXBBridgeInfo bridgeInfo) {
+ this.value = bridgeInfo;
+ }
+
+ public BodyBlock(Source source) {
+ setSource(source);
+ }
+
+ public BodyBlock(SOAPFaultInfo faultInfo) {
+ setFaultInfo(faultInfo);
+ }
+
+ public BodyBlock(RpcLitPayload rpcLoad) {
+ this.value = rpcLoad;
+ }
+
+ public void setSource(Source source) {
+ this.value = source;
+ }
+
+ public void setFaultInfo(SOAPFaultInfo faultInfo) {
+ this.value = faultInfo;
+ }
+
+ /**
+ * There is no need to have so many setter to set to an Object. Just setValue is all
that we need?
+ * @param value
+ */
+ public void setValue(Object value){
+ this.value = value;
+ }
+ public Object getValue() {
+ return value;
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/internal/BodyBlock.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/internal/DelegateBase.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/internal/DelegateBase.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/internal/DelegateBase.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,101 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.encoding.soap.internal;
+
+
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.Service;
+
+import org.jboss.com.sun.xml.ws.binding.BindingImpl;
+import org.jboss.com.sun.xml.ws.client.BindingProviderProperties;
+import org.jboss.com.sun.xml.ws.client.ContactInfoBase;
+import org.jboss.com.sun.xml.ws.client.ContactInfoListImpl;
+import org.jboss.com.sun.xml.ws.client.ContextMap;
+import org.jboss.com.sun.xml.ws.client.WSServiceDelegate;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPEncoder;
+import org.jboss.com.sun.xml.ws.pept.Delegate;
+import org.jboss.com.sun.xml.ws.pept.encoding.Decoder;
+import org.jboss.com.sun.xml.ws.pept.encoding.Encoder;
+import org.jboss.com.sun.xml.ws.pept.ept.ContactInfo;
+import org.jboss.com.sun.xml.ws.pept.ept.ContactInfoList;
+import org.jboss.com.sun.xml.ws.pept.ept.ContactInfoListIterator;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.pept.presentation.MessageStruct;
+import org.jboss.com.sun.xml.ws.pept.protocol.MessageDispatcher;
+
+import java.util.Iterator;
+
+/**
+ * @author WS Development Team
+ */
+public class DelegateBase implements Delegate {
+ protected ContactInfoList contactInfoList;
+ protected WSServiceDelegate service;
+
+ public DelegateBase() {
+ }
+
+ public DelegateBase(ContactInfoList contactInfoList) {
+ this.contactInfoList = contactInfoList;
+ }
+
+ public DelegateBase(ContactInfoList cil, WSServiceDelegate service) {
+ this(cil);
+ this.service = service;
+ }
+
+ public MessageStruct getMessageStruct() {
+ return new MessageInfoBase();
+ }
+
+ public void send(MessageStruct messageStruct) {
+ MessageInfo messageInfo = (MessageInfo) messageStruct;
+
+ // ContactInfoListIterator iterator = contactInfoList.iterator();
+ if (!contactInfoList.iterator().hasNext())
+ throw new RuntimeException("can't pickup message encoder/decoder, no
ContactInfo!");
+
+ ContextMap properties = (ContextMap)
+
messageInfo.getMetaData(BindingProviderProperties.JAXWS_CONTEXT_PROPERTY);
+ BindingProvider stub =
(BindingProvider)properties.get(BindingProviderProperties.JAXWS_CLIENT_HANDLE_PROPERTY);
+
+ BindingImpl bi = (BindingImpl)stub.getBinding();
+ String bindingId = bi.getBindingId();
+ ContactInfo contactInfo = getContactInfo(contactInfoList, bindingId);
+
+ messageInfo.setEPTFactory(contactInfo);
+ MessageDispatcher messageDispatcher =
contactInfo.getMessageDispatcher(messageInfo);
+ messageDispatcher.send(messageInfo);
+ }
+
+ private ContactInfo getContactInfo(ContactInfoList cil, String bindingId){
+ ContactInfoListIterator iter = cil.iterator();
+ while(iter.hasNext()){
+ ContactInfoBase cib = (ContactInfoBase)iter.next();
+ if(cib.getBindingId().equals(bindingId))
+ return cib;
+ }
+ //return the first one
+ return cil.iterator().next();
+ }
+}
\ No newline at end of file
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/internal/DelegateBase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/internal/HeaderBlock.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/internal/HeaderBlock.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/internal/HeaderBlock.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,46 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.encoding.soap.internal;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.xml.ws.encoding.jaxb.JAXBBridgeInfo;
+
+/**
+ * @author WS Development Team
+ */
+public class HeaderBlock {
+
+ private JAXBBridgeInfo value;
+
+ public HeaderBlock(JAXBBridgeInfo bridgeInfo) {
+ this.value = bridgeInfo;
+ }
+
+ public Object getValue() {
+ return value;
+ }
+
+ public QName getName() {
+ return value.getName();
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/internal/HeaderBlock.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/internal/InternalMessage.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/internal/InternalMessage.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/internal/InternalMessage.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,100 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.encoding.soap.internal;
+
+import javax.xml.namespace.QName;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+
+/**
+ * Represents a SOAP message with headers, a body, and attachments.
+ *
+ * @author WS Development Team
+ */
+public class InternalMessage {
+ private List<HeaderBlock> headers;
+ private Set<QName> headerSet;
+ private BodyBlock body;
+ private final Map<String,AttachmentBlock> attachments = new HashMap<String,
AttachmentBlock>();
+
+ /**
+ * @return the <code>BodyBlock</code> for this message
+ */
+ public BodyBlock getBody() {
+ return body;
+ }
+
+ public void addHeader(HeaderBlock headerBlock) {
+ if (headers == null) {
+ headers = new ArrayList<HeaderBlock>();
+ headerSet = new HashSet<QName>();
+ }
+ headers.add(headerBlock);
+ headerSet.add(headerBlock.getName());
+ }
+
+ /*
+ * Checks if a header is already present
+ */
+ public boolean isHeaderPresent(QName name) {
+ if (headerSet == null) {
+ return false;
+ }
+ return headerSet.contains(name);
+ }
+
+ /**
+ * @return a <code>List</code> of <code>HeaderBlocks</code
associated
+ * with this message
+ */
+ public List<HeaderBlock> getHeaders() {
+ return headers;
+ }
+
+ /**
+ * @param body
+ */
+ public void setBody(BodyBlock body) {
+ this.body = body;
+ }
+
+ public void addAttachment(AttachmentBlock attachment){
+ attachments.put(attachment.getId(),attachment);
+ }
+
+ public AttachmentBlock getAttachment(String contentId){
+ return attachments.get(contentId);
+ }
+
+ /**
+ * @return a <code>Map</code> of contentIds to attachments
+ */
+ public Map<String, AttachmentBlock> getAttachments() {
+ return attachments;
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/internal/InternalMessage.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/internal/MessageBlock.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/internal/MessageBlock.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/internal/MessageBlock.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,72 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.encoding.soap.internal;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @author WS Development Team
+ */
+public class MessageBlock {
+ protected QName _name;
+ protected Object _value;
+
+ public MessageBlock() {
+ }
+
+ public MessageBlock(QName name, Object value) {
+ _name = name;
+ _value = value;
+ }
+
+ public MessageBlock(QName name) {
+ _name = name;
+ }
+
+ /**
+ * @return the value of this block
+ */
+ public Object getValue() {
+ return _value;
+ }
+
+ /**
+ * @param element
+ */
+ public void setValue(Object element) {
+ _value = element;
+ }
+
+ /**
+ * @return the <code>QName</code> of this block
+ */
+ public QName getName() {
+ return _name;
+ }
+
+ /**
+ * @param name
+ */
+ public void setName(QName name) {
+ _name = name;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/internal/MessageBlock.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/internal/MessageInfoBase.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/internal/MessageInfoBase.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/internal/MessageInfoBase.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,193 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.encoding.soap.internal;
+
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.com.sun.xml.ws.pept.encoding.Decoder;
+import org.jboss.com.sun.xml.ws.pept.encoding.Encoder;
+import org.jboss.com.sun.xml.ws.pept.ept.EPTFactory;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.pept.protocol.MessageDispatcher;
+import org.jboss.com.sun.xml.ws.spi.runtime.WSConnection;
+
+
+/**
+ * @author WS Development Team
+ */
+public class MessageInfoBase implements MessageInfo {
+
+ protected Object[] _data;
+ protected Method _method;
+ protected Map _metadata;
+ protected int _messagePattern;
+ protected Object _response;
+ protected int _responseType;
+ protected EPTFactory _eptFactory;
+ protected MessageDispatcher _messageDispatcher;
+ protected Encoder _encoder;
+ protected Decoder _decoder;
+ protected WSConnection _connection;
+
+ public void setData(Object[] data) {
+ _data = data;
+ }
+
+ public Object[] getData() {
+ return _data;
+ }
+
+ public void setMethod(Method method) {
+ _method = method;
+ }
+
+ public Method getMethod() {
+ return _method;
+ }
+
+ public void setMetaData(Object name, Object value) {
+ if (_metadata == null)
+ _metadata = new HashMap();
+ _metadata.put(name, value);
+ }
+
+ public Object getMetaData(Object name) {
+ Object value = null;
+
+ if ((name != null) && (_metadata != null)) {
+ value = _metadata.get(name);
+ }
+ return value;
+ }
+
+ public int getMEP() {
+ return _messagePattern;
+ }
+
+ public void setMEP(int messagePattern) {
+ _messagePattern = messagePattern;
+ }
+
+ public int getResponseType() {
+ return _responseType;
+ }
+
+ public void setResponseType(int responseType) {
+ _responseType = responseType;
+ }
+
+ public Object getResponse() {
+ return _response;
+ }
+
+ public void setResponse(Object response) {
+ _response = response;
+ }
+
+ public EPTFactory getEPTFactory() {
+ return _eptFactory;
+ }
+
+ public void setEPTFactory(EPTFactory eptFactory) {
+ _eptFactory = eptFactory;
+ }
+
+ /*
+ * @see MessageInfo#getMessageDispatcher()
+ */
+ public MessageDispatcher getMessageDispatcher() {
+ return _messageDispatcher;
+ }
+
+ /*
+ * @see MessageInfo#getEncoder()
+ */
+ public Encoder getEncoder() {
+ return _encoder;
+ }
+
+ /*
+ * @see MessageInfo#getDecoder()
+ */
+ public Decoder getDecoder() {
+ return _decoder;
+ }
+
+ /*
+ * @see MessageInfo#getConnection()
+ */
+ public WSConnection getConnection() {
+ return _connection;
+ }
+
+ /*
+ * @see MessageInfo#setMessageDispatcher(MessageDispatcher)
+ */
+ public void setMessageDispatcher(MessageDispatcher arg0) {
+ this._messageDispatcher = arg0;
+ }
+
+ /*
+ * @see MessageInfo#setEncoder(Encoder)
+ */
+ public void setEncoder(Encoder encoder) {
+ this._encoder = encoder;
+ }
+
+ /*
+ * @see MessageInfo#setDecoder(Decoder)
+ */
+ public void setDecoder(Decoder decoder) {
+ this._decoder = decoder;
+ }
+
+ /*
+ * @see MessageInfo#setConnection(Connection)
+ */
+ public void setConnection(WSConnection connection) {
+ this._connection = connection;
+ }
+
+ public static MessageInfo copy(MessageInfo mi){
+ MessageInfoBase mib = (MessageInfoBase)mi;
+ MessageInfoBase newMi = new MessageInfoBase();
+ if(newMi._data != null){
+ Object[] data = new Object[mib._data.length];
+ int i = 0;
+ for(Object o : mib._data){
+ data[i++] = o;
+ }
+ newMi._data = data;
+ }
+ newMi.setConnection(mi.getConnection());
+ newMi.setMethod(mi.getMethod());
+ newMi.setDecoder(mi.getDecoder());
+ newMi.setEncoder(mi.getEncoder());
+ newMi.setEPTFactory(mi.getEPTFactory());
+ newMi.setMEP(mi.getMEP());
+ newMi._messageDispatcher = mib._messageDispatcher;
+ newMi._metadata = new HashMap(mib._metadata);
+ return (MessageInfo)newMi;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/internal/MessageInfoBase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/internal/SOAP12NotUnderstoodHeaderBlock.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/internal/SOAP12NotUnderstoodHeaderBlock.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/internal/SOAP12NotUnderstoodHeaderBlock.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,70 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.encoding.soap.internal;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.ws.WebServiceException;
+
+import org.jboss.com.sun.xml.ws.encoding.soap.streaming.SOAP12NamespaceConstants;
+import org.jboss.com.sun.xml.ws.encoding.soap.streaming.SOAPNamespaceConstants;
+
+
+/**
+ * SOAP 1.2 version of NotUnderstoodHeaderBlock.
+ *
+ * @author WS Development Team
+ */
+public class SOAP12NotUnderstoodHeaderBlock extends HeaderBlock {
+
+ private QName nuHeader;
+
+ // super(null) is a hack in this case
+ public SOAP12NotUnderstoodHeaderBlock(QName header) {
+ super(null);
+ nuHeader = header;
+ }
+
+ public QName getName() {
+ return new QName(SOAP12NamespaceConstants.ENVELOPE,
+ SOAP12NamespaceConstants.TAG_NOT_UNDERSTOOD);
+ }
+
+ public void write(XMLStreamWriter writer) {
+ try {
+ String prefix = "t"; // should not have been used before
<header>
+ writer.writeStartElement(
+ SOAPNamespaceConstants.NSPREFIX_SOAP_ENVELOPE,
+ SOAP12NamespaceConstants.TAG_NOT_UNDERSTOOD,
+ SOAP12NamespaceConstants.ENVELOPE);
+ writer.writeAttribute(
+ SOAP12NamespaceConstants.ATTR_NOT_UNDERSTOOD_QNAME,
+ prefix + ":" + nuHeader.getLocalPart());
+ writer.writeNamespace(prefix, nuHeader.getNamespaceURI());
+ writer.writeEndElement();
+ } catch (XMLStreamException e) {
+ throw new WebServiceException(e);
+ }
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/internal/SOAP12NotUnderstoodHeaderBlock.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/FaultCode.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/FaultCode.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/FaultCode.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,92 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.encoding.soap.message;
+
+
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAP12Constants;
+import org.jboss.com.sun.xml.ws.encoding.soap.streaming.SOAP12NamespaceConstants;
+import org.jboss.com.sun.xml.ws.encoding.soap.streaming.SOAPNamespaceConstants;
+
+import java.util.Iterator;
+
+/**
+ * SOAP 1.2 soapenv:Code
+ *
+ * <soapenv:Fault>
+ * <soapenv:Code>
+ * <soapenv:Value>soapenv:Sender</soapenv:Value>
+ * <soapenv:Subcode>
+ * <soapenv:Value>ns1:incorectRequest</Value>
+ * <soapenv:Subcode>
+ * ...
+ * </soapenv:Subcode>
+ * </soapenv:Code>
+ * </soapenv:Fault>
+ *
+ * @author Vivek Pandey
+ */
+public class FaultCode {
+ private FaultCodeEnum value;
+ private FaultSubcode subcode;
+
+ public FaultCode(FaultCodeEnum value, FaultSubcode subcode) {
+ this.value = value;
+ this.subcode = subcode;
+ }
+
+ public FaultCode(FaultCodeEnum value, Iterator<QName> subcodes) {
+ this.value = value;
+ if(subcodes.hasNext()){
+ subcode = new FaultSubcode(subcodes.next(), subcodes);
+ }
+ }
+
+ public FaultCodeEnum getValue() {
+ return value;
+ }
+
+ public FaultSubcode getSubcode() {
+ return subcode;
+ }
+
+ void write(XMLStreamWriter writer) throws XMLStreamException {
+ // <soapenv:Code>
+ writer.writeStartElement(SOAPNamespaceConstants.NSPREFIX_SOAP_ENVELOPE,
+ SOAP12Constants.QNAME_FAULT_CODE.getLocalPart(),
SOAP12NamespaceConstants.ENVELOPE);
+
+ // <soapenv:Value>
+ writer.writeStartElement(SOAPNamespaceConstants.NSPREFIX_SOAP_ENVELOPE,
+ SOAP12Constants.QNAME_FAULT_VALUE.getLocalPart(),
SOAP12NamespaceConstants.ENVELOPE);
+
+ writer.writeCharacters(value.getPrefix()+":"+value.getLocalPart());
+ writer.writeEndElement(); // </soapenv:Value>
+
+ // <soapenv:Subcode>...</soapenv:Subcode>
+ if(subcode != null)
+ subcode.write(writer);
+ writer.writeEndElement(); // </soapenv:Code>
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/FaultCode.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/FaultCodeEnum.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/FaultCodeEnum.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/FaultCodeEnum.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,72 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.encoding.soap.message;
+
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.xml.ws.encoding.soap.streaming.SOAP12NamespaceConstants;
+import org.jboss.com.sun.xml.ws.encoding.soap.streaming.SOAPNamespaceConstants;
+
+public enum FaultCodeEnum {
+ VersionMismatch(new QName(SOAP12NamespaceConstants.ENVELOPE,
"VersionMismatch", SOAPNamespaceConstants.NSPREFIX_SOAP_ENVELOPE)),
+ MustUnderstand(new QName(SOAP12NamespaceConstants.ENVELOPE,
"MustUnderstand", SOAPNamespaceConstants.NSPREFIX_SOAP_ENVELOPE)),
+ DataEncodingUnknown(new QName(SOAP12NamespaceConstants.ENVELOPE,
"DataEncodingUnknown", SOAPNamespaceConstants.NSPREFIX_SOAP_ENVELOPE)),
+ Sender(new QName(SOAP12NamespaceConstants.ENVELOPE, "Sender",
SOAPNamespaceConstants.NSPREFIX_SOAP_ENVELOPE)),
+ Receiver(new QName(SOAP12NamespaceConstants.ENVELOPE, "Receiver",
SOAPNamespaceConstants.NSPREFIX_SOAP_ENVELOPE));
+
+ private FaultCodeEnum(QName code){
+ this.code = code;
+ }
+
+ public QName value(){
+ return code;
+ }
+
+ public String getLocalPart(){
+ return code.getLocalPart();
+ }
+
+ public String getNamespaceURI(){
+ return code.getNamespaceURI();
+ }
+
+ public String getPrefix(){
+ return code.getPrefix();
+ }
+
+ public static FaultCodeEnum get(QName soapFaultCode){
+ if(VersionMismatch.code.equals(soapFaultCode))
+ return VersionMismatch;
+ else if(MustUnderstand.code.equals(soapFaultCode))
+ return MustUnderstand;
+ else if(DataEncodingUnknown.code.equals(soapFaultCode))
+ return DataEncodingUnknown;
+ else if(Sender.code.equals(soapFaultCode))
+ return Sender;
+ else if(Receiver.code.equals(soapFaultCode))
+ return Receiver;
+ return null;
+ }
+
+ private final QName code;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/FaultCodeEnum.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/FaultReason.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/FaultReason.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/FaultReason.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,69 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.encoding.soap.message;
+
+
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.stream.XMLStreamException;
+
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAP12Constants;
+import org.jboss.com.sun.xml.ws.encoding.soap.streaming.SOAP12NamespaceConstants;
+import org.jboss.com.sun.xml.ws.encoding.soap.streaming.SOAPNamespaceConstants;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Arrays;
+
+/**
+ * SOAP 1.2 Fault Reason
+ * <soapenv:Reason>
+ * <soapenv:Text xml:lang="en">...</soapenv:Text>
+ * </soapenv:Reason>
+ *
+ * @author Vivek Pandey
+ */
+public class FaultReason {
+ private List<FaultReasonText> texts;
+
+ public FaultReason(FaultReasonText... texts) {
+ assert(texts == null);
+ this.texts = Arrays.asList(texts);
+ }
+
+ public FaultReason(List<FaultReasonText> textList) {
+ texts = textList;
+ }
+
+ public List<FaultReasonText> getFaultReasonTexts(){
+ return texts;
+ }
+
+ void write(XMLStreamWriter writer) throws XMLStreamException {
+ writer.writeStartElement(SOAPNamespaceConstants.NSPREFIX_SOAP_ENVELOPE,
+ SOAP12Constants.QNAME_FAULT_REASON.getLocalPart(),
SOAP12NamespaceConstants.ENVELOPE);
+ for(FaultReasonText text:texts){
+ text.write(writer);
+ }
+ writer.writeEndElement();
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/FaultReason.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/FaultReasonText.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/FaultReasonText.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/FaultReasonText.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,68 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.encoding.soap.message;
+
+
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.stream.XMLStreamException;
+
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAP12Constants;
+import org.jboss.com.sun.xml.ws.encoding.soap.streaming.SOAP12NamespaceConstants;
+import org.jboss.com.sun.xml.ws.encoding.soap.streaming.SOAPNamespaceConstants;
+
+import java.util.Locale;
+
+/**
+ * <soapenv:Text xmlns:lang="en">
+ * ...
+ * </soapenv:Text>
+ *
+ * @author Vivek Pandey
+ */
+public class FaultReasonText {
+ private Locale language = Locale.getDefault();
+ private String value;
+
+ public FaultReasonText(String value, Locale lang) {
+ if(language != null && !language.equals(""))
+ this.language = lang;
+ this.value = value;
+ }
+
+ public Locale getLanguage() {
+ return language;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ void write(XMLStreamWriter writer) throws XMLStreamException {
+ writer.writeStartElement(SOAPNamespaceConstants.NSPREFIX_SOAP_ENVELOPE,
+ SOAP12Constants.QNAME_FAULT_REASON_TEXT.getLocalPart(),
SOAP12NamespaceConstants.ENVELOPE);
+
+ //for now we only generate "en" language
+ writer.writeAttribute("xml", SOAP12NamespaceConstants.XML_NS,
"lang", language.getLanguage());
+ writer.writeCharacters(value);
+ writer.writeEndElement();
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/FaultReasonText.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/FaultSubcode.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/FaultSubcode.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/FaultSubcode.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,101 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.encoding.soap.message;
+
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.stream.XMLStreamException;
+
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAP12Constants;
+import org.jboss.com.sun.xml.ws.encoding.soap.streaming.SOAP12NamespaceConstants;
+import org.jboss.com.sun.xml.ws.encoding.soap.streaming.SOAPNamespaceConstants;
+
+import java.util.Iterator;
+
+/**
+ * SOAP 1.2 soapenv:Code
+ *
+ * <soapenv:Fault>
+ * <soapenv:Code>
+ * <soapenv:Value>soapenv:Sender</soapenv:Value>
+ * <soapenv:Subcode>
+ * <soapenv:Value>ns1:incorectRequest</Value>
+ * <soapenv:Subcode>
+ * ...
+ * </soapenv:Subcode>
+ * </soapenv:Code>
+ * </soapenv:Fault>
+ *
+ * @author Vivek Pandey
+ */
+public class FaultSubcode {
+ private QName value;
+ private FaultSubcode subcode;
+
+ public FaultSubcode(QName value, FaultSubcode subcode) {
+ this.value = value;
+ this.subcode = subcode;
+ }
+
+ public FaultSubcode(QName value, Iterator<QName> subcodes) {
+ this.value = value;
+ if(subcodes.hasNext()){
+ subcode = new FaultSubcode(subcodes.next(), subcodes);
+ }
+ }
+
+ public QName getValue() {
+ return value;
+ }
+
+ public FaultSubcode getSubcode() {
+ return subcode;
+ }
+
+ public FaultSubcode setSubCode(FaultSubcode sc){
+ this.subcode = sc;
+ return subcode;
+ }
+
+ void write(XMLStreamWriter writer) throws XMLStreamException {
+ // <soapenv:Subcode>
+ if(value == null)
+ return;
+ writer.writeStartElement(SOAPNamespaceConstants.NSPREFIX_SOAP_ENVELOPE,
+ SOAP12Constants.QNAME_FAULT_SUBCODE.getLocalPart(),
SOAP12NamespaceConstants.ENVELOPE);
+
+ // <soapenv:Value>
+ writer.writeStartElement(SOAPNamespaceConstants.NSPREFIX_SOAP_ENVELOPE,
+ SOAP12Constants.QNAME_FAULT_VALUE.getLocalPart(),
SOAP12NamespaceConstants.ENVELOPE);
+
+ writer.setPrefix(value.getPrefix(), value.getNamespaceURI());
+ if(value.getPrefix().equals(""))
+ writer.writeCharacters(value.getLocalPart());
+ else
+
writer.writeCharacters(value.getPrefix()+":"+value.getLocalPart());
+ writer.writeEndElement(); // </soapenv:Value>
+ if(subcode != null)
+ subcode.write(writer);
+ writer.writeEndElement(); // </soapenv:Subcode>
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/FaultSubcode.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/SOAP12FaultInfo.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/SOAP12FaultInfo.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/SOAP12FaultInfo.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,238 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.encoding.soap.message;
+
+import com.sun.xml.bind.api.BridgeContext;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.Detail;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFault;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.soap.SOAPBinding;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Locale;
+
+import org.jboss.com.sun.xml.ws.encoding.jaxb.JAXBBridgeInfo;
+import org.jboss.com.sun.xml.ws.encoding.jaxb.JAXBTypeSerializer;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAP12Constants;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPEncoder;
+import org.jboss.com.sun.xml.ws.encoding.soap.streaming.SOAP12NamespaceConstants;
+import org.jboss.com.sun.xml.ws.encoding.soap.streaming.SOAPNamespaceConstants;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.server.RuntimeContext;
+import org.jboss.com.sun.xml.ws.server.ServerRtException;
+import org.jboss.com.sun.xml.ws.streaming.DOMStreamReader;
+import org.jboss.com.sun.xml.ws.util.MessageInfoUtil;
+import org.jboss.com.sun.xml.ws.util.SOAPUtil;
+import org.w3c.dom.Node;
+
+/**
+ * SOAP 1.2 soap soapFault info class
+ */
+public class SOAP12FaultInfo extends SOAPFaultInfo {
+ private FaultCode code;
+ private FaultReason reason;
+ private String node;
+ private String role;
+ private Object detail;
+
+ public SOAP12FaultInfo(FaultCode code, FaultReason reason, String node, String role,
Object detail) {
+ this.code = code;
+ this.reason = reason;
+ this.node = node;
+ this.role = role;
+ this.detail = detail;
+
+ soapFault = SOAPUtil.createSOAPFault(SOAPBinding.SOAP12HTTP_BINDING);
+ setFaultCode();
+ setFaultReason();
+ setFaultNode();
+ setFaultRole();
+ if((detail != null) && (detail instanceof Detail)){
+ Node n = soapFault.getOwnerDocument().importNode((Detail)detail, true);
+ soapFault.appendChild(n);
+ }else{
+ faultBean = (detail != null)?(JAXBBridgeInfo)detail:null;
+ }
+ }
+
+ public SOAP12FaultInfo(SOAPFault fault) {
+ this.soapFault = fault;
+
+ //fault code
+ QName fc = soapFault.getFaultCodeAsQName();
+ Iterator iter = soapFault.getFaultSubcodes();
+ code = new FaultCode(FaultCodeEnum.get(fc), iter);
+
+ try {
+ //fault reason
+ List<FaultReasonText> texts = new ArrayList<FaultReasonText>();
+ iter = soapFault.getFaultReasonLocales();
+ while(iter.hasNext()){
+ Locale lang = (Locale)iter.next();
+ String text = soapFault.getFaultReasonText(lang);
+ texts.add(new FaultReasonText(text, lang));
+ }
+ reason = new FaultReason(texts);
+
+ //node
+ node = soapFault.getFaultNode();
+
+ //role
+ role = soapFault.getFaultRole();
+
+ //detail
+ detail = soapFault.getDetail();
+ } catch (SOAPException e) {
+ e.printStackTrace(); //To change body of catch statement use File | Settings
| File Templates.
+ }
+ }
+
+ public FaultCode getFaultCode() {
+ return code;
+ }
+
+ public FaultReason getReasons() {
+ return reason;
+ }
+
+ public String getNode() {
+ return node;
+ }
+
+ public String getRole() {
+ return role;
+ }
+
+ private void setFaultRole() {
+ if (soapFault == null || role == null)
+ return;
+ try {
+ soapFault.setFaultRole(role);
+ } catch (SOAPException e) {
+ throw new WebServiceException(e);
+ }
+ }
+
+ private void setFaultNode() {
+ if (soapFault == null || node == null)
+ return;
+ try {
+ soapFault.setFaultNode(node);
+ } catch (SOAPException e) {
+ throw new WebServiceException(e);
+ }
+ }
+
+ private void setFaultReason() {
+ if (soapFault == null || reason == null)
+ return;
+ List<FaultReasonText> texts = reason.getFaultReasonTexts();
+ for (FaultReasonText text : texts) {
+ try {
+ soapFault.addFaultReasonText(text.getValue(), text.getLanguage());
+ } catch (SOAPException e) {
+ throw new WebServiceException(e);
+ }
+ }
+ }
+
+ /**
+ * add SOAP 1.2 Fault Code/Subcodes to javax.xml.soap.SOAPFault
+ */
+ private void setFaultCode() {
+ if (soapFault == null || code == null)
+ return;
+ try {
+ soapFault.setFaultCode(code.getValue().value());
+ FaultSubcode fsc = code.getSubcode();
+ while (fsc != null) {
+ soapFault.appendFaultSubcode(fsc.getValue());
+ fsc = fsc.getSubcode();
+ }
+ } catch (SOAPException e) {
+ throw new WebServiceException(e);
+ }
+ }
+
+
+ public void write(XMLStreamWriter writer, MessageInfo mi) {
+ try {
+ writer.writeStartElement(SOAPNamespaceConstants.NSPREFIX_SOAP_ENVELOPE,
+ SOAP12Constants.QNAME_SOAP_FAULT.getLocalPart(),
+ SOAP12Constants.QNAME_SOAP_FAULT.getNamespaceURI());
+ // Writing NS since this may be called without writing envelope
+ writer.writeNamespace(SOAPNamespaceConstants.NSPREFIX_SOAP_ENVELOPE,
+ SOAP12Constants.QNAME_SOAP_FAULT.getNamespaceURI());
+
+ code.write(writer); //<soapenv:Code> ... </soapenv:Code>
+ reason.write(writer);
+
+
+ //<soapenv:Node>...</soapenv:Node>
+ if (node != null) {
+ writer.writeStartElement(SOAPNamespaceConstants.NSPREFIX_SOAP_ENVELOPE,
+ SOAP12Constants.QNAME_FAULT_NODE.getLocalPart(),
SOAP12NamespaceConstants.ENVELOPE);
+ writer.writeCharacters(node);
+ writer.writeEndElement();
+ }
+
+ //<soapenv:Role>...</soapenv:Role>
+ if (role != null) {
+ writer.writeStartElement(SOAPNamespaceConstants.NSPREFIX_SOAP_ENVELOPE,
+ SOAP12Constants.QNAME_FAULT_ROLE.getLocalPart(),
SOAP12NamespaceConstants.ENVELOPE);
+ writer.writeCharacters(role);
+ writer.writeEndElement();
+ }
+
+ //<soapenv:Detail>...</soapenv:Detail>
+ if (detail != null) {
+ // Not RuntimeException, Not header soapFault
+ if (detail instanceof Detail) {
+ // SOAPFaultException
+ SOAPEncoder.serializeReader(new DOMStreamReader((Detail) detail),
writer);
+ } else if (detail instanceof JAXBBridgeInfo) {
+ // Service specific exception
+ startDetailElement(writer); // <soapenv:Detail>
+ RuntimeContext rtCtxt = MessageInfoUtil.getRuntimeContext(mi);
+ BridgeContext bridgeContext = rtCtxt.getBridgeContext();
+ ((JAXBBridgeInfo) detail).serialize(bridgeContext, writer);
+ writer.writeEndElement(); // </soapenv:Detail>
+ }
+ }
+ writer.writeEndElement(); // </soapenv:Fault>
+ } catch (XMLStreamException e) {
+ throw new ServerRtException(e);
+ }
+ }
+
+ private void startDetailElement(XMLStreamWriter writer) throws XMLStreamException {
+ writer.writeStartElement(SOAPNamespaceConstants.NSPREFIX_SOAP_ENVELOPE,
+ SOAP12Constants.QNAME_FAULT_DETAIL.getLocalPart(),
SOAP12NamespaceConstants.ENVELOPE);
+ }
+}
\ No newline at end of file
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/SOAP12FaultInfo.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/SOAPFaultInfo.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/SOAPFaultInfo.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/SOAPFaultInfo.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,102 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.encoding.soap.message;
+
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPFault;
+import javax.xml.soap.Detail;
+import javax.xml.ws.soap.SOAPBinding;
+
+import org.jboss.com.sun.xml.ws.encoding.jaxb.JAXBBridgeInfo;
+import org.jboss.com.sun.xml.ws.util.SOAPUtil;
+
+/**
+ * @author WS Development Team
+ */
+public class SOAPFaultInfo {
+
+ public SOAPFaultInfo(){}
+ /**
+ * create SOAPFaultInfo with SOAPFault
+ *
+ * @param fault
+ */
+ public SOAPFaultInfo(SOAPFault fault) {
+ this.soapFault = fault;
+ }
+
+ /**
+ * Accessor method to get the fault bean
+ *
+ * @return the JAXBBidgeInfo for this fault
+ */
+ public JAXBBridgeInfo getFaultBean() {
+ return faultBean;
+ }
+
+ /**
+ * creates SOAPFaultInfo, could be SOAP 1.1 or SOAP 1.2 fault.
+ *
+ * @param string
+ * @param code
+ * @param actor
+ * @param detail
+ * @param bindingId
+ */
+ public SOAPFaultInfo(String string, QName code, String actor, Object detail, String
bindingId) {
+ if (detail == null || detail instanceof Detail) {
+ Detail det = (detail != null) ? (Detail) detail : null;
+ soapFault = SOAPUtil.createSOAPFault(string, code, actor, det, bindingId);
+ } else {
+ soapFault = SOAPUtil.createSOAPFault(string, code, actor, null, bindingId);
+ faultBean = (JAXBBridgeInfo) detail;
+ }
+ }
+
+ public QName getCode() {
+ return soapFault.getFaultCodeAsQName();
+ }
+
+ public String getString() {
+ return soapFault.getFaultString();
+ }
+
+ public String getActor() {
+ return soapFault.getFaultActor();
+ }
+
+ public Object getDetail() {
+ if (faultBean != null)
+ return faultBean;
+
+ return soapFault.getDetail();
+ }
+
+ public SOAPFault getSOAPFault() {
+ return soapFault;
+ }
+
+ protected SOAPFault soapFault;
+ protected JAXBBridgeInfo faultBean;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/SOAPFaultInfo.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/SOAPMsgCreateException.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/SOAPMsgCreateException.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/SOAPMsgCreateException.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,39 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.encoding.soap.message;
+
+import org.jboss.com.sun.xml.ws.util.exception.JAXWSExceptionBase;
+
+/**
+ * @author WS Development Team
+ */
+public class SOAPMsgCreateException extends JAXWSExceptionBase {
+
+ public SOAPMsgCreateException(String key, Object... args) {
+ super(key, args);
+ }
+
+ public String getResourceBundleName() {
+ return "org.jboss.com.sun.xml.ws.resources.soap";
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/SOAPMsgCreateException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/SOAPMsgFactoryCreateException.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/SOAPMsgFactoryCreateException.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/SOAPMsgFactoryCreateException.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,39 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.encoding.soap.message;
+
+import org.jboss.com.sun.xml.ws.util.exception.JAXWSExceptionBase;
+
+/**
+ * @author WS Development Team
+ */
+public class SOAPMsgFactoryCreateException extends JAXWSExceptionBase {
+
+ public SOAPMsgFactoryCreateException(String key, Object... args) {
+ super(key, args);
+ }
+
+ public String getResourceBundleName() {
+ return "org.jboss.com.sun.xml.ws.resources.soap";
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/message/SOAPMsgFactoryCreateException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/server/ProviderSED.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/server/ProviderSED.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/server/ProviderSED.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,82 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.encoding.soap.server;
+
+import javax.xml.transform.Source;
+import javax.xml.ws.soap.SOAPBinding;
+
+import org.jboss.com.sun.xml.ws.binding.BindingImpl;
+import org.jboss.com.sun.xml.ws.encoding.internal.InternalEncoder;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.BodyBlock;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.InternalMessage;
+import org.jboss.com.sun.xml.ws.model.soap.SOAPRuntimeModel;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.pept.presentation.MessageStruct;
+import org.jboss.com.sun.xml.ws.server.RuntimeContext;
+import org.jboss.com.sun.xml.ws.util.MessageInfoUtil;
+
+public class ProviderSED implements InternalEncoder {
+
+ public void toMessageInfo(Object internalMessage, MessageInfo messageInfo) {
+ throw new UnsupportedOperationException();
+ }
+
+ /*
+ * Sets Source in InternalMessage's BodyBlock. If there is an exception
+ * in MessageInfo, it is set as fault in BodyBlock
+ *
+ */
+ public InternalMessage toInternalMessage(MessageInfo messageInfo) {
+ InternalMessage internalMessage = new InternalMessage();
+ switch(messageInfo.getResponseType()) {
+ case MessageStruct.NORMAL_RESPONSE :
+ Object obj = messageInfo.getResponse();
+ if (obj instanceof Source) {
+ BodyBlock bodyBlock = new BodyBlock((Source)obj);
+ internalMessage.setBody(bodyBlock);
+ } else {
+ throw new UnsupportedOperationException();
+ }
+ break;
+
+ case MessageStruct.CHECKED_EXCEPTION_RESPONSE :
+ // invoke() doesn't throw any checked exception
+ // Fallthrough
+
+ case MessageStruct.UNCHECKED_EXCEPTION_RESPONSE :
+ RuntimeContext rtContext =
MessageInfoUtil.getRuntimeContext(messageInfo);
+ BindingImpl bindingImpl =
+ (BindingImpl)rtContext.getRuntimeEndpointInfo().getBinding();
+ String bindingId = bindingImpl.getBindingId();
+ if (bindingId.equals(SOAPBinding.SOAP11HTTP_BINDING)) {
+ SOAPRuntimeModel.createFaultInBody(messageInfo.getResponse(),
+ null, null, internalMessage);
+ } else if (bindingId.equals(SOAPBinding.SOAP12HTTP_BINDING)) {
+ SOAPRuntimeModel.createSOAP12FaultInBody(messageInfo.getResponse(),
+ null, null, null, internalMessage);
+ }
+ break;
+ }
+ return internalMessage;
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/server/ProviderSED.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/server/SOAP12XMLDecoder.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/server/SOAP12XMLDecoder.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/server/SOAP12XMLDecoder.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,188 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.encoding.soap.server;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPFault;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.ws.soap.SOAPBinding;
+import javax.xml.ws.soap.SOAPFaultException;
+
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAP12Constants;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.HeaderBlock;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.InternalMessage;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.SOAP12NotUnderstoodHeaderBlock;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.server.*;
+import org.jboss.com.sun.xml.ws.streaming.XMLReader;
+import org.jboss.com.sun.xml.ws.streaming.XMLStreamReaderUtil;
+import org.jboss.com.sun.xml.ws.util.MessageInfoUtil;
+import org.jboss.com.sun.xml.ws.util.SOAPUtil;
+
+import static javax.xml.stream.XMLStreamReader.*;
+
+
+/**
+ * @author WS Development Team
+ */
+public class SOAP12XMLDecoder extends SOAPXMLDecoder {
+
+ private static final Set<String> requiredRoles = new HashSet<String>();
+
+ public SOAP12XMLDecoder() {
+
requiredRoles.add("http://www.w3.org/2003/05/soap-envelope/role/next...;
+
requiredRoles.add("http://www.w3.org/2003/05/soap-envelope/role/ulti...;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.jboss.com.sun.xml.ws.rt.encoding.soap.SOAPDecoder#decodeHeader(org.jboss.com.sun.xml.ws.streaming.XMLReader,
com.sun.pept.ept.MessageInfo, org.jboss.com.sun.xml.ws.soap.internal.InternalMessage)
+ */
+ @Override
+ protected void decodeHeader(XMLStreamReader reader, MessageInfo messageInfo,
InternalMessage request) {
+ // TODO Auto-generated method stub
+ super.decodeHeader(reader, messageInfo, request);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.com.sun.xml.ws.rt.encoding.soap.SOAPDecoder#getBodyTag()
+ */
+ @Override
+ protected QName getBodyTag() {
+ return SOAP12Constants.QNAME_SOAP_BODY;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.com.sun.xml.ws.rt.encoding.soap.SOAPDecoder#getEnvelopeTag()
+ */
+ @Override
+ protected QName getEnvelopeTag() {
+ return SOAP12Constants.QNAME_SOAP_ENVELOPE;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.com.sun.xml.ws.rt.encoding.soap.SOAPDecoder#getHeaderTag()
+ */
+ @Override
+ protected QName getHeaderTag() {
+ return SOAP12Constants.QNAME_SOAP_HEADER;
+ }
+
+ @Override
+ protected QName getMUAttrQName(){
+ return SOAP12Constants.QNAME_MUSTUNDERSTAND;
+ }
+
+ @Override
+ protected QName getRoleAttrQName(){
+ return SOAP12Constants.QNAME_ROLE;
+ }
+
+ public Set<String> getRequiredRoles() {
+ return requiredRoles;
+ }
+
+ /*
+ * Keep track of all not-understood headers to return
+ * with fault to client. In soap 1.1, the check fails
+ * on the first not-understood header.
+ */
+ @Override
+ protected void checkHeadersAgainstKnown(XMLStreamReader reader,
+ Set<String> roles, Set<QName> understoodHeaders, MessageInfo mi) {
+
+ Set<QName> notUnderstoodHeaders = new HashSet<QName>();
+
+ while (true) {
+ if (reader.getEventType() == START_ELEMENT) {
+ // check MU header for each role
+ QName qName = reader.getName();
+ String mu = reader.getAttributeValue(
+ getMUAttrQName().getNamespaceURI(),
+ getMUAttrQName().getLocalPart());
+ if (mu != null && (mu.equals("1") ||
+ mu.equalsIgnoreCase("true"))) {
+ String role = reader.getAttributeValue(
+ getRoleAttrQName().getNamespaceURI(),
+ getRoleAttrQName().getLocalPart());
+ if (role != null && roles.contains(role)) {
+ logger.finest("Element=" + qName +
+ " targeted at=" + role);
+ if (understoodHeaders == null ||
+ !understoodHeaders.contains(qName)) {
+ logger.finest("Element not understood=" + qName);
+ notUnderstoodHeaders.add(qName);
+ }
+ }
+ }
+ XMLStreamReaderUtil.skipElement(reader); // Moves to END state
+ XMLStreamReaderUtil.nextElementContent(reader);
+ } else {
+ break;
+ }
+ }
+
+ if (notUnderstoodHeaders.isEmpty()) {
+ return;
+ }
+
+ // need to add headers to fault
+ SOAPFault sf = SOAPUtil.createSOAPFault(
+ MUST_UNDERSTAND_FAULT_MESSAGE_STRING,
+ SOAP12Constants.FAULT_CODE_MUST_UNDERSTAND,
+ null, null, SOAPBinding.SOAP12HTTP_BINDING);
+ Set<HeaderBlock> nuHeaderBlocks = new HashSet<HeaderBlock>();
+ for (QName headerName : notUnderstoodHeaders) {
+ nuHeaderBlocks.add(new SOAP12NotUnderstoodHeaderBlock(headerName));
+ }
+ MessageInfoUtil.setNotUnderstoodHeaders(mi, nuHeaderBlocks);
+ throw new SOAPFaultException(sf);
+ }
+
+ @Override
+ public String getBindingId() {
+ return SOAPBinding.SOAP12HTTP_BINDING;
+ }
+
+ @Override
+ protected QName getSenderFaultCode() {
+ return SOAP12Constants.FAULT_CODE_CLIENT;
+
+ }
+
+ @Override
+ protected QName getReceiverFaultCode() {
+ return SOAP12Constants.FAULT_CODE_SERVER;
+
+ }
+
+ @Override
+ protected QName getVersionMismatchFaultCode() {
+ return SOAP12Constants.FAULT_CODE_VERSION_MISMATCH;
+ }
+
+}
+
+
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/server/SOAP12XMLDecoder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/server/SOAP12XMLEncoder.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/server/SOAP12XMLEncoder.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/server/SOAP12XMLEncoder.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,134 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.encoding.soap.server;
+
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.ws.soap.SOAPBinding;
+
+
+import static org.jboss.com.sun.xml.ws.client.BindingProviderProperties.*;
+
+import javax.xml.ws.handler.MessageContext;
+
+import org.jboss.com.sun.xml.ws.client.BindingProviderProperties;
+import org.jboss.com.sun.xml.ws.encoding.JAXWSAttachmentMarshaller;
+import org.jboss.com.sun.xml.ws.encoding.soap.message.SOAP12FaultInfo;
+import org.jboss.com.sun.xml.ws.encoding.soap.message.SOAPFaultInfo;
+import org.jboss.com.sun.xml.ws.encoding.soap.streaming.SOAP12NamespaceConstants;
+import org.jboss.com.sun.xml.ws.encoding.soap.streaming.SOAPNamespaceConstants;
+import org.jboss.com.sun.xml.ws.handler.MessageContextUtil;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.server.*;
+import org.jboss.com.sun.xml.ws.spi.runtime.WSConnection;
+import org.jboss.com.sun.xml.ws.util.MessageInfoUtil;
+
+public class SOAP12XMLEncoder extends SOAPXMLEncoder {
+ /*
+ * @see SOAPEncoder#startEnvelope(XMLStreamWriter)
+ */
+ @Override
+ protected void startEnvelope(XMLStreamWriter writer) {
+ try {
+ writer.writeStartElement(SOAPNamespaceConstants.NSPREFIX_SOAP_ENVELOPE,
+ SOAPNamespaceConstants.TAG_ENVELOPE, SOAP12NamespaceConstants.ENVELOPE);
+ writer.setPrefix(SOAPNamespaceConstants.NSPREFIX_SOAP_ENVELOPE,
+ SOAP12NamespaceConstants.ENVELOPE);
+ writer.writeNamespace(SOAPNamespaceConstants.NSPREFIX_SOAP_ENVELOPE,
+ SOAP12NamespaceConstants.ENVELOPE);
+ }
+ catch (XMLStreamException e) {
+ throw new ServerRtException(e);
+ }
+ }
+
+ /*
+ * @see SOAPEncoder#startBody(XMLStreamWriter)
+ */
+ @Override
+ protected void startBody(XMLStreamWriter writer) {
+ try {
+ writer.writeStartElement(SOAPNamespaceConstants.NSPREFIX_SOAP_ENVELOPE,
+ SOAPNamespaceConstants.TAG_BODY, SOAP12NamespaceConstants.ENVELOPE);
+ }
+ catch (XMLStreamException e) {
+ throw new ServerRtException(e);
+ }
+ }
+
+ /*
+ * @see SOAPEncoder#startHeader(XMLStreamWriter)
+ */
+ @Override
+ protected void startHeader(XMLStreamWriter writer) {
+ try {
+ writer.writeStartElement(SOAPNamespaceConstants.NSPREFIX_SOAP_ENVELOPE,
+ SOAPNamespaceConstants.TAG_HEADER, SOAP12NamespaceConstants.ENVELOPE); //
<env:Header>
+ }
+ catch (XMLStreamException e) {
+ throw new ServerRtException(e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see
org.jboss.com.sun.xml.ws.rt.server.SOAPXMLEncoder#writeFault(org.jboss.com.sun.xml.ws.soap.message.SOAPFaultInfo,
com.sun.pept.ept.MessageInfo, org.jboss.com.sun.xml.ws.streaming.XMLStreamWriter)
+ */
+ @Override
+ protected void writeFault(SOAPFaultInfo faultInfo, MessageInfo messageInfo,
XMLStreamWriter writer) {
+ if(!(faultInfo instanceof SOAP12FaultInfo))
+ return;
+ // Set a status code for Fault
+ MessageContext ctxt = MessageInfoUtil.getMessageContext(messageInfo);
+ if (MessageContextUtil.getHttpStatusCode(ctxt) == null) {
+ MessageContextUtil.setHttpStatusCode(ctxt, WSConnection.INTERNAL_ERR);
+ }
+
+ ((SOAP12FaultInfo)faultInfo).write(writer, messageInfo);
+ }
+
+ protected String getContentType(MessageInfo messageInfo,
+ JAXWSAttachmentMarshaller marshaller)
+ {
+ String contentNegotiation = (String)
+
messageInfo.getMetaData(BindingProviderProperties.CONTENT_NEGOTIATION_PROPERTY);
+
+ if (marshaller == null) {
+ marshaller = getAttachmentMarshaller(messageInfo);
+ }
+
+ if (marshaller != null && marshaller.isXopped()) {
+ return XOP_SOAP12_XML_TYPE_VALUE;
+ }
+ else {
+ return (contentNegotiation == "optimistic") ?
+ FAST_INFOSET_TYPE_SOAP12 : SOAP12_XML_CONTENT_TYPE_VALUE;
+ }
+ }
+
+ /**
+ * This method is used to create the appropriate SOAPMessage (1.1 or 1.2 using SAAJ
api).
+ * @return the BindingID associated with this encoder
+ */
+ protected String getBindingId(){
+ return SOAPBinding.SOAP12HTTP_BINDING;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/server/SOAP12XMLEncoder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/server/SOAPXMLDecoder.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/server/SOAPXMLDecoder.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/server/SOAPXMLDecoder.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,202 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.encoding.soap.server;
+
+import java.lang.reflect.Method;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.soap.SOAPFaultException;
+import javax.xml.ws.soap.SOAPBinding;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.transform.Source;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamConstants;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.ws.handler.MessageContext;
+
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPConstants;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPDecoder;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.InternalMessage;
+import org.jboss.com.sun.xml.ws.encoding.soap.message.SOAPFaultInfo;
+import org.jboss.com.sun.xml.ws.handler.HandlerContext;
+import org.jboss.com.sun.xml.ws.handler.MessageContextUtil;
+import org.jboss.com.sun.xml.ws.model.JavaMethod;
+import org.jboss.com.sun.xml.ws.model.RuntimeModel;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.server.*;
+import org.jboss.com.sun.xml.ws.streaming.SourceReaderFactory;
+import org.jboss.com.sun.xml.ws.streaming.XMLStreamReaderException;
+import org.jboss.com.sun.xml.ws.streaming.XMLStreamReaderUtil;
+import org.jboss.com.sun.xml.ws.util.MessageInfoUtil;
+import org.jboss.com.sun.xml.ws.util.SOAPUtil;
+
+
+/**
+ * @author WS Development Team
+ */
+public class SOAPXMLDecoder extends SOAPDecoder {
+
+ private static final Set<String> requiredRoles = new HashSet<String>();
+ private static final QName emptyBodyName = new QName("");
+
+ public SOAPXMLDecoder() {
+
requiredRoles.add("http://schemas.xmlsoap.org/soap/actor/next");
+ requiredRoles.add("");
+ }
+
+ /*
+ *
+ * @throws ServerRtException
+ * @see SOAPDecoder#toInternalMessage(SOAPMessage)
+ */
+ public InternalMessage toInternalMessage(SOAPMessage soapMessage, MessageInfo
messageInfo) {
+ // TODO handle exceptions, attachments
+ XMLStreamReader reader = null;
+ try {
+ InternalMessage request = new InternalMessage();
+ processAttachments(messageInfo, request, soapMessage);
+ Source source = soapMessage.getSOAPPart().getContent();
+ reader = SourceReaderFactory.createSourceReader(source,
true,getSOAPMessageCharsetEncoding(soapMessage));
+ XMLStreamReaderUtil.nextElementContent(reader);
+ decodeEnvelope(reader, request, false, messageInfo);
+ return request;
+ } catch(Exception e) {
+ if (isBadXML(e)) {
+ RuntimeContext rtCtxt = MessageInfoUtil.getRuntimeContext(messageInfo);
+ HandlerContext handlerCtxt = rtCtxt.getHandlerContext();
+ raiseBadXMLFault(handlerCtxt);
+ }
+ throw new ServerRtException("soapdecoder.err", new Object[]{e});
+ } finally {
+ if (reader != null) {
+ XMLStreamReaderUtil.close(reader);
+ }
+ }
+ }
+
+ protected boolean isBadXML(Exception e) {
+ while (e != null) {
+ if (e instanceof XMLStreamException) {
+ return true;
+ }
+ e = (e.getCause() instanceof Exception) ? (Exception)e.getCause() : null;
+ }
+ return false;
+ }
+
+
+ /*
+ * Headers from SOAPMesssage are mapped to HeaderBlocks in InternalMessage
+ * Body from SOAPMessage is skipped
+ * BodyBlock in InternalMessage is converted to JAXBTypeInfo or RpcLitPayload
+ *
+ * @throws ServerRtException
+ * @see SOAPDecoder#toInternalMessage(SOAPMessage, InternalMessage)
+ */
+ public InternalMessage toInternalMessage(SOAPMessage soapMessage,
+ InternalMessage request, MessageInfo messageInfo) {
+
+ // TODO handle exceptions, attachments
+ XMLStreamReader reader = null;
+ try {
+ processAttachments(messageInfo, request, soapMessage);
+ Source source = soapMessage.getSOAPPart().getContent();
+ reader = SourceReaderFactory.createSourceReader(source,
true,getSOAPMessageCharsetEncoding(soapMessage));
+ XMLStreamReaderUtil.nextElementContent(reader);
+ decodeEnvelope(reader, request, true, messageInfo);
+ convertBodyBlock(request, messageInfo);
+ } catch(Exception e) {
+ if (isBadXML(e)) {
+ RuntimeContext rtCtxt = MessageInfoUtil.getRuntimeContext(messageInfo);
+ HandlerContext handlerCtxt = rtCtxt.getHandlerContext();
+ raiseBadXMLFault(handlerCtxt);
+ }
+ throw new ServerRtException("soapdecoder.err", new Object[]{e});
+ } finally {
+ if (reader != null) {
+ XMLStreamReaderUtil.close(reader);
+ }
+ }
+ return request;
+ }
+
+ @Override
+ public void decodeDispatchMethod(XMLStreamReader reader, InternalMessage request,
MessageInfo messageInfo) {
+ // Operation's QName. takes care of <body/>
+ QName name = (reader.getEventType() == XMLStreamConstants.START_ELEMENT) ?
reader.getName() : emptyBodyName;
+ RuntimeContext rtCtxt = MessageInfoUtil.getRuntimeContext(messageInfo);
+ RuntimeModel rtModel = rtCtxt.getModel();
+ JavaMethod javaMethod = rtModel.getJavaMethod(name);
+ Method method = (javaMethod == null) ? null : javaMethod.getMethod();
+ if (method == null) {
+ raiseFault(getSenderFaultCode(), "Cannot find the dispatch
method");
+ }
+ MessageContext msgCtxt = MessageInfoUtil.getMessageContext(messageInfo);
+ if (msgCtxt != null) {
+ String opNsUri = rtModel.getPortTypeName().getNamespaceURI();
+ String opName = javaMethod.getOperationName();
+ MessageContextUtil.setWsdlOperation(msgCtxt, new QName(opNsUri, opName));
+ }
+ messageInfo.setMethod(method);
+ }
+
+ protected SOAPFaultInfo decodeFault(XMLStreamReader reader, InternalMessage
internalMessage,
+ MessageInfo messageInfo) {
+ raiseFault(getSenderFaultCode(), "Server cannot handle fault
message");
+ return null;
+ }
+
+ @Override
+ protected void raiseBadXMLFault(HandlerContext ctxt) {
+ MessageContextUtil.setHttpStatusCode(ctxt.getMessageContext(), 400);
+ raiseFault(getSenderFaultCode(), "Bad request");
+ }
+
+ public Set<String> getRequiredRoles() {
+ return requiredRoles;
+ }
+
+ @Override
+ public String getBindingId() {
+ return SOAPBinding.SOAP11HTTP_BINDING;
+ }
+
+ @Override
+ protected QName getSenderFaultCode() {
+ return SOAPConstants.FAULT_CODE_CLIENT;
+ }
+
+ @Override
+ protected QName getReceiverFaultCode() {
+ return SOAPConstants.FAULT_CODE_SERVER;
+ }
+
+ @Override
+ protected QName getVersionMismatchFaultCode() {
+ return SOAPConstants.FAULT_CODE_VERSION_MISMATCH;
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/server/SOAPXMLDecoder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/server/SOAPXMLEncoder.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/server/SOAPXMLEncoder.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/server/SOAPXMLEncoder.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,252 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.encoding.soap.server;
+
+import com.sun.xml.bind.api.BridgeContext;
+
+import static org.jboss.com.sun.xml.ws.client.BindingProviderProperties.*;
+
+import javax.xml.XMLConstants;
+import javax.xml.namespace.QName;
+import javax.xml.soap.Detail;
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.soap.SOAPBinding;
+
+import org.jboss.com.sun.xml.ws.client.BindingProviderProperties;
+import org.jboss.com.sun.xml.ws.encoding.JAXWSAttachmentMarshaller;
+import org.jboss.com.sun.xml.ws.encoding.jaxb.JAXBBridgeInfo;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPConstants;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPEncoder;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.InternalMessage;
+import org.jboss.com.sun.xml.ws.encoding.soap.message.SOAPFaultInfo;
+import org.jboss.com.sun.xml.ws.encoding.soap.streaming.SOAPNamespaceConstants;
+import org.jboss.com.sun.xml.ws.handler.MessageContextUtil;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.server.RuntimeContext;
+import org.jboss.com.sun.xml.ws.server.ServerRtException;
+import org.jboss.com.sun.xml.ws.spi.runtime.WSConnection;
+import org.jboss.com.sun.xml.ws.streaming.DOMStreamReader;
+import org.jboss.com.sun.xml.ws.streaming.XMLStreamWriterFactory;
+import org.jboss.com.sun.xml.ws.util.ByteArrayBuffer;
+import org.jboss.com.sun.xml.ws.util.MessageInfoUtil;
+import org.jboss.com.sun.xml.ws.util.SOAPUtil;
+
+/**
+ * @author WS Development Team
+ */
+public class SOAPXMLEncoder extends SOAPEncoder {
+
+ protected static final String FAULTCODE_NAME = "faultcode";
+ protected static final String FAULTSTRING_NAME = "faultstring";
+ protected static final String FAULTACTOR_NAME = "faultactor";
+ protected static final String DETAIL_NAME = "detail";
+
+ public SOAPXMLEncoder() {
+ }
+
+ public SOAPMessage toSOAPMessage(InternalMessage response, MessageInfo messageInfo)
{
+ XMLStreamWriter writer = null;
+ JAXWSAttachmentMarshaller marshaller = null;
+ boolean xopEnabled = false;
+
+ try {
+ setAttachmentsMap(messageInfo, response);
+ ByteArrayBuffer bab = new ByteArrayBuffer();
+
+ if (messageInfo.getMetaData(CONTENT_NEGOTIATION_PROPERTY) ==
"optimistic") {
+ writer = XMLStreamWriterFactory.createFIStreamWriter(bab);
+
+ // Turn XOP off for FI
+ marshaller = getAttachmentMarshaller(messageInfo);
+ if (marshaller != null) {
+ xopEnabled = marshaller.isXOPPackage(); // last value
+ marshaller.setXOPPackage(false);
+ }
+ }
+ else {
+ // Store output stream to use in JAXB bridge (not with FI)
+ messageInfo.setMetaData(JAXB_OUTPUTSTREAM, bab);
+ writer = XMLStreamWriterFactory.createXMLStreamWriter(bab);
+ }
+
+ writer.writeStartDocument();
+ startEnvelope(writer);
+ writeEnvelopeNamespaces(writer, messageInfo);
+ writeHeaders(writer, response, messageInfo);
+ writeBody(writer, response, messageInfo);
+ endEnvelope(writer);
+ writer.writeEndDocument();
+ writer.close();
+
+ MimeHeaders mh = new MimeHeaders();
+ mh.addHeader("Content-Type", getContentType(messageInfo,
marshaller));
+ SOAPMessage msg = SOAPUtil.createMessage(mh, bab.newInputStream(),
getBindingId());
+ processAttachments(response, msg);
+
+ // Restore default XOP processing before returning
+ if (marshaller != null) {
+ marshaller.setXOPPackage(xopEnabled);
+ }
+
+ return msg;
+ }
+ catch (Exception e) {
+ throw new ServerRtException("soapencoder.err", new Object[]{e});
+ }
+ finally {
+ if (writer != null) {
+ try {
+ writer.close();
+ }
+ catch (XMLStreamException e) {
+ throw new ServerRtException(e);
+ }
+ }
+ }
+ }
+
+ protected JAXWSAttachmentMarshaller getAttachmentMarshaller(MessageInfo messageInfo)
{
+ Object rtc =
messageInfo.getMetaData(BindingProviderProperties.JAXWS_RUNTIME_CONTEXT);
+ if (rtc != null) {
+ BridgeContext bc = ((RuntimeContext) rtc).getBridgeContext();
+ if (bc != null) {
+ return (JAXWSAttachmentMarshaller) bc.getAttachmentMarshaller();
+ }
+ }
+ return null;
+ }
+
+ protected String getContentType(MessageInfo messageInfo,
+ JAXWSAttachmentMarshaller marshaller)
+ {
+ String contentNegotiation = (String)
+
messageInfo.getMetaData(BindingProviderProperties.CONTENT_NEGOTIATION_PROPERTY);
+
+ if (marshaller == null) {
+ marshaller = getAttachmentMarshaller(messageInfo);
+ }
+
+ if (marshaller != null && marshaller.isXopped()) {
+ return XOP_SOAP11_XML_TYPE_VALUE;
+ }
+ else {
+ return (contentNegotiation == "optimistic") ?
+ FAST_INFOSET_TYPE_SOAP11 : XML_CONTENT_TYPE_VALUE;
+ }
+ }
+
+ /*
+ * writes <env:Fault> ... </env:Fault>. JAXB serializes the contents
+ * in the <detail> for service specific exceptions. We serialize protocol
+ * specific exceptions ourselves
+ */
+ protected void writeFault(SOAPFaultInfo instance, MessageInfo messageInfo,
XMLStreamWriter writer) {
+ try {
+ // Set a status code for Fault
+ MessageContext ctxt = MessageInfoUtil.getMessageContext(messageInfo);
+ if (MessageContextUtil.getHttpStatusCode(ctxt) == null) {
+ MessageContextUtil.setHttpStatusCode(ctxt, WSConnection.INTERNAL_ERR);
+ }
+
+ writer.writeStartElement(SOAPNamespaceConstants.NSPREFIX_SOAP_ENVELOPE,
+ SOAPConstants.QNAME_SOAP_FAULT.getLocalPart(),
+ SOAPConstants.QNAME_SOAP_FAULT.getNamespaceURI());
+ // Writing NS since this may be called without writing envelope
+ writer.writeNamespace(SOAPNamespaceConstants.NSPREFIX_SOAP_ENVELOPE,
+ SOAPConstants.QNAME_SOAP_FAULT.getNamespaceURI());
+
+ writer.writeStartElement(FAULTCODE_NAME); // <faultcode>
+ String prefix = SOAPNamespaceConstants.NSPREFIX_SOAP_ENVELOPE;
+ QName faultCode = instance.getCode();
+ String nsURI = faultCode.getNamespaceURI();
+ if (!nsURI.equals(SOAPNamespaceConstants.ENVELOPE)) {
+ // Need to add namespace declaration for this custom fault code
+ if (nsURI.equals(XMLConstants.NULL_NS_URI)) {
+ prefix = XMLConstants.DEFAULT_NS_PREFIX;
+ } else {
+ prefix = faultCode.getPrefix();
+ if (prefix.equals(XMLConstants.DEFAULT_NS_PREFIX)) {
+ prefix = "ans";
+ }
+ writer.setPrefix(prefix, nsURI);
+ writer.writeNamespace(prefix, nsURI);
+ }
+ }
+ if (prefix.equals(XMLConstants.DEFAULT_NS_PREFIX)) {
+ writer.writeCharacters(instance.getCode().getLocalPart());
+ } else {
+
writer.writeCharacters(prefix+":"+instance.getCode().getLocalPart());
+ }
+ writer.writeEndElement(); // </faultcode>
+
+ writer.writeStartElement(FAULTSTRING_NAME);
+ writer.writeCharacters(instance.getString());
+ writer.writeEndElement();
+
+ if (instance.getActor() != null) {
+ writer.writeStartElement(FAULTACTOR_NAME);
+ writer.writeCharacters(instance.getActor());
+ writer.writeEndElement();
+ }
+
+ Object detail = instance.getDetail();
+ if (detail != null) {
+ // Not RuntimeException, Not header fault
+ if (detail instanceof Detail) {
+ // SOAPFaultException
+ encodeDetail((Detail)detail, writer);
+ } else if (detail instanceof JAXBBridgeInfo) {
+ // Service specific exception
+ writer.writeStartElement(DETAIL_NAME);
+ writeJAXBBridgeInfo((JAXBBridgeInfo)detail, messageInfo, writer);
+ writer.writeEndElement(); // </detail>
+ }
+ }
+
+ writer.writeEndElement(); // </env:Fault>
+ }
+ catch (XMLStreamException e) {
+ throw new ServerRtException(e);
+ }
+ }
+
+ /*
+ * Serializes javax.xml.soap.Detail. Detail is of type SOAPElement.
+ * XmlTreeReader is used to traverse the SOAPElement/DOM Node and serializes
+ * the XML.
+ */
+ protected void encodeDetail(Detail detail, XMLStreamWriter writer) {
+ serializeReader(new DOMStreamReader(detail), writer);
+ }
+
+ /**
+ * This method is used to create the appropriate SOAPMessage (1.1 or 1.2 using SAAJ
api).
+ * @return the BindingID associated with this encoder
+ */
+ protected String getBindingId(){
+ return SOAPBinding.SOAP11HTTP_BINDING;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/server/SOAPXMLEncoder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/streaming/SOAP12NamespaceConstants.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/streaming/SOAP12NamespaceConstants.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/streaming/SOAP12NamespaceConstants.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,62 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.encoding.soap.streaming;
+
+/**
+ * @author WS Development Team
+ */
+public class SOAP12NamespaceConstants {
+ public static final String XML_NS =
"http://www.w3.org/XML/1998/namespace";
+ public static final String ENVELOPE =
+ "http://www.w3.org/2003/05/soap-envelope";
+ public static final String ENCODING =
+ "http://www.w3.org/2003/05/soap-encoding";
+ public static final String SOAP_RPC =
"http://www.w3.org/2002/06/soap-rpc";
+ public static final String XSD = "http://www.w3.org/2001/XMLSchema";
+ public static final String XSI =
+ "http://www.w3.org/2001/XMLSchema-instance";
+ public static final String TRANSPORT_HTTP =
+ "http://www.w3.org/2003/05/soap/bindings/HTTP/";
+
+ public static final String ACTOR_NEXT =
"http://www.w3.org/2003/05/soap-envelope/role/next";
+
+ public static final String ROLE_NEXT =
+ "http://www.w3.org/2003/05/soap-envelope/role/next";
+ public static final String ROLE_NONE =
"http://www.w3.org/2003/05/soap-envelope/role/none";
+ public static final String ROLE_ULTIMATE_RECEIVER =
"http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver";
+
+ public static final String SOAP_UPGRADE =
+ "http://www.w3.org/2002/06/soap-upgrade";
+
+ public static final String TAG_ENVELOPE = "Envelope";
+ public static final String TAG_HEADER = "Header";
+ public static final String TAG_BODY = "Body";
+ public static final String TAG_RESULT = "result";
+ public static final String TAG_NOT_UNDERSTOOD = "NotUnderstood";
+
+ public static final String ATTR_ACTOR = "role";
+ public static final String ATTR_MUST_UNDERSTAND = "mustUnderstand";
+ public static final String ATTR_MISUNDERSTOOD = "missUnderstood";
+ public static final String ATTR_ENCODING_STYLE = "encodingStyle";
+ public static final String ATTR_NOT_UNDERSTOOD_QNAME = "qname";
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/streaming/SOAP12NamespaceConstants.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/streaming/SOAPNamespaceConstants.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/streaming/SOAPNamespaceConstants.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/streaming/SOAPNamespaceConstants.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,50 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.encoding.soap.streaming;
+
+/**
+ * @author WS Development Team
+ */
+public class SOAPNamespaceConstants {
+ public static final String NSPREFIX_SOAP_ENVELOPE = "soapenv";
+ public static final String ENVELOPE =
"http://schemas.xmlsoap.org/soap/envelope/";
+ public static final String ENCODING =
+ "http://schemas.xmlsoap.org/soap/encoding/";
+ public static final String XSD = "http://www.w3.org/2001/XMLSchema";
+ public static final String XSI =
+ "http://www.w3.org/2001/XMLSchema-instance";
+ public static final String XMLNS = "http://www.w3.org/XML/1998/namespace";
+ public static final String TRANSPORT_HTTP =
+ "http://schemas.xmlsoap.org/soap/http";
+ public static final String ACTOR_NEXT =
+ "http://schemas.xmlsoap.org/soap/actor/next";
+
+ public static final String TAG_ENVELOPE = "Envelope";
+ public static final String TAG_HEADER = "Header";
+ public static final String TAG_BODY = "Body";
+ public static final String TAG_FAULT = "Fault";
+
+ public static final String ATTR_ACTOR = "actor";
+ public static final String ATTR_MUST_UNDERSTAND = "mustUnderstand";
+ public static final String ATTR_ENCODING_STYLE = "encodingStyle";
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/soap/streaming/SOAPNamespaceConstants.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/xml/XMLDecoder.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/xml/XMLDecoder.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/xml/XMLDecoder.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,115 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.encoding.xml;
+import javax.xml.stream.XMLStreamReader;
+
+
+import static javax.xml.stream.XMLStreamReader.*;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.com.sun.xml.ws.encoding.jaxb.*;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.BodyBlock;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.InternalMessage;
+import org.jboss.com.sun.xml.ws.pept.encoding.Decoder;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+
+import java.util.logging.Logger;
+
+
+
+/**
+ * @author WS Development Team
+ */
+public class XMLDecoder implements Decoder {
+
+ private static final Logger logger = Logger.getLogger(
+ org.jboss.com.sun.xml.ws.util.Constants.LoggingDomain +
".xml.decoder");
+
+ /* (non-Javadoc)
+ * @see com.sun.pept.encoding.Decoder#decode(com.sun.pept.ept.MessageInfo)
+ */
+ public void decode(MessageInfo arg0) {
+ throw new UnsupportedOperationException();
+ }
+
+ /* (non-Javadoc)
+ * @see
com.sun.pept.encoding.Decoder#receieveAndDecode(com.sun.pept.ept.MessageInfo)
+ */
+ public void receiveAndDecode(MessageInfo arg0) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * parses and binds body from xmlMessage.
+ * @param xmlMessage
+ * @param messageInfo
+ * @return InternalMessage representation of xmlMessage
+ */
+ public InternalMessage toInternalMessage(XMLMessage xmlMessage,
+ MessageInfo messageInfo) {
+ return null;
+ }
+
+ /**
+ * Parses and binds xmlMessage.
+ * @param xmlMessage
+ * @param internalMessage
+ * @param messageInfo
+ *
+ */
+ public InternalMessage toInternalMessage(XMLMessage xmlMessage,
+ InternalMessage internalMessage, MessageInfo messageInfo) {
+ return null;
+ }
+
+ public SOAPMessage toSOAPMessage(MessageInfo messageInfo) {
+ return null;
+ }
+
+ public void toMessageInfo(InternalMessage internalMessage, MessageInfo messageInfo) {
}
+
+ public void decodeDispatchMethod(XMLStreamReader reader, InternalMessage request,
MessageInfo messageInfo) {
+ }
+
+
+ /*
+ *
+ */
+ protected void convertBodyBlock(InternalMessage request, MessageInfo messageInfo) {
+ BodyBlock bodyBlock = request.getBody();
+ if (bodyBlock != null) {
+ Object value = bodyBlock.getValue();
+ if (value instanceof JAXBBeanInfo) {
+ System.out.println("******* NOT HANDLED JAXBBeanInfo
***********");
+ } else if (value instanceof XMLMessage) {
+ XMLMessage xmlMessage = (XMLMessage)value;
+ //XMLStreamReader reader = SourceReaderFactory.createSourceReader(source,
true);
+ //XMLStreamReaderUtil.nextElementContent(reader);
+ //decodeBodyContent(reader, request, messageInfo);
+ } else {
+ System.out.println("****** Unknown type in BodyBlock *****
"+value.getClass());
+ }
+ }
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/xml/XMLDecoder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/xml/XMLEPTFactory.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/xml/XMLEPTFactory.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/xml/XMLEPTFactory.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,35 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.encoding.xml;
+
+import org.jboss.com.sun.xml.ws.encoding.internal.InternalEncoder;
+import org.jboss.com.sun.xml.ws.pept.ept.EPTFactory;
+
+/**
+ * Change the name of this class to JaxwsEPTFactory or something else. OR
+ * split into multiple factories.
+ */
+public interface XMLEPTFactory extends EPTFactory {
+ public InternalEncoder getInternalEncoder();
+ public XMLEncoder getXMLEncoder();
+ public XMLDecoder getXMLDecoder();
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/xml/XMLEPTFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/xml/XMLEncoder.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/xml/XMLEncoder.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/xml/XMLEncoder.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,85 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.encoding.xml;
+import java.nio.ByteBuffer;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.jboss.com.sun.xml.ws.encoding.jaxb.JAXBBeanInfo;
+import org.jboss.com.sun.xml.ws.encoding.jaxb.JAXBTypeSerializer;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.BodyBlock;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.InternalMessage;
+import org.jboss.com.sun.xml.ws.pept.encoding.Encoder;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.server.ServerRtException;
+
+
+
+
+/**
+ * @author WS Development Team
+ */
+public class XMLEncoder implements Encoder {
+
+ /*
+ * @see com.sun.pept.encoding.Encoder#encodeAndSend(com.sun.pept.ept.MessageInfo)
+ */
+ public void encodeAndSend(MessageInfo messageInfo) {
+ throw new UnsupportedOperationException();
+ }
+
+ /*
+ * @see com.sun.pept.encoding.Encoder#encode(com.sun.pept.ept.MessageInfo)
+ */
+ public ByteBuffer encode(MessageInfo messageInfo) {
+ throw new UnsupportedOperationException();
+ }
+
+ public InternalMessage toInternalMessage(MessageInfo messageInfo) {
+ return null;
+ }
+
+ public XMLMessage toXMLMessage(InternalMessage internalMessage, MessageInfo
messageInfo) {
+ return null;
+ }
+
+ /*
+ * Replace the body in SOAPMessage with the BodyBlock of InternalMessage
+ */
+ public XMLMessage toXMLMessage(InternalMessage internalMessage,
+ XMLMessage xmlMessage) {
+ try {
+ BodyBlock bodyBlock = internalMessage.getBody();
+ Object value = bodyBlock.getValue();
+ if (value == null) {
+ return xmlMessage;
+ }
+ if (value instanceof XMLMessage) {
+ return (XMLMessage)value;
+ } else {
+ throw new UnsupportedOperationException("Unknown object in
BodyBlock:"+value.getClass());
+ }
+ } catch(Exception e) {
+ throw new ServerRtException("xmlencoder.err", new Object[]{e});
+ }
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/xml/XMLEncoder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/xml/XMLMessage.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/xml/XMLMessage.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/xml/XMLMessage.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,1103 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.encoding.xml;
+
+import org.jboss.com.sun.xml.messaging.saaj.packaging.mime.MessagingException;
+import org.jboss.com.sun.xml.messaging.saaj.packaging.mime.internet.ContentType;
+import org.jboss.com.sun.xml.messaging.saaj.packaging.mime.internet.InternetHeaders;
+import org.jboss.com.sun.xml.messaging.saaj.packaging.mime.internet.MimeBodyPart;
+import org.jboss.com.sun.xml.messaging.saaj.packaging.mime.internet.MimeMultipart;
+import org.jboss.com.sun.xml.messaging.saaj.util.ByteInputStream;
+import org.jboss.com.sun.xml.messaging.saaj.util.ByteOutputStream;
+import java.io.BufferedInputStream;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+import javax.activation.DataHandler;
+
+import javax.activation.DataSource;
+import javax.xml.bind.JAXBContext;
+import javax.xml.soap.MimeHeaders;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.http.HTTPException;
+
+import org.jboss.com.sun.xml.ws.encoding.jaxb.JAXBTypeSerializer;
+import org.jboss.com.sun.xml.ws.protocol.xml.XMLMessageException;
+import org.jboss.com.sun.xml.ws.spi.runtime.WSConnection;
+import org.jboss.com.sun.xml.ws.streaming.XMLStreamWriterFactory;
+import org.jboss.com.sun.xml.ws.util.ByteArrayBuffer;
+import org.jboss.com.sun.xml.ws.util.FastInfosetReflection;
+import org.jboss.com.sun.xml.ws.util.FastInfosetUtil;
+import org.jboss.com.sun.xml.ws.util.xml.XmlUtil;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.logging.Logger;
+
+/**
+ *
+ * @author WS Developement Team
+ */
+public final class XMLMessage {
+
+ private static final Logger log = Logger.getLogger(
+ org.jboss.com.sun.xml.ws.util.Constants.LoggingDomain +
".protocol.xml");
+
+ // So that SAAJ registers DCHs for MIME types
+ static {
+ new org.jboss.com.sun.xml.messaging.saaj.soap.AttachmentPartImpl();
+ }
+
+ private static final int PLAIN_XML_FLAG = 1; // 00001
+ private static final int MIME_MULTIPART_FLAG = 2; // 00010
+ private static final int FI_ENCODED_FLAG = 16; // 10000
+
+ private final DataRepresentation data;
+
+ /**
+ * Indicates when Fast Infoset should be used to serialize
+ * this message.
+ */
+ protected boolean useFastInfoset = false;
+
+ /**
+ * Construct a message from an input stream. When messages are
+ * received, there's two parts -- the transport headers and the
+ * message content in a transport specific stream.
+ */
+ public XMLMessage(MimeHeaders headers, final InputStream in) {
+ String ct = null;
+ if (headers != null) {
+ ct = getContentType(headers);
+ }
+ this.data = getData(ct, in);
+ // TODO should headers be set on the data?
+ }
+
+ /**
+ * Finds if the stream has some content or not
+ *
+ * @return null if there is no data
+ * else stream to be used
+ */
+ private InputStream hasSomeData(InputStream in) throws IOException {
+ if (in != null) {
+ if (in.available() < 1) {
+ if (!in.markSupported()) {
+ in = new BufferedInputStream(in);
+ }
+ in.mark(1);
+ if (in.read() != -1) {
+ in.reset();
+ } else {
+ in = null; // No data
+ }
+ }
+ }
+ return in;
+ }
+
+ private DataRepresentation getData(final String ct, InputStream in) {
+ DataRepresentation data;
+ try {
+ in = hasSomeData(in);
+ if (in == null) {
+ return new NullContent();
+ }
+ if (ct != null) {
+ ContentType contentType = new ContentType(ct);
+ int contentTypeId = identifyContentType(contentType);
+ boolean isFastInfoset = (contentTypeId & FI_ENCODED_FLAG) > 0;
+ if ((contentTypeId & MIME_MULTIPART_FLAG) != 0) {
+ data = new XMLMultiPart(ct, in, isFastInfoset);
+ } else if ((contentTypeId & PLAIN_XML_FLAG) != 0 || (contentTypeId
& FI_ENCODED_FLAG) != 0) {
+ data = new XMLSource(in, isFastInfoset);
+ } else {
+ data = new UnknownContent(ct, in);
+ }
+ } else {
+ data = new NullContent();
+ }
+ } catch(Exception ex) {
+ throw new WebServiceException(ex);
+ }
+ return data;
+ }
+
+
+ public XMLMessage(Source source, boolean useFastInfoset) {
+ this.data = (source == null) ? new NullContent() : new XMLSource(source);
+ this.useFastInfoset = useFastInfoset;
+
+ this.data.getMimeHeaders().addHeader("Content-Type",
+ useFastInfoset ? "application/fastinfoset" :
"text/xml");
+ }
+
+ public XMLMessage(Exception err, boolean useFastInfoset) {
+ this.data = new XMLErr(err);
+ this.useFastInfoset = useFastInfoset;
+
+ this.data.getMimeHeaders().addHeader("Content-Type",
+ useFastInfoset ? "application/fastinfoset" :
"text/xml");
+ }
+
+ public XMLMessage(DataSource ds, boolean useFastInfoset) {
+ this.useFastInfoset = useFastInfoset;
+ try {
+ this.data = (ds == null) ? new NullContent() : getData(ds.getContentType(),
ds.getInputStream());
+ } catch(IOException ioe) {
+ throw new WebServiceException(ioe);
+ }
+
+ String contentType = (ds != null) ? ds.getContentType() : null;
+ contentType = (contentType == null) ? contentType = "text/xml":
contentType;
+ this.data.getMimeHeaders().addHeader("Content-Type",
+ !useFastInfoset ? contentType
+ : contentType.replaceFirst("text/xml",
"application/fastinfoset"));
+ }
+
+ public XMLMessage(Object object, JAXBContext context, boolean useFastInfoset) {
+ this.data = (object == null) ? new NullContent() : new XMLJaxb(object, context);
+ this.useFastInfoset = useFastInfoset;
+
+ this.data.getMimeHeaders().addHeader("Content-Type",
+ useFastInfoset ? "application/fastinfoset" :
"text/xml");
+ }
+
+
+ public XMLMessage(Source source, Map<String, DataHandler> attachments, boolean
useFastInfoset) {
+ if (attachments == null) {
+ this.data = (source == null) ? new NullContent() : new XMLSource(source);
+ } else {
+ if (source == null) {
+ this.data = new UnknownContent(attachments);
+ } else {
+ this.data = new XMLMultiPart(source, attachments, useFastInfoset);
+ }
+ }
+
+ this.useFastInfoset = useFastInfoset;
+ this.data.getMimeHeaders().addHeader("Content-Type",
+ useFastInfoset ? "application/fastinfoset" :
"text/xml");
+ }
+
+ public XMLMessage(Object object, JAXBContext context, Map<String, DataHandler>
attachments, boolean useFastInfoset) {
+ if (attachments == null) {
+ this.data = (object == null) ? new NullContent() : new XMLJaxb(object,
context);
+ } else {
+ if (object == null) {
+ this.data = new UnknownContent(attachments);
+ } else {
+ this.data = new XMLMultiPart(JAXBTypeSerializer.serialize(object,
context), attachments, useFastInfoset);
+ }
+ }
+
+ this.useFastInfoset = useFastInfoset;
+ this.data.getMimeHeaders().addHeader("Content-Type",
+ useFastInfoset ? "application/fastinfoset" :
"text/xml");
+ }
+
+ /**
+ * Returns true if the underlying encoding of this message is FI.
+ */
+ public boolean isFastInfoset() {
+ return data.isFastInfoset();
+ }
+
+ /**
+ * Returns true if the FI encoding should be used.
+ */
+ public boolean useFastInfoset() {
+ return useFastInfoset;
+ }
+
+ /**
+ * Returns true if the sender of this message accepts FI. Slow, but
+ * should only be called once.
+ */
+ public boolean acceptFastInfoset() {
+ return
FastInfosetUtil.isFastInfosetAccepted(getMimeHeaders().getHeader("Accept"));
+ }
+
+ public Source getSource() {
+ return data.getSource();
+ }
+
+ public DataSource getDataSource() {
+ return data.getDataSource();
+ }
+
+ /**
+ * Verify a contentType.
+ *
+ * @return
+ * MIME_MULTIPART_FLAG | PLAIN_XML_FLAG
+ * MIME_MULTIPART_FLAG | FI_ENCODED_FLAG;
+ * PLAIN_XML_FLAG
+ * FI_ENCODED_FLAG
+ *
+ */
+ private static int identifyContentType(ContentType contentType) {
+ String primary = contentType.getPrimaryType();
+ String sub = contentType.getSubType();
+
+ if (primary.equalsIgnoreCase("multipart") &&
sub.equalsIgnoreCase("related")) {
+ String type = contentType.getParameter("type");
+ if (type != null) {
+ if (isXMLType(type)) {
+ return MIME_MULTIPART_FLAG | PLAIN_XML_FLAG;
+ } else if (isFastInfosetType(type)) {
+ return MIME_MULTIPART_FLAG | FI_ENCODED_FLAG;
+ }
+ }
+ return 0;
+ } else if (isXMLType(primary, sub)) {
+ return PLAIN_XML_FLAG;
+ } else if (isFastInfosetType(primary, sub)) {
+ return FI_ENCODED_FLAG;
+ }
+ return 0;
+ }
+
+ protected static boolean isXMLType(String primary, String sub) {
+ return (primary.equalsIgnoreCase("text") ||
primary.equalsIgnoreCase("application")) &&
sub.equalsIgnoreCase("xml");
+ }
+
+ protected static boolean isXMLType(String type) {
+ return type.toLowerCase().startsWith("text/xml") ||
+ type.toLowerCase().startsWith("application/xml");
+ }
+
+ protected static boolean isFastInfosetType(String primary, String sub) {
+ return primary.equalsIgnoreCase("application") &&
sub.equalsIgnoreCase("fastinfoset");
+ }
+
+ protected static boolean isFastInfosetType(String type) {
+ return type.toLowerCase().startsWith("application/fastinfoset");
+ }
+
+ /**
+ * Ideally this should be called just before writing the message
+ */
+ public MimeHeaders getMimeHeaders() {
+ return data.getMimeHeaders();
+ }
+
+ private static String getContentType(MimeHeaders headers) {
+ String[] values = headers.getHeader("Content-Type");
+ return (values == null) ? null : values[0];
+ }
+
+ public int getStatus() {
+ return data.getStatus();
+ }
+
+ public void writeTo(OutputStream out) throws IOException {
+ data.writeTo(out,useFastInfoset);
+ }
+
+ public Source getPayload() {
+ return data.getPayload();
+ }
+
+ public Map<String, DataHandler> getAttachments() {
+ return data.getAttachments();
+ }
+
+ public Object getPayload(JAXBContext context) {
+ // Get a copy of Source using getPayload() and use it to deserialize
+ // to JAXB object
+ return JAXBTypeSerializer.deserialize(getPayload(), context);
+ }
+
+ /**
+ * Defines operations available regardless of the actual in-memory data
representation.
+ */
+ private static abstract class DataRepresentation {
+ /**
+ * Can be called multiple times. Typically from XMLLogicalMessageImpl
+ */
+ abstract Source getPayload();
+
+ /**
+ * Should be called only once. Once this is called, don't use this object
anymore
+ */
+ abstract void writeTo(OutputStream out,boolean useFastInfoset) throws
IOException;
+ /**
+ * Returns true whenever the underlying representation of this message
+ * is a Fast Infoset stream.
+ */
+ abstract boolean isFastInfoset();
+
+ /**
+ * Should be called only once. Once this is called, don't use this object
anymore
+ */
+ abstract Source getSource();
+
+ /**
+ * Should be called only once. Once this is called, don't use this object
anymore
+ */
+ abstract DataSource getDataSource();
+
+ /**
+ * Should be called only once. Once this is called, don't use this object
anymore
+ */
+ abstract Map<String, DataHandler> getAttachments();
+
+ /**
+ * Should contain Content-Type for this message.
+ */
+ abstract MimeHeaders getMimeHeaders();
+ int getStatus() {
+ return WSConnection.OK;
+ }
+ }
+
+
+ /**
+ * Data represented as a multi-part MIME message. It also has XML as
+ * root part
+ *
+ * This class parses {@link MimeMultipart} lazily.
+ */
+ private static final class XMLMultiPart extends DataRepresentation {
+ private DataSource dataSource;
+ private MimeMultipart multipart;
+ private XMLSource xmlSource;
+ private boolean isFastInfoset;
+ private final MimeHeaders headers = new MimeHeaders();
+
+ public XMLMultiPart(final String contentType, final InputStream is, boolean
isFastInfoset) {
+ this.isFastInfoset = isFastInfoset;
+ dataSource = new DataSource() {
+ public InputStream getInputStream() {
+ return is;
+ }
+
+ public OutputStream getOutputStream() {
+ return null;
+ }
+
+ public String getContentType() {
+ return contentType;
+ }
+
+ public String getName() {
+ return "";
+ }
+ };
+ }
+
+ public XMLMultiPart(Source source, final Map<String, DataHandler> atts,
boolean isFastInfoset) {
+ this.isFastInfoset = isFastInfoset;
+ multipart = new MimeMultipart("related");
+ multipart.getContentType().setParameter("type",
"text/xml");
+
+ // Creates Primary part
+ ByteOutputStream bos = new ByteOutputStream();
+ new XMLSource(source).writeTo(bos, isFastInfoset);
+ InternetHeaders headers = new InternetHeaders();
+ headers.addHeader("Content-Type",
+ isFastInfoset ? "application/fastinfoset" :
"text/xml");
+ MimeBodyPart rootPart = new MimeBodyPart(headers,
bos.getBytes(),bos.getCount());
+ multipart.addBodyPart(rootPart, 0);
+
+ for(Map.Entry<String, DataHandler> e : atts.entrySet()) {
+ MimeBodyPart part = new MimeBodyPart();
+ part.setDataHandler(e.getValue());
+ multipart.addBodyPart(part);
+ }
+ }
+
+ public XMLMultiPart(DataSource dataSource, boolean isFastInfoset) {
+ this.dataSource = dataSource;
+ this.isFastInfoset = isFastInfoset;
+ }
+
+ public boolean isFastInfoset() {
+ return isFastInfoset;
+ }
+
+ public DataSource getDataSource() {
+ if (dataSource != null) {
+ return dataSource;
+ }
+ else if (multipart != null) {
+ return new DataSource() {
+ public InputStream getInputStream() {
+ try {
+ if (xmlSource != null) {
+ replaceRootPart(false);
+ }
+ ByteOutputStream bos = new ByteOutputStream();
+ multipart.writeTo(bos);
+ return bos.newInputStream();
+ } catch(MessagingException me) {
+ throw new
XMLMessageException("xml.get.ds.err",me);
+ } catch(IOException ioe) {
+ throw new
XMLMessageException("xml.get.ds.err",ioe);
+ }
+ }
+
+ public OutputStream getOutputStream() {
+ return null;
+ }
+
+ public String getContentType() {
+ return multipart.getContentType().toString();
+ }
+
+ public String getName() {
+ return "";
+ }
+ };
+ }
+ return null;
+ }
+
+ private MimeBodyPart getRootPart() {
+ try {
+ convertToMultipart();
+ ContentType contentType = multipart.getContentType();
+ String startParam = contentType.getParameter("start");
+ MimeBodyPart sourcePart = (startParam == null)
+ ? (MimeBodyPart)multipart.getBodyPart(0)
+ : (MimeBodyPart)multipart.getBodyPart(startParam);
+ return sourcePart;
+ }
+ catch (MessagingException ex) {
+ throw new XMLMessageException("xml.get.source.err",ex);
+ }
+ }
+
+ private void replaceRootPart(boolean useFastInfoset) {
+ if (xmlSource == null) {
+ return;
+ }
+ try {
+ MimeBodyPart sourcePart = getRootPart();
+ String ctype = sourcePart.getContentType();
+ multipart.removeBodyPart(sourcePart);
+
+ ByteOutputStream bos = new ByteOutputStream();
+ xmlSource.writeTo(bos, useFastInfoset);
+ InternetHeaders headers = new InternetHeaders();
+ headers.addHeader("Content-Type",
+ useFastInfoset ? "application/fastinfoset" : ctype);
+
+ sourcePart = new MimeBodyPart(headers, bos.getBytes(),bos.getCount());
+ multipart.addBodyPart(sourcePart, 0);
+ }
+ catch (MessagingException ex) {
+ throw new XMLMessageException("xml.get.source.err",ex);
+ }
+ }
+
+ private void convertToMultipart() {
+ if (dataSource != null) {
+ try {
+ multipart = new MimeMultipart(dataSource,null);
+ dataSource = null;
+ } catch (MessagingException ex) {
+ throw new XMLMessageException("xml.get.source.err",ex);
+ }
+ }
+ }
+
+ /**
+ * Returns root part of the MIME message
+ */
+ public Source getSource() {
+ try {
+ // If there is an XMLSource, return that
+ if (xmlSource != null) {
+ return xmlSource.getPayload();
+ }
+
+ // Otherwise, parse MIME package and find root part
+ convertToMultipart();
+ MimeBodyPart sourcePart = getRootPart();
+ ContentType ctype = new ContentType(sourcePart.getContentType());
+ String baseType = ctype.getBaseType();
+
+ // Return a StreamSource or FastInfosetSource depending on type
+ if (isXMLType(baseType)) {
+ return new StreamSource(sourcePart.getInputStream());
+ }
+ else if (isFastInfosetType(baseType)) {
+ return FastInfosetReflection.FastInfosetSource_new(
+ sourcePart.getInputStream());
+ }
+ else {
+ throw new XMLMessageException(
+ "xml.root.part.invalid.Content-Type",
+ new Object[] {baseType});
+ }
+ } catch (MessagingException ex) {
+ throw new XMLMessageException("xml.get.source.err",ex);
+ } catch (Exception ioe) {
+ throw new XMLMessageException("xml.get.source.err",ioe);
+ }
+ }
+
+ public Source getPayload() {
+ return getSource();
+ }
+
+ public void writeTo(OutputStream out, boolean useFastInfoset) {
+ try {
+ // If a source has been set, ensure MIME parsing
+ if (xmlSource != null) {
+ convertToMultipart();
+ }
+
+ // Try to use dataSource whenever possible
+ if (dataSource != null) {
+ // If already encoded correctly, just copy the bytes
+ if (isFastInfoset == useFastInfoset) {
+ InputStream is = dataSource.getInputStream();
+ byte[] buf = new byte[1024];
+ int len;
+ while ((len = is.read(buf)) != -1) {
+ out.write(buf, 0, len);
+ }
+ return; // we're done
+ }
+ else {
+ // Parse MIME and create source for root part
+ xmlSource = new XMLSource(getSource());
+ }
+ }
+
+ // Finally, possibly re-encode root part and write it out
+ replaceRootPart(useFastInfoset);
+ multipart.writeTo(out);
+ }
+ catch(Exception e) {
+ throw new WebServiceException(e);
+ }
+ }
+
+ public Map<String, DataHandler> getAttachments() {
+ // If a source has been set, ensure MIME parsing
+ if (xmlSource != null) {
+ convertToMultipart();
+ }
+ try {
+ MimeBodyPart rootPart = getRootPart();
+ Map<String, DataHandler> map = new HashMap<String,
DataHandler>();
+ int count = multipart.getCount();
+ for(int i=0; i < count; i++) {
+ MimeBodyPart part = multipart.getBodyPart(i);
+ if (part != rootPart) {
+ map.put(part.getContentID(), part.getDataHandler());
+ }
+ }
+ return map;
+ } catch (MessagingException ex) {
+ throw new XMLMessageException("xml.get.source.err",ex);
+ }
+ }
+
+ MimeHeaders getMimeHeaders() {
+ headers.removeHeader("Content-Type");
+ if (dataSource != null) {
+ headers.addHeader("Content-Type",
dataSource.getContentType());
+ } else {
+ if (multipart != null ) {
+ headers.addHeader("Content-Type",
multipart.getContentType().toString());
+ }
+ }
+ return headers;
+ }
+
+ }
+
+ /**
+ * Data represented as {@link Source}.
+ */
+ public static class XMLSource extends DataRepresentation {
+
+ private Source source;
+ private boolean isFastInfoset;
+ private final MimeHeaders headers = new MimeHeaders();
+
+ public XMLSource(InputStream in, boolean isFastInfoset) throws Exception {
+ this.source = isFastInfoset ?
+ FastInfosetReflection.FastInfosetSource_new(in)
+ : new StreamSource(in);
+ this.isFastInfoset = isFastInfoset;
+ }
+
+ public XMLSource(Source source) {
+ this.source = source;
+ this.isFastInfoset =
+ ((source != null)?(source.getClass() ==
FastInfosetReflection.fiFastInfosetSource):false);
+ }
+
+ public boolean isFastInfoset() {
+ return isFastInfoset;
+ }
+
+ /*
+ * If there is a ByteInputStream available, then write it to the output
+ * stream. Otherwise, use Transformer to write Source to output stream.
+ */
+ public void writeTo(OutputStream out, boolean useFastInfoset) {
+ try {
+ InputStream is = null;
+ boolean canAvoidTransform = false;
+ if (source instanceof StreamSource) {
+ is = ((StreamSource)source).getInputStream();
+ // If use of FI is requested, need to transcode
+ canAvoidTransform = !useFastInfoset;
+ }
+ else if (source.getClass() == FastInfosetReflection.fiFastInfosetSource)
{
+ is = FastInfosetReflection.FastInfosetSource_getInputStream(source);
+ // If use of FI is not requested, need to transcode
+ canAvoidTransform = useFastInfoset;
+ }
+
+ if (canAvoidTransform && is != null && is instanceof
ByteInputStream) {
+ ByteInputStream bis = (ByteInputStream)is;
+ // Reset the stream
+ byte[] buf = bis.getBytes();
+ out.write(buf);
+ bis.close();
+ return;
+ }
+
+ // TODO: Use an efficient transformer from SAAJ that knows how to
optimally
+ // write to FI results
+ Transformer transformer = XmlUtil.newTransformer();
+ transformer.transform(source,
+ useFastInfoset ? FastInfosetReflection.FastInfosetResult_new(out)
+ : new StreamResult(out));
+ }
+ catch (Exception e) {
+ throw new WebServiceException(e);
+ }
+ }
+
+ public Source getSource() {
+ return source;
+ }
+
+ DataSource getDataSource() {
+ return new DataSource() {
+ public InputStream getInputStream() {
+ try {
+ InputStream is = null;
+ if (source instanceof StreamSource) {
+ is = ((StreamSource)source).getInputStream();
+ } else if (source.getClass() ==
FastInfosetReflection.fiFastInfosetSource) {
+ is =
FastInfosetReflection.FastInfosetSource_getInputStream(source);
+ }
+ if (is != null) {
+ return is;
+ }
+ // Copy source to result respecting desired encoding
+ ByteArrayBuffer bab = new ByteArrayBuffer();
+ Transformer transformer = XmlUtil.newTransformer();
+ transformer.transform(source, isFastInfoset() ?
+ FastInfosetReflection.FastInfosetResult_new(bab)
+ : new StreamResult(bab));
+ bab.close();
+ return bab.newInputStream();
+ } catch(Exception e) {
+ throw new WebServiceException(e);
+ }
+ }
+
+ public OutputStream getOutputStream() {
+ return null;
+ }
+
+ public String getContentType() {
+ return isFastInfoset() ? "application/fastinfoset" :
"text/xml";
+ }
+
+ public String getName() {
+ return "";
+ }
+ };
+
+ }
+
+ /*
+ * Usually called from logical handler
+ * If there is a DOMSource, return that. Otherwise, return a copy of
+ * the existing source.
+ */
+ public Source getPayload() {
+ try {
+
+ if (source instanceof DOMSource) {
+ return source;
+ }
+
+ InputStream is = null;
+
+ if (source instanceof StreamSource) {
+ is = ((StreamSource)source).getInputStream();
+ }
+ else if (source.getClass() == FastInfosetReflection.fiFastInfosetSource)
{
+ is = FastInfosetReflection.FastInfosetSource_getInputStream(source);
+ }
+
+ if (is != null && is instanceof ByteInputStream) {
+ ByteInputStream bis = (ByteInputStream)is;
+ // Reset the stream
+ byte[] buf = bis.getBytes();
+
+ ByteArrayInputStream bais = new ByteArrayInputStream(buf);
+ bis.close();
+ return isFastInfoset ?
+ FastInfosetReflection.FastInfosetSource_new(is)
+ : new StreamSource(bais);
+
+ }
+
+ // Copy source to result respecting desired encoding
+ ByteArrayBuffer bab = new ByteArrayBuffer();
+ Transformer transformer = XmlUtil.newTransformer();
+ // Adding this to work with empty source. Is it JAXP bug ?
+ Properties oprops = new Properties();
+ oprops.put(OutputKeys.OMIT_XML_DECLARATION, "yes");
+ transformer.setOutputProperties(oprops);
+ transformer.transform(source, isFastInfoset ?
+ FastInfosetReflection.FastInfosetResult_new(bab)
+ : new StreamResult(bab));
+ bab.close();
+
+ // Set internal source
+ InputStream bis = (bab.size() == 0) ? null : bab.newInputStream();
+ source = isFastInfoset ?
+ FastInfosetReflection.FastInfosetSource_new(bis)
+ : new StreamSource(bis);
+
+ // Return fresh source back to handler
+ bis = bab.newInputStream();
+ return isFastInfoset ?
+ FastInfosetReflection.FastInfosetSource_new(bis)
+ : new StreamSource(bis);
+ }
+ catch (Exception e) {
+ throw new WebServiceException(e);
+ }
+ }
+
+ public Map<String, DataHandler> getAttachments() {
+ return null;
+ }
+
+ MimeHeaders getMimeHeaders() {
+ return headers;
+ }
+
+ }
+
+ /**
+ * Data represented as a JAXB object.
+ */
+ public static class XMLJaxb extends DataRepresentation {
+ private final Object object;
+ private final JAXBContext jaxbContext;
+ private final MimeHeaders headers = new MimeHeaders();
+
+ public XMLJaxb(Object object, JAXBContext jaxbContext) {
+ this.object = object;
+ this.jaxbContext = jaxbContext;
+ }
+
+ public void writeTo(OutputStream out, boolean useFastInfoset) {
+ if (useFastInfoset) {
+ JAXBTypeSerializer.serializeDocument(object,
+ XMLStreamWriterFactory.createFIStreamWriter(out),
+ jaxbContext);
+ }
+ else {
+ JAXBTypeSerializer.serialize(object, out, jaxbContext);
+ }
+ }
+
+ boolean isFastInfoset() {
+ return false;
+ }
+
+ public Source getSource() {
+ return JAXBTypeSerializer.serialize(object, jaxbContext);
+ }
+
+ DataSource getDataSource() {
+ return new DataSource() {
+ public InputStream getInputStream() {
+ ByteOutputStream bos = new ByteOutputStream();
+ JAXBTypeSerializer.serialize(object, bos, jaxbContext);
+ return bos.newInputStream();
+ }
+
+ public OutputStream getOutputStream() {
+ return null;
+ }
+
+ public String getContentType() {
+ return isFastInfoset() ? "application/fastinfoset" :
"text/xml";
+ }
+
+ public String getName() {
+ return "";
+ }
+ };
+ }
+
+ /*
+ * Usually called from logical handler
+ * If there is a DOMSource, return that. Otherwise, return a copy of
+ * the existing source.
+ */
+ public Source getPayload() {
+ return getSource();
+ }
+
+ public Map<String, DataHandler> getAttachments() {
+ return null;
+ }
+
+ MimeHeaders getMimeHeaders() {
+ return headers;
+ }
+
+ }
+
+
+ /**
+ * Don't know about this content. It's conent-type is NOT the XML types
+ * we recognize(text/xml, application/xml, multipart/related;text/xml etc).
+ *
+ * This could be used to represent image/jpeg etc
+ */
+ public static class UnknownContent extends DataRepresentation {
+ private final String ct;
+ private final InputStream in;
+ private final MimeMultipart multipart;
+ private final MimeHeaders headers = new MimeHeaders();
+
+ public UnknownContent(String ct, InputStream in) {
+ this.ct = ct;
+ this.in = in;
+ this.multipart = null;
+ }
+
+ public UnknownContent(Map<String, DataHandler> atts) {
+ this.in = null;
+ multipart = new MimeMultipart("mixed");
+ for(Map.Entry<String, DataHandler> e : atts.entrySet()) {
+ MimeBodyPart part = new MimeBodyPart();
+ part.setDataHandler(e.getValue());
+ multipart.addBodyPart(part);
+ }
+ this.ct = multipart.getContentType().toString();
+ }
+
+ public void writeTo(OutputStream out, boolean useFastInfoset) {
+ try {
+ if (multipart != null) {
+ multipart.writeTo(out);
+ }
+ byte[] buf = new byte[1024];
+ int len;
+ while ((len = in.read(buf)) != -1) {
+ out.write(buf, 0, len);
+ }
+ } catch (Exception ex) {
+ throw new WebServiceException(ex);
+ }
+ }
+
+ boolean isFastInfoset() {
+ return false;
+ }
+
+ /**
+ * NO XML content so return null
+ */
+ public Source getSource() {
+ return null;
+ }
+
+ DataSource getDataSource() {
+ return new DataSource() {
+ public InputStream getInputStream() {
+ if (multipart != null) {
+ try {
+ ByteOutputStream bos = new ByteOutputStream();
+ multipart.writeTo(bos);
+ return bos.newInputStream();
+ } catch(Exception ioe) {
+ throw new WebServiceException(ioe);
+ }
+ }
+ return in;
+ }
+
+ public OutputStream getOutputStream() {
+ return null;
+ }
+
+ public String getContentType() {
+ assert ct != null;
+ return ct;
+ }
+
+ public String getName() {
+ return "";
+ }
+ };
+ }
+
+ /**
+ * NO XML content so return null
+ */
+ public Source getPayload() {
+ return null;
+ }
+
+ /**
+ * JAXWS doesn't know about this conent. So we treate the whole content
+ * as one payload.
+ */
+ public Map<String, DataHandler> getAttachments() {
+ return null;
+ }
+
+ MimeHeaders getMimeHeaders() {
+ headers.removeHeader("Content-Type");
+ headers.addHeader("Content-Type", ct);
+ return headers;
+ }
+
+ }
+
+ /**
+ * Represents HTTPException or anyother exception
+ */
+ private static final class XMLErr extends DataRepresentation {
+ private final Exception err;
+ private final MimeHeaders headers = new MimeHeaders();
+
+ XMLErr(Exception err) {
+ this.err = err;
+ }
+
+ public Source getPayload() {
+ return null;
+ }
+
+ public Map<String, DataHandler> getAttachments() {
+ return null;
+ }
+
+ public void writeTo(OutputStream out, boolean useFastInfoset) throws IOException
{
+ String msg = err.getMessage();
+ if (msg == null) {
+ msg = err.toString();
+ }
+ msg = "<err>"+msg+"</err>";
+
+ if (useFastInfoset) {
+ FastInfosetUtil.transcodeXMLStringToFI(msg, out);
+ } else {
+ out.write(msg.getBytes());
+ }
+ }
+
+ boolean isFastInfoset() {
+ return false;
+ }
+
+ Source getSource() {
+ return null;
+ }
+
+ DataSource getDataSource() {
+ return null;
+ }
+
+ @Override
+ int getStatus() {
+ if (err instanceof HTTPException) {
+ return ((HTTPException)err).getStatusCode();
+ }
+ return WSConnection.INTERNAL_ERR;
+ }
+
+ MimeHeaders getMimeHeaders() {
+ return headers;
+ }
+ }
+
+
+ /**
+ * There is no content to write.
+ */
+ private static final class NullContent extends DataRepresentation {
+ private final MimeHeaders headers = new MimeHeaders();
+
+ public Source getPayload() {
+ return null;
+ }
+
+ public Map<String, DataHandler> getAttachments() {
+ return null;
+ }
+
+ public void writeTo(OutputStream out, boolean useFastInfoset) throws IOException
{
+ // Nothing to do
+ }
+
+ boolean isFastInfoset() {
+ return false;
+ }
+
+ Source getSource() {
+ return null;
+ }
+
+ DataSource getDataSource() {
+ return null;
+ }
+
+ MimeHeaders getMimeHeaders() {
+ return headers;
+ }
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/encoding/xml/XMLMessage.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/HandlerChainCaller.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/HandlerChainCaller.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/HandlerChainCaller.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,1062 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.handler;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFault;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.LogicalMessage;
+import javax.xml.ws.ProtocolException;
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.handler.LogicalHandler;
+import javax.xml.ws.handler.LogicalMessageContext;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPHandler;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+import javax.xml.ws.http.HTTPException;
+import javax.xml.ws.soap.SOAPFaultException;
+
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAP12Constants;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPConstants;
+import org.jboss.com.sun.xml.ws.encoding.soap.streaming.SOAP12NamespaceConstants;
+import org.jboss.com.sun.xml.ws.spi.runtime.WSConnection;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+
+/**
+ * The class stores the actual "chain" of handlers that is called
+ * during a request or response. On the client side, it is created
+ * by a {@link org.jboss.com.sun.xml.ws.binding.BindingImpl} class when a
+ * binding provider is created. On the server side, where a Binding
+ * object may be passed from an outside source, the handler chain
+ * caller may be created by the message dispatcher classes.
+ *
+ * <p>When created, a java.util.List of Handlers is passed in. This list
+ * is sorted into logical and protocol handlers, so the handler order
+ * that is returned from getHandlerChain() may be different from the
+ * original that was passed in.
+ *
+ * <p>At runtime, one of the callHandlers() methods is invoked by the
+ * soap or xml message dispatchers, passing in a {@link HandlerContext}
+ * or {@link XMLHandlerContext} object along with other information
+ * about the current message that is required for proper handler flow.
+ *
+ * <p>Exceptions are logged in many cases here before being rethrown. This
+ * is to help primarily with server side handlers.
+ *
+ * <p>Currently, the handler chain caller checks for a null soap
+ * message context to see if the binding in use is XML/HTTP.
+ *
+ * @see org.jboss.com.sun.xml.ws.binding.BindingImpl
+ * @see org.jboss.com.sun.xml.ws.protocol.soap.client.SOAPMessageDispatcher
+ * @see org.jboss.com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher
+ * @see org.jboss.com.sun.xml.ws.protocol.xml.server.XMLMessageDispatcher
+ *
+ * @author WS Development Team
+ */
+public class HandlerChainCaller {
+
+ public static final String HANDLER_CHAIN_CALLER = "handler_chain_caller";
+ public static final String IGNORE_FAULT_PROPERTY =
+ "ignore fault in message";
+
+ private static final Logger logger = Logger.getLogger(
+ org.jboss.com.sun.xml.ws.util.Constants.LoggingDomain + ".handler");
+
+ // need request or response for Handle interface
+ public enum RequestOrResponse { REQUEST, RESPONSE }
+ public enum Direction { OUTBOUND, INBOUND }
+
+ private Set<QName> understoodHeaders;
+ private List<Handler> handlers; // may be logical/soap mixed
+
+ private List<LogicalHandler> logicalHandlers;
+ private List<SOAPHandler> soapHandlers;
+
+ private Set<String> roles;
+
+ /**
+ * The handlers that are passed in will be sorted into
+ * logical and soap handlers. During this sorting, the
+ * understood headers are also obtained from any soap
+ * handlers.
+ *
+ * @param chain A list of handler objects, which can
+ * be protocol or logical handlers.
+ */
+ public HandlerChainCaller(List<Handler> chain) {
+ if (chain == null) { // should only happen in testing
+ chain = new ArrayList<Handler>();
+ }
+ handlers = chain;
+ logicalHandlers = new ArrayList<LogicalHandler>();
+ soapHandlers = new ArrayList<SOAPHandler>();
+ understoodHeaders = new HashSet<QName>();
+ sortHandlers();
+ }
+
+ /**
+ * This list may be different than the chain that is passed
+ * in since the logical and protocol handlers must be separated.
+ *
+ * @return The list of handlers, sorted by logical and then protocol.
+ */
+ public List<Handler> getHandlerChain() {
+ return handlers;
+ }
+
+ public boolean hasHandlers() {
+ return (handlers.size() != 0);
+ }
+
+ /**
+ * These are set by the SOAPBindingImpl when it creates the
+ * HandlerChainCaller or when new roles are set on the binding.
+ *
+ * @param roles A set of roles strings.
+ */
+ public void setRoles(Set<String> roles) {
+ this.roles = roles;
+ }
+
+ /**
+ * Returns the roles that were passed in by the binding
+ * in the case of soap binding.
+ */
+ public Set<String> getRoles() {
+ return roles;
+ }
+
+ /**
+ * Returns the headers understood by the handlers. This set
+ * is created when the handler chain caller is instantiated and
+ * the handlers are sorted. The set is comprised of headers
+ * returned from SOAPHandler.getHeaders() method calls.
+ *
+ * @return The set of all headers that the handlers declare
+ * that they understand.
+ */
+ public Set<QName> getUnderstoodHeaders() {
+ return understoodHeaders;
+ }
+
+ /**
+ * This method separates the logical and protocol handlers. When
+ * this method returns, the original "handlers" List has been
+ * resorted.
+ */
+ private void sortHandlers() {
+ for (Handler handler : handlers) {
+ if (LogicalHandler.class.isAssignableFrom(handler.getClass())) {
+ logicalHandlers.add((LogicalHandler) handler);
+ } else if (SOAPHandler.class.isAssignableFrom(handler.getClass())) {
+ soapHandlers.add((SOAPHandler) handler);
+ Set<QName> headers = ((SOAPHandler) handler).getHeaders();
+ if (headers != null) {
+ understoodHeaders.addAll(headers);
+ }
+ } else if (Handler.class.isAssignableFrom(handler.getClass())) {
+ throw new HandlerException(
+ "cannot.extend.handler.directly",
+ handler.getClass().toString());
+ } else {
+ throw new HandlerException("handler.not.valid.type",
+ handler.getClass().toString());
+ }
+ }
+ handlers.clear();
+ handlers.addAll(logicalHandlers);
+ handlers.addAll(soapHandlers);
+ }
+
+ /**
+ * Replace the message in the given message context with a
+ * fault message. If the context already contains a fault
+ * message, then return without changing it.
+ * Also sets the HTTP_RESPONSE_CODE in the context on Server-side.
+ */
+ private void insertFaultMessage(ContextHolder holder,
+ ProtocolException exception) {
+ try {
+ SOAPMessageContext context = holder.getSMC();
+ if (context == null) { // non-soap case
+ LogicalMessageContext lmc = holder.getLMC();
+ LogicalMessage msg = lmc.getMessage();
+ if (msg != null) {
+ msg.setPayload(null);
+ }
+ //Set Status Code only if it is on server
+ if((Boolean)lmc.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY)){
+ if (exception instanceof HTTPException) {
+
lmc.put(MessageContext.HTTP_RESPONSE_CODE,((HTTPException)exception).getStatusCode());
+ } else {
+
lmc.put(MessageContext.HTTP_RESPONSE_CODE,WSConnection.INTERNAL_ERR);
+ }
+ }
+ return;
+ }
+ //Set Status Code only if it is on server
+ if((Boolean)context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY)){
+
context.put(MessageContext.HTTP_RESPONSE_CODE,WSConnection.INTERNAL_ERR);
+ }
+ SOAPMessage message = context.getMessage();
+ SOAPEnvelope envelope = message.getSOAPPart().getEnvelope();
+ SOAPBody body = envelope.getBody();
+ if (body.hasFault()) {
+ return;
+ }
+ if (envelope.getHeader() != null) {
+ envelope.getHeader().detachNode();
+ }
+
+ body.removeContents();
+ SOAPFault fault = body.addFault();
+ String envelopeNamespace = envelope.getNamespaceURI();
+
+ if (exception instanceof SOAPFaultException) {
+ SOAPFaultException sfe = (SOAPFaultException) exception;
+ SOAPFault userFault = sfe.getFault();
+
+ QName faultCode = userFault.getFaultCodeAsQName();
+ if (faultCode == null) {
+ faultCode = determineFaultCode(context);
+ }
+ fault.setFaultCode(faultCode);
+
+ String faultString = userFault.getFaultString();
+ if (faultString == null) {
+ if (sfe.getMessage() != null) {
+ faultString = sfe.getMessage();
+ } else {
+ faultString = sfe.toString();
+ }
+ }
+ fault.setFaultString(faultString);
+
+ String faultActor = userFault.getFaultActor();
+ if (faultActor == null) {
+ faultActor = "";
+ }
+ fault.setFaultActor(faultActor);
+
+ if (userFault.getDetail() != null) {
+ fault.addChildElement(userFault.getDetail());
+ }
+ } else {
+ fault.setFaultCode(determineFaultCode(context));
+ if (exception.getMessage() != null) {
+ fault.setFaultString(exception.getMessage());
+ } else {
+ fault.setFaultString(exception.toString());
+ }
+ }
+ } catch (Exception e) {
+ // severe since this is from runtime and not handler
+ logger.log(Level.SEVERE,
+ "exception while creating fault message in handler chain", e);
+ throw new RuntimeException(e);
+ }
+ }
+
+
+
+ /**
+ * <p>The expectation of the rest of the code is that,
+ * if a ProtocolException is thrown from the handler chain,
+ * the message contents reflect the protocol exception.
+ * However, if a new ProtocolException is thrown from
+ * the handleFault method, then the fault should be
+ * ignored and the new exception should be dispatched.
+ *
+ * <p>This method simply sets a property that is checked
+ * by the client and server code when a ProtocolException
+ * is caught. The property can be checked with
+ * {@link MessageContextUtil#ignoreFaultInMessage}
+ */
+ private void addIgnoreFaultProperty(ContextHolder holder) {
+ LogicalMessageContext context = holder.getLMC();
+ context.put(IGNORE_FAULT_PROPERTY, Boolean.TRUE);
+ }
+
+ /**
+ * <p>Figure out if the fault code local part is client,
+ * server, sender, receiver, etc. This is called by
+ * insertFaultMessage.
+ *
+ * <p>This method should only be called when there is a ProtocolException
+ * during request. Reverse the Message direction first,
+ * So this method can use the MESSAGE_OUTBOUND_PROPERTY
+ * to determine whether it is being called on the client
+ * or the server side. If this changes in the spec, then
+ * something else will need to be passed to the method
+ * to determine whether the fault code is client or server.
+ *
+ * <p>For determining soap version, start checking with the
+ * latest version and default to soap 1.1.
+ */
+ private QName determineFaultCode(SOAPMessageContext context)
+ throws SOAPException {
+
+ SOAPEnvelope envelope =
+ context.getMessage().getSOAPPart().getEnvelope();
+ String uri = envelope.getNamespaceURI();
+
+ // client case
+ if (!(Boolean) context.get(
+ MessageContext.MESSAGE_OUTBOUND_PROPERTY)) {
+ if (uri.equals(SOAP12NamespaceConstants.ENVELOPE)) {
+ return SOAP12Constants.FAULT_CODE_CLIENT;
+ }
+ return SOAPConstants.FAULT_CODE_CLIENT;
+ }
+
+ //server case
+ if (uri.equals(SOAP12NamespaceConstants.ENVELOPE)) {
+ return SOAP12Constants.FAULT_CODE_SERVER;
+ }
+ return SOAPConstants.FAULT_CODE_SERVER;
+ }
+
+ /**
+ * <p>Method used to call handlers with a HandlerContext that
+ * may contain logical and protocol handlers. This is the
+ * main entry point for calling the handlers in the case
+ * of SOAP binding. Before calling the handlers, the
+ * handler chain caller will set the outbound property and
+ * the roles on the message context.
+ *
+ * <p>Besides the context object passed in, the other information
+ * is used to control handler execution and closing. See the
+ * handler section of the spec for the rules concering handlers
+ * returning false, throwing exceptions, etc.
+ *
+ * @param direction Inbound or outbound.
+ * @param messageType Request or response.
+ * @param context A soap handler context containing the message.
+ * @param responseExpected A boolean indicating whether or not
+ * a response is expected to the current message (should be false
+ * for responses or one-way requests).
+ *
+ * @return True in the normal case, false if a handler
+ * returned false. This normally means that the runtime
+ * should reverse direction if called during a request.
+ */
+ public boolean callHandlers(Direction direction,
+ RequestOrResponse messageType,
+ SOAPHandlerContext context,
+ boolean responseExpected) {
+
+ return internalCallHandlers(direction, messageType,
+ new ContextHolder(context), responseExpected);
+ }
+
+ /**
+ * Method used to call handlers with a HandlerContext that
+ * may contain logical handlers only. This is the
+ * main entry point for calling the handlers in the case
+ * of http binding. Before calling the handlers, the
+ * handler chain caller will set the outbound property on
+ * the message context.
+ *
+ * <p>Besides the context object passed in, the other information
+ * is used to control handler execution and closing. See the
+ * handler section of the spec for the rules concering handlers
+ * returning false, throwing exceptions, etc.
+ *
+ * @param direction Inbound or outbound.
+ * @param messageType Request or response.
+ * @param context A soap handler context containing the message.
+ * @param responseExpected A boolean indicating whether or not
+ * a response is expected to the current message (should be false
+ * for responses or one-way requests).
+ *
+ * @return True in the normal case, false if a handler
+ * returned false. This normally means that the runtime
+ * should reverse direction if called during a request.
+ */
+ public boolean callHandlers(Direction direction,
+ RequestOrResponse messageType,
+ XMLHandlerContext context,
+ boolean responseExpected) {
+
+ return internalCallHandlers(direction, messageType,
+ new ContextHolder(context), responseExpected);
+ }
+
+ /**
+ * Main runtime method, called internally by the callHandlers()
+ * methods that may be called with HandlerContext or
+ * XMLHandlerContext objects.
+ *
+ * The boolean passed in is whether or not a response is required
+ * for the current message. See section 5.3.2. (todo: this section
+ * is going to change).
+ *
+ * The callLogicalHandlers and callProtocolHandlers methods will
+ * take care of execution once called and return true or false or
+ * throw an exception.
+ */
+ private boolean internalCallHandlers(Direction direction,
+ RequestOrResponse messageType,
+ ContextHolder ch,
+ boolean responseExpected) {
+
+ // set outbound property
+ ch.getLMC().put(MessageContext.MESSAGE_OUTBOUND_PROPERTY,
+ (direction == Direction.OUTBOUND));
+
+ // if there is as soap message context, set roles
+ if (ch.getSMC() != null) {
+ ((SOAPMessageContextImpl) ch.getSMC()).setRoles(getRoles());
+ }
+
+ // call handlers
+ if (direction == Direction.OUTBOUND) {
+ if (callLogicalHandlers(ch, direction, messageType,
+ responseExpected) == false) {
+ return false;
+ }
+ if (callProtocolHandlers(ch, direction, messageType,
+ responseExpected) == false) {
+ return false;
+ }
+ } else {
+ if (callProtocolHandlers(ch, direction, messageType,
+ responseExpected) == false) {
+ return false;
+ }
+ if (callLogicalHandlers(ch, direction, messageType,
+ responseExpected) == false) {
+ return false;
+ }
+ }
+
+ /*
+ * Close if MEP finished. Server code responsible for closing
+ * handlers if it determines that an incoming request is a
+ * one way message.
+ */
+ if (!responseExpected) {
+ if (messageType == RequestOrResponse.REQUEST) {
+ if (direction == Direction.INBOUND) {
+ closeHandlersServer(ch);
+ } else {
+ closeHandlersClient(ch);
+ }
+ } else {
+ if (direction == Direction.INBOUND) {
+ closeHandlersClient(ch);
+ } else {
+ closeHandlersServer(ch);
+ }
+ }
+ }
+ return true;
+ }
+
+ /**
+ * This method called by the server when an endpoint has thrown
+ * an exception. This method calls handleFault on the handlers
+ * and closes them. Because this method is called only during
+ * a response after the endpoint has been reached, all of the
+ * handlers have been called during the request and so all are
+ * closed.
+ */
+ public boolean callHandleFault(SOAPHandlerContext context) {
+ ContextHolder ch = new ContextHolder(context);
+ ch.getSMC().put(MessageContext.MESSAGE_OUTBOUND_PROPERTY, true);
+ ((SOAPMessageContextImpl) ch.getSMC()).setRoles(getRoles());
+
+ int i = 0; // counter for logical handlers
+ int j = 0; // counter for protocol handlers
+ try {
+ while (i < logicalHandlers.size()) {
+ if (logicalHandlers.get(i).handleFault(ch.getLMC()) == false) {
+ return false;
+ }
+ i++;
+ }
+ while (j < soapHandlers.size()) {
+ if (soapHandlers.get(j).handleFault(ch.getSMC()) == false) {
+ return false;
+ }
+ j++;
+ }
+ } catch (RuntimeException re) {
+ logger.log(Level.FINER, "exception in handler chain", re);
+ throw re;
+ } finally {
+ closeHandlersServer(ch); // this is always called on server side
+ }
+ return true;
+ }
+
+ /**
+ * This method called by the client when it sees a SOAPFault message.
+ * This method calls handleFault on the handlers and closes them. Because
+ * this method is called only during a response, all of the handlers have
+ * been called during the request and so all are closed.
+ */
+ public boolean callHandleFaultOnClient(SOAPHandlerContext context) {
+ ContextHolder ch = new ContextHolder(context);
+ ch.getSMC().put(MessageContext.MESSAGE_OUTBOUND_PROPERTY, false);
+ ((SOAPMessageContextImpl) ch.getSMC()).setRoles(getRoles());
+
+ try {
+ for (int i=soapHandlers.size()-1; i>=0; i--) {
+ if (soapHandlers.get(i).handleFault(ch.getSMC()) == false) {
+ return false;
+ }
+ }
+ for (int i=logicalHandlers.size()-1; i>=0; i--) {
+ if (logicalHandlers.get(i).handleFault(ch.getLMC()) == false) {
+ return false;
+ }
+ }
+ } catch (RuntimeException re) {
+ logger.log(Level.FINER, "exception in handler chain", re);
+ throw re;
+ } finally {
+ closeHandlersClient(ch);
+ }
+ return true;
+ }
+
+
+ /**
+ * Called from the main callHandlers() method.
+ * Logical message context updated before this method is called.
+ */
+ private boolean callLogicalHandlers(ContextHolder holder,
+ Direction direction, RequestOrResponse type, boolean responseExpected) {
+
+ if (direction == Direction.OUTBOUND) {
+ int i = 0;
+ try {
+ while (i < logicalHandlers.size()) {
+ if (logicalHandlers.get(i).
+ handleMessage(holder.getLMC()) == false) {
+ if (responseExpected) {
+ // reverse and call handle message
+
holder.getLMC().put(MessageContext.MESSAGE_OUTBOUND_PROPERTY,false);
+ callLogicalHandleMessage(holder, i-1, 0);
+ }
+ if (type == RequestOrResponse.RESPONSE) {
+ closeHandlersServer(holder);
+ } else {
+ closeLogicalHandlers(holder, i, 0);
+ }
+ return false;
+ }
+ i++;
+ }
+ } catch (RuntimeException re) {
+ logger.log(Level.FINER, "exception in handler chain", re);
+ if (responseExpected && re instanceof ProtocolException) {
+ // reverse direction and handle fault
+ holder.getLMC().put(MessageContext.MESSAGE_OUTBOUND_PROPERTY,false);
+ insertFaultMessage(holder, (ProtocolException) re);
+ if (i>0) {
+ try {
+ callLogicalHandleFault(holder, i-1, 0);
+ } catch (ProtocolException re1) {
+ addIgnoreFaultProperty(holder);
+ re = re1;
+ } catch (RuntimeException re2) {
+ re = re2;
+ }
+ }
+ }
+ if (type == RequestOrResponse.RESPONSE) {
+ closeHandlersServer(holder);
+ } else {
+ closeLogicalHandlers(holder, i, 0);
+ }
+ throw re;
+ }
+ } else { // inbound case, H(x) -> H(x-1) -> ... H(1) -> H(0)
+ int i = logicalHandlers.size()-1;
+ try {
+ while (i >= 0) {
+ if (logicalHandlers.get(i).
+ handleMessage(holder.getLMC()) == false) {
+
+ if (responseExpected) {
+ // reverse and call handle message/response
+
holder.getLMC().put(MessageContext.MESSAGE_OUTBOUND_PROPERTY,true);
+ callLogicalHandleMessage(holder, i+1,
+ logicalHandlers.size()-1);
+ callProtocolHandleMessage(holder, 0,
+ soapHandlers.size()-1);
+ }
+ if (type == RequestOrResponse.RESPONSE) {
+ closeHandlersClient(holder);
+ } else {
+ closeLogicalHandlers(holder, i,
+ logicalHandlers.size()-1);
+ closeProtocolHandlers(holder, 0,
+ soapHandlers.size()-1);
+ }
+ return false;
+ }
+ i--;
+ }
+ } catch (RuntimeException re) {
+ logger.log(Level.FINER, "exception in handler chain", re);
+ if (responseExpected && re instanceof ProtocolException) {
+ // reverse direction and handle fault
+ holder.getLMC().put(MessageContext.MESSAGE_OUTBOUND_PROPERTY,true);
+ insertFaultMessage(holder, (ProtocolException) re);
+
+ try {
+ // if i==size-1, no more logical handlers to call
+ if (i == logicalHandlers.size()-1 ||
+ callLogicalHandleFault(holder, i+1,
+ logicalHandlers.size()-1)) {
+ callProtocolHandleFault(holder, 0,
+ soapHandlers.size()-1);
+ }
+ } catch (ProtocolException re1) {
+ addIgnoreFaultProperty(holder);
+ re = re1;
+ } catch (RuntimeException re2) {
+ re = re2;
+ }
+ }
+ if (type == RequestOrResponse.RESPONSE) {
+ closeHandlersClient(holder);
+ } else {
+ closeLogicalHandlers(holder, i, logicalHandlers.size()-1);
+ closeProtocolHandlers(holder, 0, soapHandlers.size()-1);
+ }
+ throw re;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * Called from the main callHandlers() method.
+ * SOAP message context updated before this method is called.
+ */
+ private boolean callProtocolHandlers(ContextHolder holder,
+ Direction direction, RequestOrResponse type, boolean responseExpected) {
+
+ if (direction == Direction.OUTBOUND) {
+ int i = 0;
+ try {
+ while (i<soapHandlers.size()) {
+ if (soapHandlers.get(i).
+ handleMessage(holder.getSMC()) == false) {
+
+ if (responseExpected) {
+ // reverse and call handle message/response
+
holder.getSMC().put(MessageContext.MESSAGE_OUTBOUND_PROPERTY,false);
+ if (i>0) {
+ callProtocolHandleMessage(holder, i-1, 0);
+ }
+ callLogicalHandleMessage(holder,
+ logicalHandlers.size()-1, 0);
+ }
+ if (type == RequestOrResponse.RESPONSE) {
+ closeHandlersServer(holder);
+ } else {
+ closeProtocolHandlers(holder, i, 0);
+ closeLogicalHandlers(holder,
+ logicalHandlers.size()-1 , 0);
+ }
+ return false;
+ }
+ i++;
+ }
+ } catch (RuntimeException re) {
+ logger.log(Level.FINER, "exception in handler chain", re);
+ if (responseExpected && re instanceof ProtocolException) {
+ // reverse direction and handle fault
+ holder.getSMC().put(MessageContext.MESSAGE_OUTBOUND_PROPERTY,false);
+ insertFaultMessage(holder, (ProtocolException) re);
+ try {
+ if (i == 0 || // still on first handler
+ callProtocolHandleFault(holder, i-1, 0)) {
+ callLogicalHandleFault(holder,
+ logicalHandlers.size()-1, 0);
+ }
+ } catch (ProtocolException re1) {
+ addIgnoreFaultProperty(holder);
+ re = re1;
+ } catch (RuntimeException re2) {
+ re = re2;
+ }
+ }
+ if (type == RequestOrResponse.RESPONSE) {
+ closeHandlersServer(holder);
+ } else {
+ closeProtocolHandlers(holder, i, 0);
+ closeLogicalHandlers(holder, logicalHandlers.size()-1, 0);
+ }
+ throw re;
+ }
+ } else { // inbound case, H(x) -> H(x-1) -> ... H(1) -> H(0)
+ int i = soapHandlers.size()-1;
+ try {
+ while (i >= 0) {
+ if (soapHandlers.get(i).
+ handleMessage(holder.getSMC()) == false) {
+
+ // reverse and call handle message/response
+
holder.getSMC().put(MessageContext.MESSAGE_OUTBOUND_PROPERTY,true);
+ if (responseExpected && i != soapHandlers.size()-1) {
+ callProtocolHandleMessage(holder, i+1,
+ soapHandlers.size()-1);
+ }
+ if (type == RequestOrResponse.RESPONSE) {
+ closeHandlersClient(holder);
+ } else {
+ closeProtocolHandlers(holder, i,
+ soapHandlers.size()-1);
+ }
+ return false;
+ }
+ i--;
+ }
+ } catch (RuntimeException re) {
+ logger.log(Level.FINER, "exception in handler chain", re);
+ if (responseExpected && re instanceof ProtocolException) {
+ // reverse direction and handle fault
+ holder.getSMC().put(MessageContext.MESSAGE_OUTBOUND_PROPERTY,true);
+ insertFaultMessage(holder, (ProtocolException) re);
+ try {
+ if (i < soapHandlers.size()-1) {
+ callProtocolHandleFault(holder, i+1,
+ soapHandlers.size()-1);
+ }
+ } catch (ProtocolException re1) {
+ addIgnoreFaultProperty(holder);
+ re = re1;
+ } catch (RuntimeException re2) {
+ re = re2;
+ }
+ }
+ if (type == RequestOrResponse.RESPONSE) {
+ closeHandlersClient(holder);
+ } else {
+ closeProtocolHandlers(holder, i, soapHandlers.size()-1);
+ }
+ throw re;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Method called for abnormal processing (for instance, as the
+ * result of a handler returning false during normal processing).
+ * Start and end indices are inclusive.
+ */
+ private void callLogicalHandleMessage(ContextHolder holder,
+ int start, int end) {
+
+ if (logicalHandlers.isEmpty() ||
+ start == -1 ||
+ start == logicalHandlers.size()) {
+ return;
+ }
+ callGenericHandleMessage(logicalHandlers,holder.getLMC(),start,end);
+
+ }
+
+ /**
+ * Method called for abnormal processing (for instance, as the
+ * result of a handler returning false during normal processing).
+ * Start and end indices are inclusive.
+ */
+ private void callProtocolHandleMessage(ContextHolder holder,
+ int start, int end) {
+
+ if (soapHandlers.isEmpty()) {
+ return;
+ }
+ callGenericHandleMessage(soapHandlers,holder.getSMC(),start,end);
+ }
+
+ /**
+ * Utility method for calling handleMessage during abnormal processing(for
+ * instance, as the result of a handler returning false during normal
+ * processing). Start and end indices are inclusive.
+ */
+
+ private <C extends MessageContext> void callGenericHandleMessage(List<?
extends Handler> handlerList,
+ C context, int start, int end) {
+ if (handlerList.isEmpty()) {
+ return ;
+ }
+ int i = start;
+ if (start > end) {
+ try {
+ while (i >= end) {
+ if (handlerList.get(i).handleMessage(context) == false)
+ return;
+ i--;
+ }
+ } catch (RuntimeException re) {
+ logger.log(Level.FINER,
+ "exception in handler chain", re);
+ throw re;
+ }
+ } else {
+ try {
+ while (i <= end) {
+ if (handlerList.get(i).handleMessage(context) == false)
+ return ;
+ i++;
+ }
+ } catch (RuntimeException re) {
+ logger.log(Level.FINER,
+ "exception in handler chain", re);
+ throw re;
+ }
+ }
+ return;
+ }
+
+ /*
+ * Calls handleFault on the logical handlers. Indices are
+ * inclusive. Exceptions get passed up the chain, and an
+ * exception or return of 'false' ends processing.
+ */
+ private boolean callLogicalHandleFault(ContextHolder holder,
+ int start, int end) {
+
+ return callGenericHandleFault(logicalHandlers,
+ holder.getLMC(), start, end);
+ }
+
+ /**
+ * Calls handleFault on the protocol handlers. Indices are
+ * inclusive. Exceptions get passed up the chain, and an
+ * exception or return of 'false' ends processing.
+ */
+ private boolean callProtocolHandleFault(ContextHolder holder,
+ int start, int end) {
+
+ return callGenericHandleFault(soapHandlers,
+ holder.getSMC(), start, end);
+ }
+
+ /*
+ * Used by callLogicalHandleFault and callProtocolHandleFault.
+ */
+ private <C extends MessageContext> boolean callGenericHandleFault(List<?
extends Handler> handlerList,
+ C context, int start, int end) {
+
+ if (handlerList.isEmpty()) {
+ return true;
+ }
+ int i = start;
+ if (start > end) {
+ try {
+ while (i >= end) {
+ if (handlerList.get(i).
+ handleFault(context) == false) {
+
+ return false;
+ }
+ i--;
+ }
+ } catch (RuntimeException re) {
+ logger.log(Level.FINER,
+ "exception in handler chain", re);
+ throw re;
+ }
+ } else {
+ try {
+ while (i <= end) {
+ if (handlerList.get(i).
+ handleFault(context) == false) {
+
+ return false;
+ }
+ i++;
+ }
+ } catch (RuntimeException re) {
+ logger.log(Level.FINER,
+ "exception in handler chain", re);
+ throw re;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Method that closes protocol handlers and then
+ * logical handlers.
+ */
+ private void closeHandlersClient(ContextHolder holder) {
+ closeProtocolHandlers(holder, soapHandlers.size()-1, 0);
+ closeLogicalHandlers(holder, logicalHandlers.size()-1, 0);
+ }
+
+ /**
+ * Method that closes logical handlers and then
+ * protocol handlers.
+ */
+ private void closeHandlersServer(ContextHolder holder) {
+ closeLogicalHandlers(holder, 0, logicalHandlers.size()-1);
+ closeProtocolHandlers(holder, 0, soapHandlers.size()-1);
+ }
+
+ /**
+ * This version is called by the server code once it determines
+ * that an incoming message is a one-way request.
+ */
+ public void forceCloseHandlersOnServer(SOAPHandlerContext context) {
+ ContextHolder ch = new ContextHolder(context);
+ // only called after an inbound request
+ ch.getSMC().put(MessageContext.MESSAGE_OUTBOUND_PROPERTY, false);
+ ((SOAPMessageContextImpl) ch.getSMC()).setRoles(getRoles());
+ closeHandlersServer(ch);
+ }
+
+ /**
+ * It is called by the client when an MU fault occurs since the handlerchain
+ * never gets invoked. The direction is an inbound message.
+ */
+ public void forceCloseHandlersOnClient(SOAPHandlerContext context) {
+ ContextHolder ch = new ContextHolder(context);
+
+ // only called after an inbound request
+ ch.getSMC().put(MessageContext.MESSAGE_OUTBOUND_PROPERTY, false);
+ ((SOAPMessageContextImpl) ch.getSMC()).setRoles(getRoles());
+ closeHandlersClient(ch);
+ }
+
+ /**
+ * Version of forceCloseHandlers(HandlerContext) that is used
+ * by XML binding.
+ */
+ public void forceCloseHandlersOnServer(XMLHandlerContext context) {
+ ContextHolder ch = new ContextHolder(context);
+ // only called after an inbound request
+ ch.getLMC().put(MessageContext.MESSAGE_OUTBOUND_PROPERTY, false);
+ closeHandlersServer(ch);
+ }
+
+ /**
+ * Version of forceCloseHandlers(HandlerContext) that is used
+ * by XML binding.
+ */
+ public void forceCloseHandlersOnClient(XMLHandlerContext context) {
+ ContextHolder ch = new ContextHolder(context);
+ // only called after an inbound request
+ ch.getLMC().put(MessageContext.MESSAGE_OUTBOUND_PROPERTY, false);
+ closeHandlersClient(ch);
+ }
+
+ private void closeProtocolHandlers(ContextHolder holder,
+ int start, int end) {
+
+ closeGenericHandlers(soapHandlers, holder.getSMC(), start, end);
+ }
+
+ private void closeLogicalHandlers(ContextHolder holder,
+ int start, int end) {
+
+ closeGenericHandlers(logicalHandlers, holder.getLMC(), start, end);
+ }
+
+ /**
+ * Calls close on the handlers from the starting
+ * index through the ending index (inclusive). Made indices
+ * inclusive to allow both directions more easily.
+ */
+ private void closeGenericHandlers(List<? extends Handler> handlerList,
+ MessageContext context, int start, int end) {
+
+ if (handlerList.isEmpty()) {
+ return;
+ }
+ if (start > end) {
+ for (int i=start; i>=end; i--) {
+ try {
+ handlerList.get(i).close(context);
+ } catch (RuntimeException re) {
+ logger.log(Level.INFO,
+ "Exception ignored during close", re);
+ }
+ }
+ } else {
+ for (int i=start; i<=end; i++) {
+ try {
+ handlerList.get(i).close(context);
+ } catch (RuntimeException re) {
+ logger.log(Level.INFO,
+ "Exception ignored during close", re);
+ }
+ }
+ }
+ }
+
+ /**
+ * Used to hold the context objects that are used to get
+ * and set the current message.
+ *
+ * If a HandlerContext is passed in, both logical and soap
+ * handlers are used. If XMLHandlerContext is passed in,
+ * only logical handlers are assumed to be present.
+ */
+ static class ContextHolder {
+
+ boolean logicalOnly;
+ SOAPHandlerContext context;
+ XMLHandlerContext xmlContext;
+
+ ContextHolder(SOAPHandlerContext context) {
+ this.context = context;
+ logicalOnly = false;
+ }
+
+ ContextHolder(XMLHandlerContext xmlContext) {
+ this.xmlContext = xmlContext;
+ logicalOnly = true;
+ }
+
+ LogicalMessageContext getLMC() {
+ return (logicalOnly ? xmlContext.getLogicalMessageContext() :
+ context.getLogicalMessageContext());
+ }
+
+ SOAPMessageContext getSMC() {
+ return (logicalOnly ? null : context.getSOAPMessageContext());
+ }
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/HandlerChainCaller.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/HandlerChainsModel.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/HandlerChainsModel.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/HandlerChainsModel.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,567 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.handler;
+
+
+import javax.annotation.PostConstruct;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.handler.PortInfo;
+import javax.xml.ws.http.HTTPBinding;
+import javax.xml.ws.soap.SOAPBinding;
+
+import org.jboss.com.sun.xml.ws.streaming.XMLStreamReaderUtil;
+import org.jboss.com.sun.xml.ws.util.HandlerAnnotationInfo;
+import org.jboss.com.sun.xml.ws.util.JAXWSUtils;
+import org.jboss.com.sun.xml.ws.util.UtilException;
+
+import java.lang.reflect.Method;
+import java.util.*;
+import java.util.logging.Logger;
+
+
+public class HandlerChainsModel {
+ private static final Logger logger = Logger.getLogger(
+ org.jboss.com.sun.xml.ws.util.Constants.LoggingDomain + ".util");
+
+ protected Class annotatedClass;
+ protected List<HandlerChainType> handlerChains;
+ protected String id;
+ /** Creates a new instance of HandlerChains */
+ public HandlerChainsModel(Class annotatedClass) {
+ this.annotatedClass = annotatedClass;
+ }
+
+ public List<HandlerChainType> getHandlerChain() {
+ if (handlerChains == null) {
+ handlerChains = new ArrayList<HandlerChainType>();
+ }
+ return handlerChains;
+ }
+
+ public java.lang.String getId() {
+ return id;
+ }
+
+ public void setId(java.lang.String value) {
+ this.id = value;
+ }
+ /**
+ * reader should be on <handler-chains> element
+ */
+ public static HandlerChainsModel parseHandlerConfigFile(Class annotatedClass,
XMLStreamReader reader) {
+ ensureProperName(reader,QNAME_HANDLER_CHAINS);
+ HandlerChainsModel handlerModel = new HandlerChainsModel(annotatedClass);
+ List<HandlerChainType> hChains = handlerModel.getHandlerChain();
+ XMLStreamReaderUtil.nextElementContent(reader);
+
+ while (reader.getName().equals(QNAME_HANDLER_CHAIN)) {
+ HandlerChainType hChain = new HandlerChainType();
+ XMLStreamReaderUtil.nextElementContent(reader);
+
+ if (reader.getName().equals(QNAME_CHAIN_PORT_PATTERN)) {
+ QName portNamePattern = XMLStreamReaderUtil.getElementQName(reader);
+ hChain.setPortNamePattern(portNamePattern);
+ XMLStreamReaderUtil.nextElementContent(reader);
+ } else if (reader.getName().equals(QNAME_CHAIN_PROTOCOL_BINDING)) {
+ String bindingList = XMLStreamReaderUtil.getElementText(reader);
+ StringTokenizer stk = new StringTokenizer(bindingList);
+ while(stk.hasMoreTokens()) {
+ String token = stk.nextToken();
+ // This will convert tokens into Binding URI
+ hChain.addProtocolBinding(token);
+ }
+ XMLStreamReaderUtil.nextElementContent(reader);
+ } else if (reader.getName().equals(QNAME_CHAIN_SERVICE_PATTERN)) {
+ QName serviceNamepattern = XMLStreamReaderUtil.getElementQName(reader);
+ hChain.setServiceNamePattern(serviceNamepattern);
+ XMLStreamReaderUtil.nextElementContent(reader);
+ }
+ List<HandlerType> handlers = hChain.getHandlers();
+ // process all <handler> elements
+ while (reader.getName().equals(QNAME_HANDLER)) {
+ HandlerType handler = new HandlerType();
+
+ XMLStreamReaderUtil.nextContent(reader);
+ if (reader.getName().equals(QNAME_HANDLER_NAME)) {
+ String handlerName =
+ XMLStreamReaderUtil.getElementText(reader);
+ handler.setHandlerName(handlerName);
+ XMLStreamReaderUtil.nextContent(reader);
+ }
+
+ // handler class
+ ensureProperName(reader, QNAME_HANDLER_CLASS);
+ String handlerClass =
+ XMLStreamReaderUtil.getElementText(reader);
+ handler.setHandlerClass(handlerClass);
+ XMLStreamReaderUtil.nextContent(reader);
+
+ // init params (ignored)
+ while (reader.getName().equals(QNAME_HANDLER_PARAM)) {
+ skipInitParamElement(reader);
+ }
+
+ // headers (ignored)
+ while (reader.getName().equals(QNAME_HANDLER_HEADER)) {
+ skipTextElement(reader);
+ }
+
+ // roles (not stored per handler)
+ while (reader.getName().equals(QNAME_HANDLER_ROLE)) {
+ List<String> soapRoles = handler.getSoapRoles();
+ soapRoles.add(XMLStreamReaderUtil.getElementText(reader));
+ XMLStreamReaderUtil.nextContent(reader);
+ }
+
+ handlers.add(handler);
+
+ // move past </handler>
+ ensureProperName(reader, QNAME_HANDLER);
+ XMLStreamReaderUtil.nextContent(reader);
+ }
+
+ // move past </handler-chain>
+ ensureProperName(reader, QNAME_HANDLER_CHAIN);
+ hChains.add(hChain);
+ XMLStreamReaderUtil.nextContent(reader);
+ }
+
+ return handlerModel;
+ }
+
+ /**
+ * <p>This method is called internally by HandlerAnnotationProcessor,
+ * and by
+ * {@link org.jboss.com.sun.xml.ws.transport.http.servlet.RuntimeEndpointInfoParser}
+ * directly when it reaches the handler chains element in the
+ * descriptor file it is parsing.
+ *
+ * @return A HandlerAnnotationInfo object that stores the
+ * handlers and roles.
+ */
+ public static HandlerAnnotationInfo parseHandlerFile(XMLStreamReader reader,
+ ClassLoader classLoader, QName serviceName, QName portName,
+ String bindingId) {
+ ensureProperName(reader,QNAME_HANDLER_CHAINS);
+ HandlerAnnotationInfo info = new HandlerAnnotationInfo();
+
+ XMLStreamReaderUtil.nextElementContent(reader);
+
+ List<Handler> handlerChain = new ArrayList<Handler>();
+ Set<String> roles = new HashSet<String>();
+
+ while (reader.getName().equals(QNAME_HANDLER_CHAIN)) {
+
+ XMLStreamReaderUtil.nextElementContent(reader);
+
+ if (reader.getName().equals(QNAME_CHAIN_PORT_PATTERN)) {
+ if (portName == null) {
+ logger.warning("handler chain sepcified for port " +
+ "but port QName passed to parser is null");
+ }
+ boolean parseChain = JAXWSUtils.matchQNames(portName,
+ XMLStreamReaderUtil.getElementQName(reader));
+ if (!parseChain) {
+ skipChain(reader);
+ continue;
+ }
+ XMLStreamReaderUtil.nextElementContent(reader);
+ } else if (reader.getName().equals(QNAME_CHAIN_PROTOCOL_BINDING)) {
+ if (bindingId == null) {
+ logger.warning("handler chain sepcified for bindingId " +
+ "but bindingId passed to parser is null");
+ }
+ String bindingConstraint = XMLStreamReaderUtil.getElementText(reader);
+ boolean skipThisChain = true;
+ StringTokenizer stk = new StringTokenizer(bindingConstraint);
+ List<String> bindingList = new ArrayList<String>();
+ while(stk.hasMoreTokens()) {
+ String tokenOrURI = stk.nextToken();
+ String binding = tokenBindingMap.get(tokenOrURI);
+ if(binding == null) {
+ //Unknown binding or Unknown token, Put it as it is
+ binding = tokenOrURI;
+ }
+ bindingList.add(binding);
+ }
+ if(bindingList.contains(bindingId)){
+ skipThisChain = false;
+ }
+
+ if (skipThisChain) {
+ skipChain(reader);
+ continue;
+ }
+ XMLStreamReaderUtil.nextElementContent(reader);
+ } else if (reader.getName().equals(QNAME_CHAIN_SERVICE_PATTERN)) {
+ if (serviceName == null) {
+ logger.warning("handler chain sepcified for service " +
+ "but service QName passed to parser is null");
+ }
+ boolean parseChain = JAXWSUtils.matchQNames(
+ serviceName,
+ XMLStreamReaderUtil.getElementQName(reader));
+ if (!parseChain) {
+ skipChain(reader);
+ continue;
+ }
+ XMLStreamReaderUtil.nextElementContent(reader);
+ }
+
+ // process all <handler> elements
+ while (reader.getName().equals(QNAME_HANDLER)) {
+ Handler handler = null;
+
+ XMLStreamReaderUtil.nextContent(reader);
+ if (reader.getName().equals(QNAME_HANDLER_NAME)) {
+ skipTextElement(reader);
+ }
+
+ // handler class
+ ensureProperName(reader, QNAME_HANDLER_CLASS);
+ try {
+ handler = (Handler) loadClass(classLoader,
+ XMLStreamReaderUtil.getElementText(reader)).newInstance();
+ } catch (InstantiationException ie){
+ throw new RuntimeException(ie);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(e);
+ }
+ XMLStreamReaderUtil.nextContent(reader);
+
+ // init params (ignored)
+ while (reader.getName().equals(QNAME_HANDLER_PARAM)) {
+ skipInitParamElement(reader);
+ }
+
+ // headers (ignored)
+ while (reader.getName().equals(QNAME_HANDLER_HEADER)) {
+ skipTextElement(reader);
+ }
+
+ // roles (not stored per handler)
+ while (reader.getName().equals(QNAME_HANDLER_ROLE)) {
+ roles.add(XMLStreamReaderUtil.getElementText(reader));
+ XMLStreamReaderUtil.nextContent(reader);
+ }
+
+ // call @PostConstruct method on handler if present
+ for (Method method : handler.getClass().getMethods()) {
+ if (method.getAnnotation(PostConstruct.class) == null) {
+ continue;
+ }
+ try {
+ method.invoke(handler, new Object [0]);
+ break;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ handlerChain.add(handler);
+
+ // move past </handler>
+ ensureProperName(reader, QNAME_HANDLER);
+ XMLStreamReaderUtil.nextContent(reader);
+ }
+
+ // move past </handler-chain>
+ ensureProperName(reader, QNAME_HANDLER_CHAIN);
+ XMLStreamReaderUtil.nextContent(reader);
+ }
+
+ info.setHandlers(handlerChain);
+ info.setRoles(roles);
+ return info;
+ }
+
+ public HandlerAnnotationInfo getHandlersForPortInfo(PortInfo info){
+
+ HandlerAnnotationInfo handlerInfo = new HandlerAnnotationInfo();
+ List<Handler> handlerClassList = new ArrayList<Handler>();
+ Set<String> roles = new HashSet<String>();
+
+ for(HandlerChainType hchain : handlerChains) {
+ boolean hchainMatched = false;
+ if((!hchain.isConstraintSet()) ||
+ JAXWSUtils.matchQNames(info.getServiceName(),
hchain.getServiceNamePattern()) ||
+ JAXWSUtils.matchQNames(info.getPortName(),
hchain.getPortNamePattern()) ||
+ hchain.getProtocolBindings().contains(info.getBindingID()) ){
+ hchainMatched = true;
+
+ }
+ if(hchainMatched) {
+ for(HandlerType handler : hchain.getHandlers()) {
+ try {
+ Handler handlerClass = (Handler)
loadClass(annotatedClass.getClassLoader(),
+ handler.getHandlerClass()).newInstance();
+ callHandlerPostConstruct(handlerClass);
+ handlerClassList.add(handlerClass);
+ } catch (InstantiationException ie){
+ throw new RuntimeException(ie);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(e);
+ }
+
+ roles.addAll(handler.getSoapRoles());
+ }
+
+ }
+ }
+
+ handlerInfo.setHandlers(handlerClassList);
+ handlerInfo.setRoles(roles);
+ return handlerInfo;
+
+ }
+
+ static Class loadClass(ClassLoader loader, String name) {
+ try {
+ return Class.forName(name, true, loader);
+ } catch (ClassNotFoundException e) {
+ throw new UtilException(
+ "util.handler.class.not.found",
+ name);
+ }
+ }
+
+ static void callHandlerPostConstruct(Object handlerClass) {
+ // call @PostConstruct method on handler if present
+ for (Method method : handlerClass.getClass().getMethods()) {
+ if (method.getAnnotation(PostConstruct.class) == null) {
+ continue;
+ }
+ try {
+ method.invoke(handlerClass, new Object [0]);
+ break;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ static void skipChain(XMLStreamReader reader) {
+ while (XMLStreamReaderUtil.nextContent(reader) !=
+ XMLStreamConstants.END_ELEMENT ||
+ !reader.getName().equals(QNAME_HANDLER_CHAIN)) {}
+ XMLStreamReaderUtil.nextElementContent(reader);
+ }
+
+ static void skipTextElement(XMLStreamReader reader) {
+ XMLStreamReaderUtil.nextContent(reader);
+ XMLStreamReaderUtil.nextElementContent(reader);
+ XMLStreamReaderUtil.nextElementContent(reader);
+ }
+
+ static void skipInitParamElement(XMLStreamReader reader) {
+ int state;
+ do {
+ state = XMLStreamReaderUtil.nextContent(reader);
+ } while (state != XMLStreamReader.END_ELEMENT ||
+ !reader.getName().equals(QNAME_HANDLER_PARAM));
+ XMLStreamReaderUtil.nextElementContent(reader);
+ }
+
+ static void ensureProperName(XMLStreamReader reader,
+ QName expectedName) {
+
+ if (!reader.getName().equals(expectedName)) {
+ failWithLocalName("util.parser.wrong.element", reader,
+ expectedName.getLocalPart());
+ }
+ }
+
+ static void ensureProperName(XMLStreamReader reader, String expectedName) {
+ if (!reader.getLocalName().equals(expectedName)) {
+ failWithLocalName("util.parser.wrong.element", reader,
+ expectedName);
+ }
+ }
+
+ static void failWithLocalName(String key,
+ XMLStreamReader reader, String arg) {
+ throw new UtilException(key,
+ new Object[] {
+ Integer.toString(reader.getLocation().getLineNumber()),
+ reader.getLocalName(),
+ arg });
+ }
+
+ public static final String PROTOCOL_SOAP11_TOKEN = "##SOAP11_HTTP";
+ public static final String PROTOCOL_SOAP12_TOKEN = "##SOAP12_HTTP";
+ public static final String PROTOCOL_XML_TOKEN = "##XML_HTTP";
+
+ public static final String NS_109 =
+ "http://java.sun.com/xml/ns/javaee";
+ public static final QName QNAME_CHAIN_PORT_PATTERN =
+ new QName(NS_109, "port-name-pattern");
+ public static final QName QNAME_CHAIN_PROTOCOL_BINDING =
+ new QName(NS_109, "protocol-bindings");
+ public static final QName QNAME_CHAIN_SERVICE_PATTERN =
+ new QName(NS_109, "service-name-pattern");
+ public static final QName QNAME_HANDLER_CHAIN =
+ new QName(NS_109, "handler-chain");
+ public static final QName QNAME_HANDLER_CHAINS =
+ new QName(NS_109, "handler-chains");
+ public static final QName QNAME_HANDLER =
+ new QName(NS_109, "handler");
+ public static final QName QNAME_HANDLER_NAME =
+ new QName(NS_109, "handler-name");
+ public static final QName QNAME_HANDLER_CLASS =
+ new QName(NS_109, "handler-class");
+ public static final QName QNAME_HANDLER_PARAM =
+ new QName(NS_109, "init-param");
+ public static final QName QNAME_HANDLER_PARAM_NAME =
+ new QName(NS_109, "param-name");
+ public static final QName QNAME_HANDLER_PARAM_VALUE =
+ new QName(NS_109, "param-value");
+ public static final QName QNAME_HANDLER_HEADER =
+ new QName(NS_109, "soap-header");
+ public static final QName QNAME_HANDLER_ROLE =
+ new QName(NS_109, "soap-role");
+ protected static final Map<String,String> tokenBindingMap;
+ //Populate the token map
+ static {
+ tokenBindingMap = new HashMap<String,String>();
+ tokenBindingMap.put("##SOAP11_HTTP",SOAPBinding.SOAP11HTTP_BINDING);
+
tokenBindingMap.put("##SOAP11_HTTP_MTOM",SOAPBinding.SOAP11HTTP_MTOM_BINDING);
+ tokenBindingMap.put("##SOAP12_HTTP",SOAPBinding.SOAP12HTTP_BINDING);
+
tokenBindingMap.put("##SOAP12_HTTP_MTOM",SOAPBinding.SOAP12HTTP_MTOM_BINDING);
+ tokenBindingMap.put("##XML_HTTP",HTTPBinding.HTTP_BINDING);
+ }
+
+ static class HandlerChainType {
+ //constraints
+ protected QName serviceNamePattern;
+ protected QName portNamePattern;
+ protected List<String> protocolBindings;
+
+ // This flag is set if one of the above constraint is set on handler chain
+ protected boolean constraintSet = false;
+
+ protected List<HandlerType> handlers;
+ protected String id;
+
+
+ /** Creates a new instance of HandlerChain */
+ public HandlerChainType() {
+ protocolBindings = new ArrayList<String>();
+ }
+
+ public void setServiceNamePattern(QName value) {
+ this.serviceNamePattern = value;
+ constraintSet = true;
+ }
+
+ public QName getServiceNamePattern() {
+ return serviceNamePattern;
+ }
+
+ public void setPortNamePattern(QName value) {
+ this.portNamePattern = value;
+ constraintSet = true;
+ }
+
+ public QName getPortNamePattern() {
+ return portNamePattern;
+ }
+
+ public List<java.lang.String> getProtocolBindings() {
+ return this.protocolBindings;
+ }
+
+ public void addProtocolBinding(String tokenorURI){
+ String binding = tokenBindingMap.get(tokenorURI);
+ if(binding == null) {
+ //Unknown binding or Unknown token, Put it as it is
+ binding = tokenorURI;
+ }
+ protocolBindings.add(binding);
+ constraintSet = true;
+ }
+
+ public boolean isConstraintSet() {
+ return constraintSet || !protocolBindings.isEmpty();
+ }
+ public java.lang.String getId() {
+ return id;
+ }
+
+ public void setId(java.lang.String value) {
+ this.id = value;
+ }
+
+ public List<HandlerType> getHandlers() {
+ if (handlers == null) {
+ handlers = new ArrayList<HandlerType>();
+ }
+ return this.handlers;
+ }
+ }
+
+ static class HandlerType {
+ protected String handlerName;
+ protected String handlerClass;
+ protected List<String> soapRoles;
+
+ protected java.lang.String id;
+
+ /** Creates a new instance of HandlerComponent */
+ public HandlerType() {
+ }
+
+ public String getHandlerName() {
+ return handlerName;
+ }
+
+ public void setHandlerName(String value) {
+ this.handlerName = value;
+ }
+
+ public String getHandlerClass() {
+ return handlerClass;
+ }
+
+ public void setHandlerClass(String value) {
+ this.handlerClass = value;
+ }
+
+ public java.lang.String getId() {
+ return id;
+ }
+
+ public void setId(java.lang.String value) {
+ this.id = value;
+ }
+
+ public List<String> getSoapRoles() {
+ if (soapRoles == null) {
+ soapRoles = new ArrayList<String>();
+ }
+ return this.soapRoles;
+ }
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/HandlerChainsModel.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/HandlerContext.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/HandlerContext.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/HandlerContext.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,172 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.handler;
+import javax.xml.ws.handler.MessageContext;
+
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.AttachmentBlock;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.HeaderBlock;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.InternalMessage;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.spi.runtime.InternalSoapEncoder;
+import org.jboss.com.sun.xml.ws.spi.runtime.Invoker;
+
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * The HandlerContext is used in the client and server runtime
+ * in {@link org.jboss.com.sun.xml.ws.protocol.soap.client.SOAPMessageDispatcher} and
+ * {@link org.jboss.com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher} to hold
+ * information about the current message.
+ *
+ * <p>It stores a {@link org.jboss.com.sun.xml.ws.pept.ept.MessageInfo} and
+ * {@link org.jboss.com.sun.xml.ws.encoding.soap.internal.InternalMessage}
+ * which are used by the rest of the runtime, and provides a bridge
+ * between these and the soap and logical message contexts that
+ * are used by the handlers.
+ *
+ * @see LogicalMessageContextImpl
+ * @see MessageContextImpl
+ * @see SOAPMessageContextImpl
+ *
+ * @author WS Development Team
+ */
+public class HandlerContext {
+
+ private MessageInfo messageInfo;
+ private InternalMessage internalMessage;
+ private MessageContext msgContext;
+
+ private Method method;
+ private Invoker invoker;
+ private String algorithm;
+ private String bindingId;
+
+ public HandlerContext(MessageInfo messageInfo,
+ InternalMessage internalMessage) {
+ this.messageInfo = messageInfo;
+ this.internalMessage = internalMessage;
+ this.msgContext = new MessageContextImpl();
+ //populateAttachmentMap();
+ }
+
+ /**
+ * @return Returns the soapMessage.
+ */
+ public MessageContext getMessageContext() {
+ return msgContext;
+ }
+
+ public void setMessageContext(MessageContext msgContext) {
+ this.msgContext = msgContext;
+ }
+
+ public InternalMessage getInternalMessage() {
+ return internalMessage;
+ }
+
+ /**
+ * @param internalMessage The internalMessage to set.
+ */
+ public void setInternalMessage(InternalMessage internalMessage) {
+ this.internalMessage = internalMessage;
+ populateAttachmentMap();
+ }
+
+ public MessageInfo getMessageInfo() {
+ return messageInfo;
+ }
+
+ /**
+ * @param messageInfo The messageInfo to set.
+ */
+ public void setMessageInfo(MessageInfo messageInfo) {
+ this.messageInfo = messageInfo;
+ }
+
+ /*
+ * Returns the invocation method
+ */
+ public Method getMethod() {
+ return method;
+ }
+
+ public void setMethod(Method method) {
+ this.method = method;
+ }
+
+ /*
+ * Returns InternalMessage's BodyBlock value. It can be null for empty body.
+ */
+ public Object getBody() {
+ return (internalMessage == null) ? null : ((internalMessage.getBody() ==
null)?null:internalMessage.getBody().getValue());
+ }
+
+ /*
+ * Returns InternalMessage's HeaderBlock values
+ */
+ public List getHeaders() {
+ List<HeaderBlock> headerBlocks =
+ (internalMessage == null) ? null : internalMessage.getHeaders();
+ if (headerBlocks != null) {
+ List headers = new ArrayList();
+ for (HeaderBlock headerBlock : headerBlocks) {
+ if (headerBlock.getValue() != null) {
+ headers.add(headerBlock.getValue());
+ }
+ }
+ return headers;
+ }
+ return null;
+ }
+
+ public String getBindingId() {
+ return bindingId;
+ }
+
+ public void setBindingId(String bindingID) {
+ bindingId = bindingID;
+ }
+
+ public void setCanonicalization(String algorithm) {
+ this.algorithm = algorithm;
+ }
+
+ public Invoker getInvoker() {
+ return invoker;
+ }
+
+ public void setInvoker(Invoker invoker) {
+ this.invoker = invoker;
+ }
+
+ public void populateAttachmentMap(){
+ //populate the attachment map
+ if(internalMessage != null){
+ for(AttachmentBlock ab: internalMessage.getAttachments().values()){
+ MessageContextUtil.addMessageAttachment(msgContext, ab.getId(),
ab.asDataHandler());
+ }
+ }
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/HandlerContext.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/HandlerException.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/HandlerException.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/HandlerException.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,53 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.handler;
+
+import org.jboss.com.sun.xml.ws.util.exception.JAXWSExceptionBase;
+import org.jboss.com.sun.xml.ws.util.localization.Localizable;
+
+/**
+ * Exception thrown by handler-related code. Extends
+ * {@link org.jboss.com.sun.xml.ws.util.exception.JAXWSExceptionBase}
+ * using the appropriate resource bundle.
+ *
+ * @see org.jboss.com.sun.xml.ws.util.exception.JAXWSExceptionBase
+ *
+ * @author WS Development Team
+ */
+public class HandlerException extends JAXWSExceptionBase {
+ public HandlerException(String key, Object... args) {
+ super(key, args);
+ }
+
+ public HandlerException(Throwable throwable) {
+ super(throwable);
+ }
+
+ public HandlerException(Localizable arg) {
+ super("handler.nestedError", arg);
+ }
+
+ public String getResourceBundleName() {
+ return "org.jboss.com.sun.xml.ws.resources.handler";
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/HandlerException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/HandlerResolverImpl.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/HandlerResolverImpl.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/HandlerResolverImpl.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,128 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.handler;
+
+
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.handler.HandlerResolver;
+import javax.xml.ws.handler.PortInfo;
+
+import org.jboss.com.sun.xml.ws.client.ServiceContext;
+import org.jboss.com.sun.xml.ws.util.HandlerAnnotationInfo;
+import org.jboss.com.sun.xml.ws.util.HandlerAnnotationProcessor;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * <p>Implementation class of HandlerResolver. This class is a simple
+ * map of PortInfo objects to handler chains. It is used by a
+ * {@link org.jboss.com.sun.xml.ws.client.ServiceContext} object, and can
+ * be replaced by user code with a different class implementing
+ * HandlerResolver. This class is only used on the client side, and
+ * it includes a lot of logging to help when there are issues since
+ * it deals with port names, service names, and bindings. All three
+ * must match when getting a handler chain from the map.
+ *
+ * <p>It is created by the {@link
org.jboss.com.sun.xml.ws.client.ServiceContextBuilder}
+ * class and set on the ServiceContext. The ServiceContextBuilder uses
+ * the {@link org.jboss.com.sun.xml.ws.util.HandlerAnnotationProcessor} to create
+ * a handler chain and then it sets the chains on this class and they
+ * are put into the map. The ServiceContext uses the map to set handler
+ * chains on bindings when they are created.
+ *
+ * @see org.jboss.com.sun.xml.ws.client.ServiceContext
+ * @see org.jboss.com.sun.xml.ws.handler.PortInfoImpl
+ *
+ * @author WS Development Team
+ */
+public class HandlerResolverImpl implements HandlerResolver {
+ private HandlerChainsModel handlerModel;
+ private Map<PortInfo, List<Handler>> chainMap;
+ private ServiceContext serviceContext;
+ private static final Logger logger = Logger.getLogger(
+ org.jboss.com.sun.xml.ws.util.Constants.LoggingDomain + ".handler");
+
+ public HandlerResolverImpl(ServiceContext serviceContext) {
+ this.serviceContext = serviceContext;
+ handlerModel =
HandlerAnnotationProcessor.buildHandlerChainsModel(serviceContext.getServiceClass());
+ chainMap = new HashMap<PortInfo, List<Handler>>();
+ }
+
+ /**
+ * API method to return the correct handler chain for a given
+ * PortInfo class.
+ *
+ * @param info A PortInfo object.
+ * @return A list of handler objects. If there is no handler chain
+ * found, it will return an empty list rather than null.
+ */
+ public List<Handler> getHandlerChain(PortInfo info) {
+ //Check in cache first
+ List<Handler> chain = chainMap.get(info);
+
+ if(chain != null)
+ return chain;
+ if(handlerModel != null) {
+ HandlerAnnotationInfo chainInfo = handlerModel.getHandlersForPortInfo(info);
+ if(chainInfo != null) {
+ chain = chainInfo.getHandlers();
+ serviceContext.setRoles(info.getPortName(),chainInfo.getRoles());
+ }
+ }
+ if (chain == null) {
+ if (logger.isLoggable(Level.FINE)) {
+ logGetChain(info);
+ }
+ chain = new ArrayList<Handler>();
+ }
+ // Put it in cache
+ chainMap.put(info,chain);
+ return chain;
+ }
+
+ // logged at fine level
+ private void logGetChain(PortInfo info) {
+ logger.fine("No handler chain found for port info:");
+ logPortInfo(info, Level.FINE);
+ logger.fine("Existing handler chains:");
+ if (chainMap.isEmpty()) {
+ logger.fine("none");
+ } else {
+ for (PortInfo key : chainMap.keySet()) {
+ logger.fine(chainMap.get(key).size() +
+ " handlers for port info ");
+ logPortInfo(key, Level.FINE);
+ }
+ }
+ }
+
+ private void logPortInfo(PortInfo info, Level level) {
+ logger.log(level, "binding: " + info.getBindingID() +
+ "\nservice: " + info.getServiceName() +
+ "\nport: " + info.getPortName());
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/HandlerResolverImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/LogicalMessageContextImpl.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/LogicalMessageContextImpl.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/LogicalMessageContextImpl.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,122 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.handler;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import javax.xml.ws.LogicalMessage;
+import javax.xml.ws.handler.LogicalMessageContext;
+import javax.xml.ws.handler.MessageContext.Scope;
+import javax.xml.ws.handler.MessageContext;
+
+/**
+ * Implementation of LogicalMessageContext. This class is used at runtime
+ * to pass to the handlers for processing logical messages.
+ *
+ * <p>Class has to defer information to HandlerContext so that properties
+ * are shared between this and SOAPMessageContext.
+ *
+ * @see MessageContextImpl
+ *
+ * @author WS Development Team
+ */
+public class LogicalMessageContextImpl implements LogicalMessageContext {
+
+ SOAPHandlerContext handlerCtxt;
+ MessageContext ctxt;
+
+ public LogicalMessageContextImpl(SOAPHandlerContext handlerCtxt) {
+ this.handlerCtxt = handlerCtxt;
+ ctxt = handlerCtxt.getMessageContext();
+ }
+
+ public HandlerContext getHandlerContext() {
+ return handlerCtxt;
+ }
+
+ public LogicalMessage getMessage() {
+ return new LogicalMessageImpl(handlerCtxt);
+ }
+
+ public void setScope(String name, Scope scope) {
+ ctxt.setScope(name, scope);
+ }
+
+ public Scope getScope(String name) {
+ return ctxt.getScope(name);
+ }
+
+ /* java.util.Map methods below here */
+
+ public void clear() {
+ ctxt.clear();
+ }
+
+ public boolean containsKey(Object obj) {
+ return ctxt.containsKey(obj);
+ }
+
+ public boolean containsValue(Object obj) {
+ return ctxt.containsValue(obj);
+ }
+
+ public Set<Entry<String, Object>> entrySet() {
+ return ctxt.entrySet();
+ }
+
+ public Object get(Object obj) {
+ return ctxt.get(obj);
+ }
+
+ public boolean isEmpty() {
+ return ctxt.isEmpty();
+ }
+
+ public Set<String> keySet() {
+ return ctxt.keySet();
+ }
+
+ public Object put(String str, Object obj) {
+ return ctxt.put(str, obj);
+ }
+
+ public void putAll(Map<? extends String, ? extends Object> map) {
+ ctxt.putAll(map);
+ }
+
+ public Object remove(Object obj) {
+ return ctxt.remove(obj);
+ }
+
+ public int size() {
+ return ctxt.size();
+ }
+
+ public Collection<Object> values() {
+ return ctxt.values();
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/LogicalMessageContextImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/LogicalMessageImpl.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/LogicalMessageImpl.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/LogicalMessageImpl.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,207 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.handler;
+
+import java.util.Iterator;
+import javax.xml.soap.SOAPElement;
+
+import org.jboss.com.sun.xml.ws.encoding.jaxb.JAXBBeanInfo;
+import org.jboss.com.sun.xml.ws.encoding.jaxb.JAXBBridgeInfo;
+import org.jboss.com.sun.xml.ws.encoding.jaxb.JAXBTypeSerializer;
+import org.jboss.com.sun.xml.ws.encoding.jaxb.RpcLitPayload;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPEPTFactory;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPEncoder;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.BodyBlock;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.InternalMessage;
+import org.jboss.com.sun.xml.ws.encoding.soap.message.SOAPFaultInfo;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.util.xml.XmlUtil;
+import org.w3c.dom.Node;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.ws.LogicalMessage;
+import javax.xml.ws.WebServiceException;
+
+/**
+ * Implementation of LogicalMessage. This class implements the methods
+ * used by LogicalHandlers to get/set the request or response either
+ * as a JAXB object or as javax.xml.transform.Source.
+ *
+ * <p>The {@link HandlerContext} that is passed into the constructor
+ * is used to retrieve the payload of the request or response.
+ *
+ * @see HandlerContext
+ * @see LogicalMessageContextImpl
+ *
+ * @author WS Development Team
+ */
+public class LogicalMessageImpl implements LogicalMessage {
+
+ private SOAPHandlerContext ctxt;
+
+ public LogicalMessageImpl(SOAPHandlerContext ctxt) {
+ this.ctxt = ctxt;
+ }
+
+ /*
+ * If the payload is DOMSource, return it
+ * If the payload is Source/SOAPFaultInfo/JAXBBridgeInfo/JAXBBeanInfo,
+ * convert to DOMSource and return it. DOMSource is also stored in BodyBlock
+ */
+ public Source getPayload() {
+ try {
+ InternalMessage internalMessage = ctxt.getInternalMessage();
+ if (internalMessage == null) {
+ SOAPMessage soapMessage = ctxt.getSOAPMessage();
+ if (soapMessage == null) {
+ return null;
+ } else {
+ Iterator it = soapMessage.getSOAPBody().getChildElements();
+ SOAPElement elem = null;
+ while(it.hasNext()) {
+ Node child = (Node)it.next();
+ if (child instanceof SOAPElement) {
+ elem = (SOAPElement)child;
+ break;
+ }
+ }
+ if (elem != null) {
+ setSource(new DOMSource(elem));
+ } else {
+ return null;
+ }
+ }
+ }
+ internalMessage = ctxt.getInternalMessage();
+ BodyBlock bodyBlock = internalMessage.getBody();
+ if (bodyBlock == null) {
+ return null;
+ } else {
+ Object obj = bodyBlock.getValue();
+ if (obj instanceof DOMSource) {
+ return (Source)obj;
+ } else if (obj instanceof Source) {
+ Source source = (Source)obj;
+ Transformer transformer = XmlUtil.newTransformer();
+ DOMResult domResult = new DOMResult();
+ transformer.transform(source, domResult);
+ DOMSource domSource = new DOMSource(domResult.getNode());
+ bodyBlock.setSource(domSource);
+ return domSource;
+ } else if (obj instanceof JAXBBridgeInfo) {
+ MessageInfo messageInfo = ctxt.getMessageInfo();
+ SOAPEPTFactory eptf = (SOAPEPTFactory)messageInfo.getEPTFactory();
+ SOAPEncoder encoder = eptf.getSOAPEncoder();
+ DOMSource domSource = encoder.toDOMSource((JAXBBridgeInfo)obj,
messageInfo);
+ bodyBlock.setSource(domSource);
+ return domSource;
+ } else if (obj instanceof JAXBBeanInfo) {
+ DOMSource domSource = ((JAXBBeanInfo)obj).toDOMSource();
+ bodyBlock.setSource(domSource);
+ return domSource;
+ } else if (obj instanceof RpcLitPayload) {
+ MessageInfo messageInfo = ctxt.getMessageInfo();
+ SOAPEPTFactory eptf = (SOAPEPTFactory)messageInfo.getEPTFactory();
+ SOAPEncoder encoder = eptf.getSOAPEncoder();
+ DOMSource domSource = encoder.toDOMSource((RpcLitPayload)obj,
messageInfo);
+ bodyBlock.setSource(domSource);
+ return domSource;
+ } else if (obj instanceof SOAPFaultInfo) {
+ MessageInfo messageInfo = ctxt.getMessageInfo();
+ SOAPEPTFactory eptf = (SOAPEPTFactory)messageInfo.getEPTFactory();
+ SOAPEncoder encoder = eptf.getSOAPEncoder();
+ DOMSource domSource = encoder.toDOMSource((SOAPFaultInfo)obj,
messageInfo);
+ bodyBlock.setSource(domSource);
+ return domSource;
+ } else {
+ throw new WebServiceException("Unknown type
"+obj.getClass()+" in BodyBlock");
+ }
+ }
+ } catch(TransformerException te) {
+ throw new WebServiceException(te);
+ } catch(SOAPException se) {
+ throw new WebServiceException(se);
+ }
+ }
+
+ /*
+ * Sets the Source as payload in the BodyBlock of InternalMessage.
+ */
+ public void setPayload(Source source) {
+ setSource(source);
+ }
+
+ /*
+ * Converts to DOMSource and keeps it in BodyBlock. Then it unmarshalls this
+ * DOMSource to a jaxb object. Any changes done in jaxb object are lost if
+ * the object isn't set again.
+ */
+ public Object getPayload(JAXBContext jaxbContext) {
+ return JAXBTypeSerializer.deserialize(getPayload(), jaxbContext);
+ }
+
+ /*
+ * The object is marshalled into DOMSource and stored in BodyBlock. If an
+ * error occurs when using the supplied JAXBContext to marshall the
+ * payload, it throws a JAXWSException.
+ */
+ public void setPayload(Object bean, JAXBContext jaxbContext) {
+ Source source;
+ try {
+ source = JAXBTypeSerializer.serialize(bean,jaxbContext);
+ } catch(Exception e) {
+ throw new WebServiceException(e);
+ }
+ setSource(source); // set Source in BodyBlock
+ }
+
+ public HandlerContext getHandlerContext() {
+ return ctxt;
+ }
+
+ /*
+ * It stores Source in the BodyBlock. If necessary, it creates
+ * InternalMessage, and BodyBlock
+ */
+ private void setSource(Source source) {
+ InternalMessage internalMessage = ctxt.getInternalMessage();
+ if (internalMessage == null) {
+ internalMessage = new InternalMessage();
+ ctxt.setInternalMessage(internalMessage);
+ }
+ BodyBlock bodyBlock = internalMessage.getBody();
+ if (bodyBlock == null) {
+ bodyBlock = new BodyBlock(source);
+ internalMessage.setBody(bodyBlock);
+ } else {
+ bodyBlock.setSource(source);
+ }
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/LogicalMessageImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/MessageContextImpl.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/MessageContextImpl.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/MessageContextImpl.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,62 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.handler;
+
+import java.util.HashMap;
+
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.MessageContext.Scope;
+
+/**
+ * Implementation of MessageContext. This class holds properties as
+ * well as keeping track of their scope.
+ *
+ * @author WS Development Team
+ */
+public class MessageContextImpl extends HashMap<String, Object>
+ implements MessageContext {
+
+ private HashMap<String, Scope> propertyScopes =
+ new HashMap<String, Scope>();
+
+
+ public void setScope(String name, Scope scope) {
+ if (!this.containsKey(name)) {
+ throw new IllegalArgumentException("Illegal use of setScope() on "
+
+ "non-existant property :"+ name);
+ }
+ propertyScopes.put(name, scope);
+ }
+
+ public Scope getScope(String name) {
+ if (!this.containsKey(name)) {
+ throw new IllegalArgumentException("Illegal use of getScope() on "
+
+ "non-existant property :"+ name);
+ }
+ Scope scope = propertyScopes.get(name);
+ if (scope == null) {
+ scope = Scope.HANDLER; // the default
+ }
+ return scope;
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/MessageContextImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/MessageContextUtil.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/MessageContextUtil.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/MessageContextUtil.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,138 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.handler;
+
+import static org.jboss.com.sun.xml.ws.handler.HandlerChainCaller.IGNORE_FAULT_PROPERTY;
+
+import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Iterator;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.MessageContext.Scope;
+import javax.xml.namespace.QName;
+import javax.xml.soap.AttachmentPart;
+import javax.xml.soap.SOAPException;
+import javax.activation.DataHandler;
+
+import org.jboss.com.sun.xml.ws.developer.JAXWSProperties;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.AttachmentBlock;
+import org.jboss.com.sun.xml.ws.util.ByteArrayDataSource;
+
+
+/**
+ * Utility to manipulate MessageContext properties
+ *
+ * @author WS Development Team
+ */
+public class MessageContextUtil {
+
+ public static Integer getHttpStatusCode(MessageContext ctxt) {
+ return (Integer)ctxt.get(MessageContext.HTTP_RESPONSE_CODE);
+ }
+
+ public static void setHttpStatusCode(MessageContext ctxt, Integer code) {
+ ctxt.put(MessageContext.HTTP_RESPONSE_CODE, code);
+ ctxt.setScope(MessageContext.HTTP_RESPONSE_CODE, Scope.APPLICATION);
+ }
+
+ public static void setQueryString(MessageContext ctxt, String queryString) {
+ ctxt.put(MessageContext.QUERY_STRING, queryString);
+ ctxt.setScope(MessageContext.QUERY_STRING, Scope.APPLICATION);
+ }
+
+ public static void setPathInfo(MessageContext ctxt, String pathInfo) {
+ ctxt.put(MessageContext.PATH_INFO, pathInfo);
+ ctxt.setScope(MessageContext.PATH_INFO, Scope.APPLICATION);
+ }
+
+ public static void setHttpRequestMethod(MessageContext ctxt, String method) {
+ ctxt.put(MessageContext.HTTP_REQUEST_METHOD, method);
+ ctxt.setScope(MessageContext.HTTP_REQUEST_METHOD, Scope.APPLICATION);
+ }
+
+ public static void setHttpRequestHeaders(MessageContext ctxt,
+ Map<String, List<String>> headers) {
+ ctxt.put(MessageContext.HTTP_REQUEST_HEADERS, headers);
+ ctxt.setScope(MessageContext.HTTP_REQUEST_HEADERS, Scope.APPLICATION);
+ }
+
+ public static void setHttpResponseHeaders(MessageContext ctxt,
+ Map<String, List<String>> headers) {
+ ctxt.put(MessageContext.HTTP_RESPONSE_HEADERS, headers);
+ ctxt.setScope(MessageContext.HTTP_RESPONSE_HEADERS, Scope.APPLICATION);
+ }
+
+ public static Map<String, List<String>>
getHttpResponseHeaders(MessageContext ctxt) {
+ return (Map<String,
List<String>>)ctxt.get(MessageContext.HTTP_RESPONSE_HEADERS);
+ }
+
+ public static void setWsdlOperation(MessageContext ctxt, QName name) {
+ ctxt.put(MessageContext.WSDL_OPERATION, name);
+ ctxt.setScope(MessageContext.WSDL_OPERATION, Scope.APPLICATION);
+ }
+
+ private static Map<String, DataHandler> getMessageAttachments(MessageContext
ctxt) {
+ String property = MessageContext.INBOUND_MESSAGE_ATTACHMENTS;
+ Boolean out = (Boolean)ctxt.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
+ if (out != null && out) {
+ property = MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS;
+ }
+
+ Object att = ctxt.get(property);
+ if(att == null){
+ Map<String, DataHandler> attMap = new HashMap<String,
DataHandler>();
+ ctxt.put(property, attMap);
+ ctxt.setScope(property, Scope.APPLICATION);
+ return attMap;
+ }
+ return (Map<String, DataHandler>)att;
+ }
+
+ public static void copyInboundMessageAttachments(MessageContext ctxt,
Iterator<AttachmentPart> attachments) throws SOAPException {
+ Map<String, DataHandler> attachMap = getMessageAttachments(ctxt);
+ while(attachments.hasNext()){
+ AttachmentPart ap = attachments.next();
+ DataHandler dh = new DataHandler(new
ByteArrayDataSource(ap.getRawContentBytes(), ap.getContentType()));
+ attachMap.put(ap.getContentId(), dh);
+ }
+ }
+
+ public static void addMessageAttachment(MessageContext ctxt, String cid, DataHandler
dh){
+ Map<String, DataHandler> attachMap = getMessageAttachments(ctxt);
+ attachMap.put(cid, dh);
+ }
+
+ /*
+ * See HandlerChainCaller for full details. When a ProtocolException
+ * is caught from the handler chain, this method is used to tell
+ * the runtime whether to use the fault in the current message or
+ * use the exception and create a new message.
+ */
+ public static boolean ignoreFaultInMessage(MessageContext context) {
+ if (context.get(IGNORE_FAULT_PROPERTY) == null) {
+ return false;
+ }
+ return (Boolean) context.get(IGNORE_FAULT_PROPERTY);
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/MessageContextUtil.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/PortInfoImpl.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/PortInfoImpl.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/PortInfoImpl.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,117 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.handler;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.handler.PortInfo;
+
+/**
+ * <p>Implementation of the PortInfo interface. This is just a simple
+ * class used to hold the info necessary to uniquely identify a port,
+ * including the port name, service name, and binding ID. This class
+ * is only used on the client side.
+ *
+ * <p>An instance is created by
+ * {@link org.jboss.com.sun.xml.ws.client.ServiceContextBuilder} when used to
+ * place a handler chain into the HandlerResolver map. Another is
+ * created later by
+ * {@link org.jboss.com.sun.xml.ws.client.WSServiceDelegate} to retrieve the
+ * necessary handler chain to set on a binding instance.
+ *
+ * @see org.jboss.com.sun.xml.ws.client.ServiceContextBuilder
+ * @see org.jboss.com.sun.xml.ws.client.WSServiceDelegate
+ * @see HandlerResolverImpl
+ *
+ * @author WS Development Team
+ */
+public class PortInfoImpl implements PortInfo {
+
+ private String bindingId;
+ private QName portName;
+ private QName serviceName;
+
+ /**
+ * The class is constructed with the information needed to identify
+ * a port. This information cannot be changed later.
+ *
+ * @param bindingId The binding ID string.
+ * @param portName The QName of the port.
+ * @param serviceName The QName of the service.
+ */
+ public PortInfoImpl(String bindingId, QName portName, QName serviceName) {
+ if (bindingId == null) {
+ throw new RuntimeException("bindingId cannot be null");
+ }
+ if (portName == null) {
+ throw new RuntimeException("portName cannot be null");
+ }
+ if (serviceName == null) {
+ throw new RuntimeException("serviceName cannot be null");
+ }
+ this.bindingId = bindingId;
+ this.portName = portName;
+ this.serviceName = serviceName;
+ }
+
+ public String getBindingID() {
+ return bindingId;
+ }
+
+ public QName getPortName() {
+ return portName;
+ }
+
+ public QName getServiceName() {
+ return serviceName;
+ }
+
+ /**
+ * Object.equals is overridden here so that PortInfo objects
+ * can be compared when using them as keys in the map in
+ * HandlerResolverImpl. This method relies on the equals()
+ * methods of java.lang.String and javax.xml.namespace.QName.
+ *
+ * @param obj The PortInfo object to test for equality.
+ * @return True if they match, and false if they do not or
+ * if the object passed in is not a PortInfo.
+ */
+ public boolean equals(Object obj) {
+ if (obj instanceof PortInfo) {
+ PortInfo info = (PortInfo) obj;
+ if (bindingId.equals(info.getBindingID()) &&
+ portName.equals(info.getPortName()) &&
+ serviceName.equals(info.getServiceName())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Needed so PortInfoImpl can be used as a key in a map. This
+ * method just delegates to the hashCode method of java.lang.String.
+ */
+ public int hashCode() {
+ return bindingId.hashCode();
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/PortInfoImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/SHDSOAPMessageContext.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/SHDSOAPMessageContext.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/SHDSOAPMessageContext.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,115 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.handler;
+import java.util.List;
+
+import java.lang.reflect.Method;
+
+import org.jboss.com.sun.xml.ws.encoding.JAXWSAttachmentMarshaller;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPEPTFactory;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.InternalMessage;
+import org.jboss.com.sun.xml.ws.spi.runtime.InternalSoapEncoder;
+import org.jboss.com.sun.xml.ws.spi.runtime.Invoker;
+import org.jboss.com.sun.xml.ws.spi.runtime.MessageContext;
+import org.jboss.com.sun.xml.ws.util.MessageInfoUtil;
+
+/**
+ * Implementation of SOAPMessageContext. This class is used at runtime
+ * to pass to the handlers for processing soap messages.
+ *
+ * @see MessageContextImpl
+ *
+ * @author WS Development Team
+ */
+public class SHDSOAPMessageContext extends SOAPMessageContextImpl implements
org.jboss.com.sun.xml.ws.spi.runtime.SOAPMessageContext {
+
+ SOAPHandlerContext handlerCtxt;
+
+ public SHDSOAPMessageContext(SOAPHandlerContext handlerCtxt) {
+ super(handlerCtxt);
+ this.handlerCtxt = handlerCtxt;
+ }
+
+ /**
+ * If there is a SOAPMessage already, use getSOAPMessage(). Ignore all other
+ * methods
+ */
+ public boolean isAlreadySoap() {
+ return handlerCtxt.getSOAPMessage() != null;
+ }
+
+ /*
+ * Returns InternalMessage's BodyBlock value
+ */
+ public Object getBody() {
+ return handlerCtxt.getBody();
+ }
+
+ /*
+ * Returns InternalMessage's HeaderBlock values
+ */
+ public List getHeaders() {
+ return handlerCtxt.getHeaders();
+ }
+
+ /*
+ * Use this MessageInfo to pass to InternalSoapEncoder write methods
+ */
+ public Object getMessageInfo() {
+ return handlerCtxt.getMessageInfo();
+ }
+
+ /*
+ * Encoder to marshall all JAXWS objects: RpcLitPayload, JAXBBridgeInfo etc
+ */
+ public InternalSoapEncoder getEncoder() {
+ return
(InternalSoapEncoder)((SOAPEPTFactory)handlerCtxt.getMessageInfo().getEPTFactory()).getSOAPEncoder();
+ }
+
+ public String getBindingId() {
+ return handlerCtxt.getBindingId();
+ }
+
+ public Method getMethod() {
+ return handlerCtxt.getMethod();
+ }
+
+ public void setCanonicalization(String algorithm) {
+ handlerCtxt.setCanonicalization(algorithm);
+ }
+
+ public Invoker getInvoker() {
+ return handlerCtxt.getInvoker();
+ }
+
+ /**
+ * Returns if MTOM is anbled
+ *
+ * @return true if MTOM is enabled otherwise returns false;
+ */
+ public boolean isMtomEnabled() {
+ JAXWSAttachmentMarshaller am =
MessageInfoUtil.getAttachmentMarshaller(handlerCtxt.getMessageInfo());
+ return (am != null)?am.isXOPPackage():false;
+ }
+
+}
+
\ No newline at end of file
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/SHDSOAPMessageContext.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/SOAPHandlerContext.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/SOAPHandlerContext.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/SOAPHandlerContext.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,110 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.handler;
+
+import javax.xml.ws.handler.LogicalMessageContext;
+import javax.xml.soap.SOAPMessage;
+
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.InternalMessage;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.spi.runtime.Invoker;
+
+/**
+ * The HandlerContext is used in the client and server runtime
+ * in {@link org.jboss.com.sun.xml.ws.protocol.soap.client.SOAPMessageDispatcher} and
+ * {@link org.jboss.com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher} to hold
+ * information about the current message.
+ *
+ * <p>It stores a {@link org.jboss.com.sun.xml.ws.pept.ept.MessageInfo} and
+ * {@link org.jboss.com.sun.xml.ws.encoding.soap.internal.InternalMessage}
+ * which are used by the rest of the runtime, and provides a bridge
+ * between these and the soap and logical message contexts that
+ * are used by the handlers.
+ *
+ * @see LogicalMessageContextImpl
+ * @see MessageContextImpl
+ * @see SOAPMessageContextImpl
+ *
+ * @author WS Development Team
+ */
+public class SOAPHandlerContext extends HandlerContext {
+
+ private SOAPMessage soapMessage;
+ private SOAPMessageContext soapContext;
+ private SHDSOAPMessageContext shdsoapContext;
+ private LogicalMessageContext logicalContext;
+
+ public SOAPHandlerContext(MessageInfo messageInfo,
+ InternalMessage internalMessage,
+ SOAPMessage soapMessage) {
+ super(messageInfo, internalMessage);
+ this.soapMessage = soapMessage;
+ }
+
+ public SOAPMessageContext getSOAPMessageContext() {
+ if (soapContext == null) {
+ soapContext = new SOAPMessageContextImpl(this);
+ }
+ return soapContext;
+ }
+
+ public SHDSOAPMessageContext getSHDSOAPMessageContext() {
+ if (shdsoapContext == null) {
+ shdsoapContext = new SHDSOAPMessageContext(this);
+ }
+ return shdsoapContext;
+ }
+
+ public LogicalMessageContext getLogicalMessageContext() {
+ if (logicalContext == null) {
+ logicalContext = new LogicalMessageContextImpl(this);
+ }
+ return logicalContext;
+ }
+
+
+ /**
+ * @return Returns the soapMessage.
+ */
+ public SOAPMessage getSOAPMessage() {
+ return soapMessage;
+ }
+
+
+ /**
+ * @param soapMessage The soapMessage to set.
+ */
+ public void setSOAPMessage(SOAPMessage soapMessage) {
+ this.soapMessage = soapMessage;
+ }
+
+ /**
+ * If there is a SOAPMessage already, use getSOAPMessage(). Ignore all other
+ * methods
+ */
+ public boolean isAlreadySoap() {
+ return getSOAPMessage() != null;
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/SOAPHandlerContext.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/SOAPMessageContextImpl.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/SOAPMessageContextImpl.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/SOAPMessageContextImpl.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,221 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.handler;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.namespace.QName;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPFactory;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPHeaderElement;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.com.sun.xml.ws.encoding.jaxb.JAXBBeanInfo;
+import org.jboss.com.sun.xml.ws.encoding.jaxb.JAXBTypeSerializer;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPEPTFactory;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.InternalMessage;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.xml.sax.InputSource;
+
+/**
+ * Implementation of SOAPMessageContext. This class is used at runtime
+ * to pass to the handlers for processing soap messages.
+ *
+ * @see MessageContextImpl
+ *
+ * @author WS Development Team
+ */
+public class SOAPMessageContextImpl implements SOAPMessageContext {
+
+ private SOAPHandlerContext handlerCtxt;
+ private MessageContext ctxt;
+ private Set<String> roles;
+ private static Map<String, Class> allowedTypes = null;
+ private boolean failure;
+
+ public SOAPMessageContextImpl(SOAPHandlerContext handlerCtxt) {
+ this.handlerCtxt = handlerCtxt;
+ this.ctxt = handlerCtxt.getMessageContext();
+ if (allowedTypes == null) {
+ allowedTypes = new HashMap<String, Class>();
+ allowedTypes.put(MessageContext.INBOUND_MESSAGE_ATTACHMENTS, Map.class);
+ allowedTypes.put(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS, Map.class);
+ allowedTypes.put(MessageContext.WSDL_DESCRIPTION, InputSource.class);
+ allowedTypes.put(MessageContext.WSDL_SERVICE, QName.class);
+ allowedTypes.put(MessageContext.WSDL_PORT, QName.class);
+ allowedTypes.put(MessageContext.WSDL_INTERFACE, QName.class);
+ allowedTypes.put(MessageContext.WSDL_OPERATION, QName.class);
+ allowedTypes.put(MessageContext.MESSAGE_OUTBOUND_PROPERTY, Boolean.class);
+ }
+ }
+
+ public SOAPMessage getMessage() {
+ SOAPMessage soap = handlerCtxt.getSOAPMessage();
+ InternalMessage intr = handlerCtxt.getInternalMessage();
+ if (intr == null && soap != null) {
+ // Not much to do
+ } else if (intr != null && soap != null) {
+ // Overlay BodyBlock of InternalMessage on top of existing SOAPMessage
+ MessageInfo messageInfo = handlerCtxt.getMessageInfo();
+ SOAPEPTFactory eptf = (SOAPEPTFactory)messageInfo.getEPTFactory();
+ soap = eptf.getSOAPEncoder().toSOAPMessage(intr, soap);
+ setMessage(soap); // It also sets InernalMessage to null
+ } else if (intr != null && soap == null) {
+ // Convert InternalMessage to a SOAPMessage
+ MessageInfo messageInfo = handlerCtxt.getMessageInfo();
+ SOAPEPTFactory eptf = (SOAPEPTFactory)messageInfo.getEPTFactory();
+ soap = eptf.getSOAPEncoder().toSOAPMessage(intr, messageInfo);
+ setMessage(soap); // It also sets InernalMessage to null
+ } else {
+ throw new WebServiceException("Don't have SOAPMessage");
+ }
+ return soap;
+ }
+
+ public void setMessage(SOAPMessage soapMessage) {
+ handlerCtxt.setSOAPMessage(soapMessage);
+ // current InternalMessage is not valid anymore. So reset it.
+ handlerCtxt.setInternalMessage(null);
+ }
+
+
+ public Object[] getHeaders(QName header, JAXBContext jaxbContext, boolean allRoles)
{
+ try {
+ List beanList = new ArrayList();
+ SOAPMessage msg = getMessage();
+ SOAPHeader sHeader = msg.getSOAPHeader();
+ if (sHeader == null) {
+ return new Object[0];
+ }
+ Iterator i = sHeader.getChildElements(header);
+ while(i.hasNext()) {
+ SOAPHeaderElement child = (SOAPHeaderElement)i.next();
+ if(allRoles) {
+ //If allRoles is true, add all headers
+ Source source = new DOMSource(child);
+ beanList.add(JAXBTypeSerializer.deserialize(source, jaxbContext));
+ } else {
+ //If allRoles is false, add only headers with matching roles and
headers with no role
+ if( (child.getActor() == null)||
+ (getRoles().contains(child.getActor())) ) {
+ Source source = new DOMSource(child);
+ beanList.add(JAXBTypeSerializer.deserialize(source,
jaxbContext));
+ }
+ }
+ }
+ return beanList.toArray();
+ } catch(Exception e) {
+ throw new WebServiceException(e);
+ }
+ }
+
+ public Set<String> getRoles() {
+ return roles;
+ }
+
+ void setRoles(Set<String> roles) {
+ this.roles = roles;
+ }
+
+ private boolean validateProperty(String name, Object value) {
+ if (allowedTypes.containsKey(name)) {
+ Class clazz = allowedTypes.get(name);
+ if (!(clazz.isInstance(value)))
+ throw new
HandlerException("handler.messageContext.invalid.class",
+ new Object[] { value, name });
+ }
+
+ return true;
+ }
+
+ public void setScope(String name, Scope scope) {
+ ctxt.setScope(name, scope);
+ }
+
+ public Scope getScope(String name) {
+ return ctxt.getScope(name);
+ }
+
+ /* java.util.Map methods below here */
+
+ public void clear() {
+ ctxt.clear();
+ }
+
+ public boolean containsKey(Object obj) {
+ return ctxt.containsKey(obj);
+ }
+
+ public boolean containsValue(Object obj) {
+ return ctxt.containsValue(obj);
+ }
+
+ public Set<Entry<String, Object>> entrySet() {
+ return ctxt.entrySet();
+ }
+
+ public Object get(Object obj) {
+ return ctxt.get(obj);
+ }
+
+ public boolean isEmpty() {
+ return ctxt.isEmpty();
+ }
+
+ public Set<String> keySet() {
+ return ctxt.keySet();
+ }
+
+ public Object put(String str, Object obj) {
+ return ctxt.put(str, obj);
+ }
+
+ public void putAll(Map<? extends String, ? extends Object> map) {
+ ctxt.putAll(map);
+ }
+
+ public Object remove(Object obj) {
+ return ctxt.remove(obj);
+ }
+
+ public int size() {
+ return ctxt.size();
+ }
+
+ public Collection<Object> values() {
+ return ctxt.values();
+ }
+
+}
\ No newline at end of file
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/SOAPMessageContextImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/XMLHandlerContext.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/XMLHandlerContext.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/XMLHandlerContext.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,122 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.handler;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+import javax.xml.ws.handler.LogicalMessageContext;
+
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.InternalMessage;
+import org.jboss.com.sun.xml.ws.encoding.xml.XMLMessage;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.spi.runtime.Invoker;
+import org.jboss.com.sun.xml.ws.spi.runtime.MessageContext;
+
+import java.lang.reflect.Method;
+
+
+/**
+ * Version of {@link HandlerContext} for XML/HTTP binding that
+ * only deals with logical messages.
+ *
+ * <p>Class has to defer information to HandlerContext so that properties
+ * are shared between this and SOAPMessageContext.
+ *
+ * @see HandlerContext
+ *
+ * @author WS Development Team
+ * @author WS Development Team
+ */
+public class XMLHandlerContext extends HandlerContext {
+
+ private XMLMessage xmlMessage;
+ private LogicalMessageContext logicalContext;
+ private SHDXMLMessageContext shdXmlContext;
+
+ public XMLHandlerContext(MessageInfo messageInfo,
+ InternalMessage internalMessage,
+ XMLMessage xmlMessage) {
+ super(messageInfo, internalMessage);
+ this.xmlMessage = xmlMessage;
+ }
+
+ public LogicalMessageContext getLogicalMessageContext() {
+ if (logicalContext == null) {
+ logicalContext = new XMLLogicalMessageContextImpl(this);
+ }
+ return logicalContext;
+ }
+
+ /**
+ * @return Returns XMLMessage
+ */
+ public XMLMessage getXMLMessage() {
+ return xmlMessage;
+ }
+
+ /**
+ * @param xmlMessage The xmlMessage to set.
+ */
+ public void setXMLMessage(XMLMessage xmlMessage) {
+ this.xmlMessage = xmlMessage;
+ }
+
+ public SHDXMLMessageContext getSHDXMLMessageContext() {
+ if (shdXmlContext == null) {
+ shdXmlContext = new SHDXMLMessageContext(this);
+ }
+ return shdXmlContext;
+ }
+
+ private static class SHDXMLMessageContext extends XMLLogicalMessageContextImpl
implements org.jboss.com.sun.xml.ws.spi.runtime.MessageContext {
+
+ XMLHandlerContext handlerCtxt;
+
+ public SHDXMLMessageContext(XMLHandlerContext handlerCtxt) {
+ super(handlerCtxt);
+ this.handlerCtxt = handlerCtxt;
+ }
+
+ public String getBindingId() {
+ return handlerCtxt.getBindingId();
+ }
+
+ public Method getMethod() {
+ return handlerCtxt.getMethod();
+ }
+
+ public void setCanonicalization(String algorithm) {
+ handlerCtxt.setCanonicalization(algorithm);
+ }
+
+ public Invoker getInvoker() {
+ return handlerCtxt.getInvoker();
+ }
+
+ public boolean isMtomEnabled() {
+ return false;
+ }
+
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/XMLHandlerContext.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/XMLLogicalMessageContextImpl.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/XMLLogicalMessageContextImpl.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/XMLLogicalMessageContextImpl.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,127 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.handler;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import javax.xml.ws.LogicalMessage;
+import javax.xml.ws.handler.LogicalMessageContext;
+import javax.xml.ws.handler.MessageContext.Scope;
+import javax.xml.ws.handler.MessageContext;
+
+/**
+ * Implementation of LogicalMessageContext that is used in
+ * the XML/HTTP binding. It is similar to LogicalMessageContextImpl
+ * except that the message impl class it uses is a
+ * {@link XMLLogicalMessageImpl} rather than a
+ * {@link LogicalMessageImpl}.
+ *
+ * <p>Class has to defer information to HandlerContext so that properties
+ * are shared between this and SOAPMessageContext.
+ *
+ * @see LogicalMessageImpl
+ * @see XMLHandlerContext
+ * @see XMLLogicalMessageImpl
+ *
+ * @author WS Development Team
+ */
+public class XMLLogicalMessageContextImpl implements LogicalMessageContext {
+
+ private MessageContext ctxt;
+ private XMLHandlerContext handlerCtxt;
+
+ public XMLLogicalMessageContextImpl(XMLHandlerContext handlerCtxt) {
+ this.handlerCtxt = handlerCtxt;
+ ctxt = handlerCtxt.getMessageContext();
+ }
+
+ public XMLHandlerContext getHandlerContext() {
+ return handlerCtxt;
+ }
+
+ public LogicalMessage getMessage() {
+ return new XMLLogicalMessageImpl(handlerCtxt);
+ }
+
+ public void setScope(String name, Scope scope) {
+ ctxt.setScope(name, scope);
+ }
+
+ public Scope getScope(String name) {
+ return ctxt.getScope(name);
+ }
+
+ /* java.util.Map methods below here */
+
+ public void clear() {
+ ctxt.clear();
+ }
+
+ public boolean containsKey(Object obj) {
+ return ctxt.containsKey(obj);
+ }
+
+ public boolean containsValue(Object obj) {
+ return ctxt.containsValue(obj);
+ }
+
+ public Set<Entry<String, Object>> entrySet() {
+ return ctxt.entrySet();
+ }
+
+ public Object get(Object obj) {
+ return ctxt.get(obj);
+ }
+
+ public boolean isEmpty() {
+ return ctxt.isEmpty();
+ }
+
+ public Set<String> keySet() {
+ return ctxt.keySet();
+ }
+
+ public Object put(String str, Object obj) {
+ return ctxt.put(str, obj);
+ }
+
+ public void putAll(Map<? extends String, ? extends Object> map) {
+ ctxt.putAll(map);
+ }
+
+ public Object remove(Object obj) {
+ return ctxt.remove(obj);
+ }
+
+ public int size() {
+ return ctxt.size();
+ }
+
+ public Collection<Object> values() {
+ return ctxt.values();
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/XMLLogicalMessageContextImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/XMLLogicalMessageImpl.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/XMLLogicalMessageImpl.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/XMLLogicalMessageImpl.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,89 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.handler;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.ws.LogicalMessage;
+import javax.xml.transform.Source;
+
+import org.jboss.com.sun.xml.ws.encoding.xml.XMLMessage;
+
+/**
+ * Implementation of LogicalMessage that is used in the
+ * XML/HTTP binding. It is similar to LogicalMessageImpl
+ * except that the context object passed in is an
+ * {@link XMLHandlerContext} rather than a {@link HandlerContext}.
+ *
+ * @see LogicalMessageImpl
+ * @see XMLHandlerContext
+ * @see XMLLogicalMessageContextImpl
+ *
+ * @author WS Development Team
+ */
+public class XMLLogicalMessageImpl implements LogicalMessage {
+
+ private XMLHandlerContext ctxt;
+
+ public XMLLogicalMessageImpl(XMLHandlerContext ctxt) {
+ this.ctxt = ctxt;
+ }
+
+ /*
+ * Gets the source from XMLMessage. XMLMessage gives a copy of existing
+ * data
+ */
+ public Source getPayload() {
+ XMLMessage xmlMessage = ctxt.getXMLMessage();
+ return xmlMessage.getPayload();
+ }
+
+ /*
+ * Sets the Source as payload in XMLMessage
+ */
+ public void setPayload(Source source) {
+ XMLMessage xmlMessage = ctxt.getXMLMessage();
+ xmlMessage = new XMLMessage(source, xmlMessage.getAttachments(),
xmlMessage.useFastInfoset());
+ ctxt.setXMLMessage(xmlMessage);
+ }
+
+ /*
+ * Gets XMLMessage data as JAXB bean
+ */
+ public Object getPayload(JAXBContext jaxbContext) {
+ XMLMessage xmlMessage = ctxt.getXMLMessage();
+ return xmlMessage.getPayload(jaxbContext);
+ }
+
+ /*
+ * Sets JAXB bean into XMLMessage
+ */
+ public void setPayload(Object bean, JAXBContext jaxbContext) {
+ XMLMessage xmlMessage = ctxt.getXMLMessage();
+ xmlMessage = new XMLMessage(bean, jaxbContext, xmlMessage.getAttachments(),
xmlMessage.useFastInfoset());
+ ctxt.setXMLMessage(xmlMessage);
+ }
+
+ public XMLHandlerContext getHandlerContext() {
+ return ctxt;
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/XMLLogicalMessageImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/package-info.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/package-info.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/package-info.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,98 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+/**
+ * <h1>JAX-WS 2.0 Handler Runtime</h1>
+ * <p>This document describes the architecture of the handler code
+ * in the JAX-WS 2.0 runtime.
+ *
+ * <p>Handlers may be specified by the deployment descriptor on the
+ * server side, or by a wsdl customization or Java annotation. In the
+ * case of a wsdl customization, wsimport will create the Java interface
+ * with the handler chain annotation and will create a handler xml file
+ * to which the annotation points. At runtime, thus, only deployment
+ * descriptors and handler files pointed to by annotations are parsed.
+ * The schema in all cases is the same, and @HandlerChainAnnotation is
+ * processed by {@link org.jboss.com.sun.xml.ws.util.HandlerAnnotationProcessor}, which
+ * delegates the parsing of handler configuartion file to
+ * {@link org.jboss.com.sun.xml.ws.handler.HandlerChainsModel} .
+ *
+ * <h3>Server side handler creation</h3>
+ *
+ * <p>The deployment descriptor is first parsed, and
+ * {@link
org.jboss.com.sun.xml.ws.transport.http.servlet.RuntimeEndpointInfoParser#setHandlersAndRoles}
+ * parses the handler chains xml in the deployment descriptor if present.
+ * It then sets the handlers and roles on the Binding object that has
+ * already been created. Setting the handler chain on the binding does
+ * not automatically create a handler chain caller.
+ *
+ * <p>Later, when
+ * {@link org.jboss.com.sun.xml.ws.server.RuntimeEndpointInfo#init} is parsing the
+ * annotations it checks for handlers on the binding. If there are handlers
+ * already, it skips any further handler processing. In this way, the deployment
+ * descriptor overrides any other handlers. If there are no handlers on
+ * the binding at this point, RuntimeEndpointInfo has the
+ * HandlerAnnotationProcessor parse the handler chain file and then
+ * sets the handlers and roles on the binding.
+ *
+ * <h3>Client side handler creation</h3>
+ *
+ * <p>On the client side, the @HandlerChain annotation on generated Service
+ * class is processed by {@link
org.jboss.com.sun.xml.ws.client.ServiceContextBuilder#build}.
+ * If there is @HandlerChain on service class, the ServiceContextBuilder creates
+ * HandlerResolverImpl from that handler file and sets it on the
+ * {@link org.jboss.com.sun.xml.ws.client.ServiceContext}. @HandlerChain annotations on
+ * the SEIs are ignored on the client-side.
+ *
+ * <p>Unlike the server side, there is no binding object already
+ * created when the handlers are parsed. When a binding provider is created, the
+ * {@link org.jboss.com.sun.xml.ws.client.WSServiceDelegate} will use the handler
+ * registry (which may be the HandlerResolverImpl or another handler
+ * resolver set on the service by the user code) to get the handlers to
+ * set on the binding. It will get the roles from the service context and
+ * set those on the binding if it is a soap binding. The relevant method is
+ * {@link org.jboss.com.sun.xml.ws.client.WSServiceDelegate#setBindingOnProvider}
+ *
+ * <h3>Calling the handlers</h3>
+ *
+ * <p>During a request or response, a
+ * {@link org.jboss.com.sun.xml.ws.handler.HandlerChainCaller} is
+ * created by the binding or may be created by a message dispatcher on the
+ * server side (this happens in the http binding right now). In the binding
+ * objects, the handler caller is not created until needed, and it sets
+ * the handlers and roles (if present) on the handler chain caller then.
+ * See {@link org.jboss.com.sun.xml.ws.binding.BindingImpl#getHandlerChainCaller}
+ * and {@link
org.jboss.com.sun.xml.ws.binding.soap.SOAPBindingImpl#getHandlerChainCaller}
+ * for more details.
+ *
+ * <p>The handler chain caller does the handler invocation and controls the
+ * flow of the handlers. For details of the code that calls the handler
+ * chain caller, see
+ * {@link org.jboss.com.sun.xml.ws.protocol.soap.client.SOAPMessageDispatcher}
+ * on the client side and
+ * {@link org.jboss.com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher} and
+ * {@link org.jboss.com.sun.xml.ws.protocol.xml.server.XMLMessageDispatcher} on the
+ * server side.
+ *
+ * @ArchitectureDocument
+ */
+package org.jboss.com.sun.xml.ws.handler;
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/handler/package-info.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/CheckedException.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/CheckedException.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/CheckedException.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,103 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.model;
+
+import com.sun.xml.bind.api.TypeReference;
+import java.lang.reflect.Type;
+
+/**
+ * CheckedException class. Holds the exception class - class that has public
+ * constructor
+ *
+ * <code>public WrapperException()String message, FaultBean){}</code>
+ *
+ * and method
+ *
+ * <code>public FaultBean getFaultInfo();</code>
+ *
+ * @author Vivek Pandey
+ */
+
+public class CheckedException {
+ /**
+ * @param exceptionClass
+ * Userdefined or WSDL exception class that extends
+ * java.lang.Exception.
+ * @param detail
+ * detail or exception bean's TypeReference
+ * @param exceptionType
+ * either ExceptionType.UserDefined or
+ * ExceptionType.WSDLException
+ */
+ public CheckedException(Class exceptionClass, TypeReference detail, ExceptionType
exceptionType) {
+ this.detail = detail;
+ this.exceptionType = exceptionType;
+ this.exceptionClass = exceptionClass;
+ }
+
+ /**
+ * @return the <code>Class</clode> for this object
+ *
+ */
+ public Class getExcpetionClass() {
+ return exceptionClass;
+ }
+
+ public Class getDetailBean() {
+ return (Class) detail.type;
+ }
+
+ public TypeReference getDetailType() {
+ return detail;
+ }
+
+ public ExceptionType getExceptionType() {
+ return exceptionType;
+ }
+
+ public void setHeaderFault(boolean hf) {
+ this.headerFault = hf;
+ }
+
+ public boolean isHeaderFault() {
+ return headerFault;
+ }
+
+ public void setMessageName(String messageName) {
+ this.messageName = messageName;
+ }
+
+ public String getMessageName() {
+ return messageName;
+ }
+
+ private Class exceptionClass;
+
+ private TypeReference detail;
+
+ private ExceptionType exceptionType;
+
+ private boolean headerFault = false;
+
+ private String messageName;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/CheckedException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/ExceptionType.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/ExceptionType.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/ExceptionType.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,39 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.model;
+/**
+ * Type of java exception
+ *
+ * @author Vivek Pandey
+ */
+public enum ExceptionType {
+ WSDLException(0), UserDefined(1);
+
+ ExceptionType(int exceptionType){
+ this.exceptionType = exceptionType;
+ }
+
+ public int value() {
+ return exceptionType;
+ }
+ private final int exceptionType;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/ExceptionType.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/JavaMethod.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/JavaMethod.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/JavaMethod.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,235 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.model;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.jboss.com.sun.xml.ws.model.soap.SOAPBinding;
+import org.jboss.com.sun.xml.ws.pept.presentation.MessageStruct;
+
+import com.sun.xml.bind.api.TypeReference;
+
+/**
+ * Build this runtime model using java SEI and annotations
+ *
+ * @author Vivek Pandey
+ */
+public class JavaMethod {
+ /**
+ *
+ */
+ public JavaMethod(Method method) {
+ this.method = method;
+ }
+
+ /**
+ * @return Returns the method.
+ */
+ public Method getMethod() {
+ return method;
+ }
+
+ /**
+ * @return Returns the mep.
+ */
+ public int getMEP() {
+ return mep;
+ }
+
+ /**
+ * @param mep
+ * The mep to set.
+ */
+ public void setMEP(int mep) {
+ this.mep = mep;
+ }
+
+ /**
+ * @return the Binding object
+ */
+ public Object getBinding() {
+ if (binding == null)
+ return new SOAPBinding();
+ return binding;
+ }
+
+ /**
+ * @param binding
+ */
+ public void setBinding(Object binding) {
+ this.binding = binding;
+ }
+
+
+ public void setOperationName(String operationName) {
+ this.operationName = operationName;
+ }
+
+ public String getOperationName() {
+ return operationName;
+ }
+
+
+
+ /**
+ * @return returns unmodifiable list of request parameters
+ */
+ public List<Parameter> getRequestParameters() {
+ return unmReqParams;
+ }
+
+ /**
+ * @return returns unmodifiable list of response parameters
+ */
+ public List<Parameter> getResponseParameters() {
+ return unmResParams;
+ }
+
+ /**
+ * @param p
+ */
+ public void addParameter(Parameter p) {
+ if (p.isIN() || p.isINOUT()) {
+ if (requestParams.contains(p)) {
+ // TODO throw exception
+ }
+ requestParams.add(p);
+ }
+
+ if (p.isOUT() || p.isINOUT()) {
+ // this check is only for out parameters
+ if (requestParams.contains(p)) {
+ // TODO throw exception
+ }
+ responseParams.add(p);
+ }
+ }
+
+ public void addRequestParameter(Parameter p){
+ if (p.isIN() || p.isINOUT()) {
+ requestParams.add(p);
+ }
+ }
+
+ public void addResponseParameter(Parameter p){
+ if (p.isOUT() || p.isINOUT()) {
+ responseParams.add(p);
+ }
+ }
+
+ /**
+ * @return Returns number of java method parameters - that will be all the
+ * IN, INOUT and OUT holders
+ */
+ public int getInputParametersCount() {
+ int count = 0;
+ for (Parameter param : requestParams) {
+ if (param.isWrapperStyle()) {
+ count += ((WrapperParameter) param).getWrapperChildren().size();
+ } else {
+ count++;
+ }
+ }
+
+ for (Parameter param : responseParams) {
+ if (param.isWrapperStyle()) {
+ for (Parameter wc : ((WrapperParameter) param).getWrapperChildren()) {
+ if (!wc.isResponse() && wc.isOUT()) {
+ count++;
+ }
+ }
+ } else if (!param.isResponse() && param.isOUT()) {
+ count++;
+ }
+ }
+
+ return count;
+ }
+
+ /**
+ * @param ce
+ */
+ public void addException(CheckedException ce) {
+ if (!exceptions.contains(ce))
+ exceptions.add(ce);
+ }
+
+ /**
+ * @param exceptionClass
+ * @return CheckedException corresponding to the exceptionClass. Returns
+ * null if not found.
+ */
+ public CheckedException getCheckedException(Class exceptionClass) {
+ for (CheckedException ce : exceptions) {
+ if (ce.getExcpetionClass().equals(exceptionClass))
+ return ce;
+ }
+ return null;
+ }
+
+ /**
+ * @return a list of checked Exceptions thrown by this method
+ */
+ public List<CheckedException> getCheckedExceptions(){
+ return Collections.unmodifiableList(exceptions);
+ }
+ /**
+ * @param detailType
+ * @return Gets the CheckedException corresponding to detailType. Returns
+ * null if no CheckedExcpetion with the detailType found.
+ */
+ public CheckedException getCheckedException(TypeReference detailType) {
+ for (CheckedException ce : exceptions) {
+ TypeReference actual = ce.getDetailType();
+ if (actual.tagName.equals(detailType.tagName)
+ && actual.type.getClass().getName()
+ .equals(detailType.type.getClass().getName())) {
+ return ce;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns if the java method MEP is async
+ * @return if this is an Asynch MEP
+ */
+ public boolean isAsync(){
+ return mep == MessageStruct.ASYNC_CALLBACK_MEP || mep ==
MessageStruct.ASYNC_POLL_MEP;
+ }
+
+ private List<CheckedException> exceptions = new
ArrayList<CheckedException>();
+ private Method method;
+ private final List<Parameter> requestParams = new
ArrayList<Parameter>();
+ private final List<Parameter> responseParams = new
ArrayList<Parameter>();
+ private final List<Parameter> unmReqParams =
+ Collections.unmodifiableList(requestParams);
+ private final List<Parameter> unmResParams =
+ Collections.unmodifiableList(responseParams);
+ private Object binding;
+ private int mep;
+ private String operationName;
+}
+
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/JavaMethod.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/Mode.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/Mode.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/Mode.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,38 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.model;
+
+/**
+ * Defines parameter mode, IN, OUT or INOUT
+ *
+ * @author Vivek Pandey
+ */
+
+public enum Mode {
+ IN(0), OUT(1), INOUT(2);
+
+ private Mode(int mode){
+ this.mode = mode;
+ }
+ private final int mode;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/Mode.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/Parameter.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/Parameter.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/Parameter.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,196 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.model;
+
+import com.sun.xml.bind.api.TypeReference;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Holder;
+
+/**
+ * runtime Parameter that abstracts the annotated java parameter
+ *
+ * @author Vivek Pandey
+ */
+
+public class Parameter {
+ /**
+ *
+ */
+ public Parameter(TypeReference type, Mode mode, int index) {
+ this.typeReference = type;
+ this.name = type.tagName;
+ this.mode = mode;
+ this.index = index;
+ }
+
+ /**
+ * @return Returns the name.
+ */
+ public QName getName() {
+ return name;
+ }
+
+ /**
+ * @return Returns the TypeReference associated with this Parameter
+ */
+ public TypeReference getTypeReference() {
+ return typeReference;
+ }
+
+ /**
+ * Sometimes we need to overwrite the typeReferenc, such as during patching for
rpclit
+ * @see
RuntimeModel#applyParameterBinding(org.jboss.com.sun.xml.ws.wsdl.parser.Binding)
+ */
+
+ void setTypeReference(TypeReference type){
+ typeReference = type;
+ name = type.tagName;
+ }
+
+ /**
+ * @return Returns the mode.
+ */
+ public Mode getMode() {
+ return mode;
+ }
+
+ /**
+ * @return Returns the index.
+ */
+ public int getIndex() {
+ return index;
+ }
+
+ /**
+ * @return WrapperStyle == true
+ */
+ public boolean isWrapperStyle() {
+ return false;
+ }
+
+ /**
+ * @return the Binding for this Parameter
+ */
+ public ParameterBinding getBinding() {
+ if(binding == null)
+ return ParameterBinding.BODY;
+ return binding;
+ }
+
+ /**
+ * @param binding
+ */
+ public void setBinding(ParameterBinding binding) {
+ this.binding = binding;
+ }
+
+ public void setInBinding(ParameterBinding binding){
+ this.binding = binding;
+ }
+
+ public void setOutBinding(ParameterBinding binding){
+ this.outBinding = binding;
+ }
+
+ public ParameterBinding getInBinding(){
+ return binding;
+ }
+
+ public ParameterBinding getOutBinding(){
+ if(outBinding == null)
+ return binding;
+ return outBinding;
+ }
+
+ public boolean isIN() {
+ return mode==Mode.IN;
+ }
+
+ public boolean isOUT() {
+ return mode==Mode.OUT;
+ }
+
+ public boolean isINOUT() {
+ return mode==Mode.INOUT;
+ }
+
+ public boolean isResponse() {
+ return index == -1;
+ }
+
+ /**
+ * Creates a holder if applicable else gives the object as it is. To be
+ * called on the inbound message.
+ *
+ * @param value
+ * @return the non-holder value if its Response or IN otherwise creates a
+ * holder with the passed value and returns it back.
+ *
+ */
+ public Object createHolderValue(Object value) {
+ if (isResponse() || isIN()) {
+ return value;
+ }
+ return new Holder(value);
+ }
+
+ /**
+ * Gets the holder value if applicable. To be called for inbound client side
+ * message.
+ *
+ * @param obj
+ * @return the holder value if applicable.
+ */
+ public Object getHolderValue(Object obj) {
+ if (obj != null && obj instanceof Holder)
+ return ((Holder) obj).value;
+ return obj;
+ }
+
+ public static void setHolderValue(Object obj, Object value) {
+ if (obj instanceof Holder)
+ ((Holder) obj).value = value;
+ else
+ // TODO: this can't be correct
+ obj = value;
+ }
+
+ public String getPartName() {
+ if(partName == null)
+ return name.getLocalPart();
+ return partName;
+ }
+
+ public void setPartName(String partName) {
+ this.partName = partName;
+ }
+
+ protected ParameterBinding binding;
+ protected ParameterBinding outBinding;
+ protected int index;
+ protected Mode mode;
+ protected TypeReference typeReference;
+ protected QName name;
+ protected String partName;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/Parameter.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/ParameterBinding.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/ParameterBinding.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/ParameterBinding.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,111 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.model;
+
+/**
+ * Denotes the binding of a parameter.
+ *
+ * <p>
+ * This is somewhat like an enumeration (but it is <b>NOT</b> an
enumeration.)
+ *
+ * <p>
+ * The possible values are
+ * BODY, HEADER, UNBOUND, and ATTACHMENT. BODY, HEADER, and UNBOUND
+ * has a singleton semantics, but there are multiple ATTACHMENT instances
+ * as it carries additional MIME type parameter.
+ *
+ * <p>
+ * So don't use '==' for testing the equality.
+ */
+public final class ParameterBinding {
+ /**
+ * Singleton instance that represents 'BODY'
+ */
+ public static final ParameterBinding BODY = new
ParameterBinding("BODY",null);
+ /**
+ * Singleton instance that represents 'HEADER'
+ */
+ public static final ParameterBinding HEADER = new
ParameterBinding("HEADER",null);
+ /**
+ * Singleton instance that represents 'UNBOUND',
+ * meaning the parameter doesn't have a representation in a SOAP message.
+ */
+ public static final ParameterBinding UNBOUND = new
ParameterBinding("UNBOUND",null);
+ /**
+ * Creates an instance that represents the attachment
+ * with a given MIME type.
+ *
+ * <p>
+ * TODO: shall we consider givint the singleton semantics by using
+ * a cache? It's more elegant to do so, but
+ * no where in JAX-WS RI two {@link ParameterBinding}s are compared today,
+ */
+ public static ParameterBinding createAttachment(String mimeType) {
+ return new ParameterBinding("ATTACHMENT",mimeType);
+ }
+
+
+ private String mimeType;
+ private final String name;
+
+ private ParameterBinding(String name,String mimeType) {
+ this.name = name;
+ this.mimeType = mimeType;
+ }
+
+
+
+ public String toString() {
+ return name;
+ }
+
+ /**
+ * Returns the MIME type associated with this binding.
+ *
+ * @throws IllegalStateException
+ * if this binding doesn't represent an attachment.
+ * IOW, if {@link #isAttachment()} returns false.
+ * @return
+ * Can be null, if the MIME type is not known.
+ */
+ public String getMimeType() {
+ if(!isAttachment())
+ throw new IllegalStateException();
+ return mimeType;
+ }
+
+ public boolean isBody(){
+ return this==BODY;
+ }
+
+ public boolean isHeader(){
+ return this==HEADER;
+ }
+
+ public boolean isUnbound(){
+ return this==UNBOUND;
+ }
+
+ public boolean isAttachment(){
+ return name=="ATTACHMENT";
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/ParameterBinding.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/RuntimeModel.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/RuntimeModel.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/RuntimeModel.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,619 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.model;
+
+import com.sun.xml.bind.api.Bridge;
+import com.sun.xml.bind.api.BridgeContext;
+import com.sun.xml.bind.api.JAXBRIContext;
+import com.sun.xml.bind.api.TypeReference;
+import com.sun.xml.bind.api.RawAccessor;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.WebServiceException;
+
+import org.jboss.com.sun.xml.ws.encoding.JAXWSAttachmentMarshaller;
+import org.jboss.com.sun.xml.ws.encoding.JAXWSAttachmentUnmarshaller;
+import org.jboss.com.sun.xml.ws.encoding.jaxb.JAXBBridgeInfo;
+import org.jboss.com.sun.xml.ws.encoding.jaxb.RpcLitPayload;
+import org.jboss.com.sun.xml.ws.encoding.soap.streaming.SOAPNamespaceConstants;
+import org.jboss.com.sun.xml.ws.model.soap.SOAPBinding;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.wsdl.parser.Binding;
+import org.jboss.com.sun.xml.ws.wsdl.parser.BindingOperation;
+import org.jboss.com.sun.xml.ws.wsdl.parser.Part;
+import org.jboss.com.sun.xml.ws.wsdl.writer.WSDLGenerator;
+
+import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * model of the web service. Used by the runtime marshall/unmarshall
+ * web service invocations
+ *
+ * $author: JAXWS Development Team
+ */
+public abstract class RuntimeModel {
+
+ /**
+ *
+ */
+ public RuntimeModel() {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+
+ public void postProcess() {
+ // should be called only once.
+ if (jaxbContext != null)
+ return;
+ populateMaps();
+ populateAsyncExceptions();
+ createJAXBContext();
+ createDecoderInfo();
+ }
+
+ /**
+ * Populate methodToJM and nameToJM maps.
+ */
+ protected void populateMaps() {
+ for (JavaMethod jm : getJavaMethods()) {
+ put(jm.getMethod(), jm);
+ for (Parameter p : jm.getRequestParameters()) {
+ put(p.getName(), jm);
+ }
+ }
+ }
+
+ protected void populateAsyncExceptions() {
+ for (JavaMethod jm : getJavaMethods()) {
+ int mep = jm.getMEP();
+ if (mep == MessageInfo.ASYNC_CALLBACK_MEP || mep ==
MessageInfo.ASYNC_POLL_MEP) {
+ String opName = jm.getOperationName();
+ Method m = jm.getMethod();
+ Class[] params = m.getParameterTypes();
+ if (mep == MessageInfo.ASYNC_CALLBACK_MEP) {
+ params = new Class[params.length-1];
+ System.arraycopy(m.getParameterTypes(), 0, params, 0,
m.getParameterTypes().length-1);
+ }
+ try {
+ Method om = m.getDeclaringClass().getMethod(opName, params);
+ JavaMethod jm2 = getJavaMethod(om);
+ for (CheckedException ce : jm2.getCheckedExceptions()) {
+ jm.addException(ce);
+ }
+ } catch (NoSuchMethodException ex) {
+ }
+ }
+ }
+ }
+
+ /**
+ * @return the <code>BridgeContext</code> for this
<code>RuntimeModel</code>
+ */
+ public BridgeContext getBridgeContext() {
+ if (jaxbContext == null)
+ return null;
+ BridgeContext bc = bridgeContext.get();
+ if (bc == null) {
+ bc = jaxbContext.createBridgeContext();
+ bc.setAttachmentMarshaller(new JAXWSAttachmentMarshaller(enableMtom));
+ bc.setAttachmentUnmarshaller(new JAXWSAttachmentUnmarshaller());
+ bridgeContext.set(bc);
+ }
+ return bc;
+ }
+
+ /**
+ * @return the <code>JAXBRIContext</code>
+ */
+ public JAXBRIContext getJAXBContext() {
+ return jaxbContext;
+ }
+
+ /**
+ * @return the known namespaces from JAXBRIContext
+ */
+ public List<String> getKnownNamespaceURIs() {
+ return knownNamespaceURIs;
+ }
+
+ /**
+ * @param type
+ * @return the <code>Bridge</code> for the <code>type</code>
+ */
+ public Bridge getBridge(TypeReference type) {
+ return bridgeMap.get(type);
+ }
+
+ /**
+ * @param name
+ * @return either a <code>RpcLitpayload</code> or a
<code>JAXBBridgeInfo</code> for
+ * an operation named <code>name</code>
+ */
+ public Object getDecoderInfo(QName name) {
+ Object obj = payloadMap.get(name);
+ if (obj instanceof RpcLitPayload) {
+ return RpcLitPayload.copy((RpcLitPayload) obj);
+ } else if (obj instanceof JAXBBridgeInfo) {
+ return JAXBBridgeInfo.copy((JAXBBridgeInfo) obj);
+ }
+ return null;
+ }
+
+ /**
+ * @param name
+ * @param payload
+ */
+ public void addDecoderInfo(QName name, Object payload) {
+ payloadMap.put(name, payload);
+ }
+
+ /**
+ * @return
+ */
+ private JAXBRIContext createJAXBContext() {
+ final List<TypeReference> types = getAllTypeReferences();
+ final Class[] cls = new Class[types.size()];
+ final String ns = targetNamespace;
+ int i = 0;
+ for (TypeReference type : types) {
+ cls[i++] = (Class) type.type;
+ }
+ try {
+ //jaxbContext = JAXBRIContext.newInstance(cls, types, targetNamespace,
false);
+ // Need to avoid doPriv block once JAXB is fixed. Afterwards, use the above
+ jaxbContext = (JAXBRIContext)
+ AccessController.doPrivileged(new PrivilegedExceptionAction() {
+ public java.lang.Object run() throws Exception {
+ return JAXBRIContext.newInstance(cls, types, ns, false);
+ }
+ });
+ createBridgeMap(types);
+ } catch (PrivilegedActionException e) {
+ throw new WebServiceException(e.getMessage(), e.getException());
+ }
+ knownNamespaceURIs = new ArrayList<String>();
+ for (String namespace : jaxbContext.getKnownNamespaceURIs()) {
+ if (namespace.length() > 0) {
+ if (!namespace.equals(SOAPNamespaceConstants.XSD) &&
!namespace.equals(SOAPNamespaceConstants.XMLNS))
+ knownNamespaceURIs.add(namespace);
+ }
+ }
+
+ return jaxbContext;
+ }
+
+ /**
+ * @return returns non-null list of TypeReference
+ */
+ public List<TypeReference> getAllTypeReferences() {
+ List<TypeReference> types = new ArrayList<TypeReference>();
+ Collection<JavaMethod> methods = methodToJM.values();
+ for (JavaMethod m : methods) {
+ fillTypes(m, types);
+ fillFaultDetailTypes(m, types);
+ }
+ return types;
+ }
+
+ private void fillFaultDetailTypes(JavaMethod m, List<TypeReference> types) {
+ for (CheckedException ce : m.getCheckedExceptions()) {
+ types.add(ce.getDetailType());
+// addGlobalType(ce.getDetailType());
+ }
+ }
+
+ protected void fillTypes(JavaMethod m, List<TypeReference> types) {
+ addTypes(m.getRequestParameters(), types);
+ addTypes(m.getResponseParameters(), types);
+ }
+
+ private void addTypes(List<Parameter> params, List<TypeReference> types)
{
+ for (Parameter p : params) {
+ types.add(p.getTypeReference());
+ }
+ }
+
+ private void createBridgeMap(List<TypeReference> types) {
+ for (TypeReference type : types) {
+ Bridge bridge = jaxbContext.createBridge(type);
+ bridgeMap.put(type, bridge);
+ }
+ }
+
+ /**
+ * @param qname
+ * @return the <code>Method</code> for a given Operation
<code>qname</code>
+ */
+ public Method getDispatchMethod(QName qname) {
+ //handle the empty body
+ if (qname == null)
+ qname = emptyBodyName;
+ JavaMethod jm = getJavaMethod(qname);
+ if (jm != null) {
+ return jm.getMethod();
+ }
+ return null;
+ }
+
+ /**
+ * @param name
+ * @param method
+ * @return true if <code>name</code> is the name
+ * of a known fault name for the <code>Method method</code>
+ */
+ public boolean isKnownFault(QName name, Method method) {
+ JavaMethod m = getJavaMethod(method);
+ for (CheckedException ce : m.getCheckedExceptions()) {
+ if (ce.getDetailType().tagName.equals(name))
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @param m
+ * @param ex
+ * @return true if <code>ex</code> is a Checked Exception
+ * for <code>Method m</code>
+ */
+ public boolean isCheckedException(Method m, Class ex) {
+ JavaMethod jm = getJavaMethod(m);
+ for (CheckedException ce : jm.getCheckedExceptions()) {
+ if (ce.getExcpetionClass().equals(ex))
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @param method
+ * @return the <code>JavaMethod</code> representing the
<code>method</code>
+ */
+ public JavaMethod getJavaMethod(Method method) {
+ return methodToJM.get(method);
+ }
+
+ /**
+ * @param name
+ * @return the <code>JavaMethod</code> associated with the
+ * operation named name
+ */
+ public JavaMethod getJavaMethod(QName name) {
+ return nameToJM.get(name);
+ }
+
+ /**
+ * @param jm
+ * @return the <code>QName</code> associated with the
+ * JavaMethod jm
+ */
+ public QName getQNameForJM(JavaMethod jm) {
+ Set<QName> set = nameToJM.keySet();
+ Iterator iter = set.iterator();
+ while (iter.hasNext()){
+ QName key = (QName) iter.next();
+ JavaMethod jmethod = (JavaMethod) nameToJM.get(key);
+ if (jmethod.getOperationName().equals(jm.getOperationName())){
+ return key;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @return a <code>Collection</code> of
<code>JavaMethods</code>
+ * associated with this <code>RuntimeModel</code>
+ */
+ public Collection<JavaMethod> getJavaMethods() {
+ return Collections.unmodifiableList(javaMethods);
+ }
+
+ public void addJavaMethod(JavaMethod jm) {
+ if (jm != null)
+ javaMethods.add(jm);
+ }
+
+ public void applyParameterBinding(Binding wsdlBinding){
+ if(wsdlBinding == null)
+ return;
+ wsdlBinding.finalizeBinding();
+ for(JavaMethod method : javaMethods){
+ if(method.isAsync())
+ continue;
+ boolean isRpclit = ((SOAPBinding)method.getBinding()).isRpcLit();
+ List<Parameter> reqParams = method.getRequestParameters();
+ List<Parameter> reqAttachParams = null;
+ for(Parameter param:reqParams){
+ if(param.isWrapperStyle()){
+ if(isRpclit){
+ WrapperParameter reqParam = (WrapperParameter)param;
+ BindingOperation bo =
wsdlBinding.get(method.getOperationName());
+ if(bo != null && bo.getRequestNamespace() != null){
+ patchRpclitNamespace(bo.getRequestNamespace(), reqParam);
+ }
+ reqAttachParams = applyRpcLitParamBinding(method, reqParam,
wsdlBinding, Mode.IN);
+ }
+ continue;
+ }
+ String partName = param.getPartName();
+ if(partName == null)
+ continue;
+ ParameterBinding paramBinding =
wsdlBinding.getBinding(method.getOperationName(),
+ partName, Mode.IN);
+ if(paramBinding != null)
+ param.setInBinding(paramBinding);
+ }
+
+ List<Parameter> resAttachParams = null;
+ List<Parameter> resParams = method.getResponseParameters();
+ for(Parameter param:resParams){
+ if(param.isWrapperStyle()){
+ if(isRpclit){
+ WrapperParameter respParam = (WrapperParameter)param;
+ BindingOperation bo =
wsdlBinding.get(method.getOperationName());
+ if(bo != null && bo.getResponseNamespace() != null){
+ patchRpclitNamespace(bo.getResponseNamespace(), respParam);
+ }
+ resAttachParams = applyRpcLitParamBinding(method, respParam,
wsdlBinding, Mode.OUT);
+ }
+ continue;
+ }
+ //if the parameter is not inout and its header=true then dont get binding
from WSDL
+// if(!param.isINOUT() && param.getBinding().isHeader())
+// continue;
+ String partName = param.getPartName();
+ if(partName == null)
+ continue;
+ ParameterBinding paramBinding =
wsdlBinding.getBinding(method.getOperationName(),
+ partName, Mode.OUT);
+ if(paramBinding != null)
+ param.setOutBinding(paramBinding);
+ }
+ if(reqAttachParams != null){
+ for(Parameter p : reqAttachParams){
+ method.addRequestParameter(p);
+ }
+ }
+ if(resAttachParams != null){
+ for(Parameter p : resAttachParams){
+ method.addResponseParameter(p);
+ }
+ }
+
+ }
+ }
+
+ /**
+ * For rpclit wrapper element inside <soapenv:Body>, the targetNamespace should
be taked from
+ * the soapbind:body@namespace value. Since no annotations on SEI/impl class captures
it so we
+ * need to get it from WSDL and patch it. *
+ */
+ private void patchRpclitNamespace(String namespace, WrapperParameter param){
+ TypeReference type = param.getTypeReference();
+ TypeReference newType = new TypeReference(
+ new QName(namespace, type.tagName.getLocalPart()), type.type,
type.annotations);
+
+ param.setTypeReference(newType);
+ }
+
+
+
+ /**
+ * Applies binding related information to the RpcLitPayload. The payload map is
populated correctly.
+ * @param method
+ * @param wrapperParameter
+ * @param wsdlBinding
+ * @param mode
+ * @return
+ *
+ * Returns attachment parameters if/any.
+ */
+ private List<Parameter> applyRpcLitParamBinding(JavaMethod method,
WrapperParameter wrapperParameter, Binding wsdlBinding, Mode mode) {
+ String opName = method.getOperationName();
+ RpcLitPayload payload = new RpcLitPayload(wrapperParameter.getName());
+ BindingOperation bo = wsdlBinding.get(opName);
+
+ Map<Integer, Parameter> bodyParams = new HashMap<Integer,
Parameter>();
+ List<Parameter> unboundParams = new ArrayList<Parameter>();
+ List<Parameter> attachParams = new ArrayList<Parameter>();
+ for(Parameter param:wrapperParameter.getWrapperChildren()){
+ String partName = param.getPartName();
+ if(partName == null)
+ continue;
+
+ ParameterBinding paramBinding = wsdlBinding.getBinding(opName,
+ partName, mode);
+ if(paramBinding != null){
+ if(mode == Mode.IN)
+ param.setInBinding(paramBinding);
+ else if(mode == Mode.OUT)
+ param.setOutBinding(paramBinding);
+
+ if(paramBinding.isUnbound()){
+ unboundParams.add(param);
+ } else if(paramBinding.isAttachment()){
+ attachParams.add(param);
+ }else if(paramBinding.isBody()){
+ if(bo != null){
+ Part p = bo.getPart(param.getPartName(), mode);
+ if(p != null)
+ bodyParams.put(p.getIndex(), param);
+ else
+ bodyParams.put(bodyParams.size(), param);
+ }else{
+ bodyParams.put(bodyParams.size(), param);
+ }
+ }
+ }
+
+ }
+ wrapperParameter.clear();
+ for(int i = 0; i < bodyParams.size();i++){
+ Parameter p = bodyParams.get(i);
+ wrapperParameter.addWrapperChild(p);
+ if(((mode == Mode.IN) && p.getInBinding().isBody())||
+ ((mode == Mode.OUT) && p.getOutBinding().isBody())){
+ JAXBBridgeInfo bi = new JAXBBridgeInfo(getBridge(p.getTypeReference()),
null);
+ payload.addParameter(bi);
+ }
+ }
+
+ for(Parameter p : attachParams){
+ JAXBBridgeInfo bi = new JAXBBridgeInfo(getBridge(p.getTypeReference()),
null);
+ payloadMap.put(p.getName(), bi);
+ }
+
+ //add unbounded parts
+ for(Parameter p:unboundParams){
+ wrapperParameter.addWrapperChild(p);
+ }
+ payloadMap.put(wrapperParameter.getName(), payload);
+ return attachParams;
+ }
+
+
+ /**
+ * @param name
+ * @param jm
+ */
+ protected void put(QName name, JavaMethod jm) {
+ nameToJM.put(name, jm);
+ }
+
+ /**
+ * @param method
+ * @param jm
+ */
+ protected void put(Method method, JavaMethod jm) {
+ methodToJM.put(method, jm);
+ }
+
+ public String getWSDLLocation() {
+ return wsdlLocation;
+ }
+
+ public void setWSDLLocation(String location) {
+ wsdlLocation = location;
+ }
+
+ public QName getServiceQName() {
+ return serviceName;
+ }
+
+ public QName getPortName() {
+ return portName;
+ }
+
+ public QName getPortTypeName() {
+ return portTypeName;
+ }
+
+ public void setServiceQName(QName name) {
+ serviceName = name;
+ }
+
+ public void setPortName(QName name) {
+ portName = name;
+ }
+
+ public void setPortTypeName(QName name) {
+ portTypeName = name;
+ }
+
+ /**
+ * This is the targetNamespace for the WSDL containing the PortType
+ * definition
+ */
+ public void setTargetNamespace(String namespace) {
+ targetNamespace = namespace;
+ }
+
+ /**
+ * This is the targetNamespace for the WSDL containing the PortType
+ * definition
+ */
+ public String getTargetNamespace() {
+ return targetNamespace;
+ }
+
+ /**
+ * Add a global type. Global types will be used to generate global
+ * elements in the generated schema's
+ * @param typeReference
+ */
+/* public void addGlobalType(TypeReference typeReference) {
+
+ }*/
+
+ /**
+ * Add a global type. Global types will be used to generate global
+ * elements in the generated schema's
+ * @return
+ */
+/* public Collection<TypeReference> getGlobalTypes() {
+ return globalTypes;
+ }*/
+
+
+ /**
+ * Mtom processing is disabled by default. To enable it the RuntimeModel creator must
call it to enable it.
+ * @param enableMtom
+ */
+ public void enableMtom(boolean enableMtom){
+ this.enableMtom = enableMtom;
+ }
+
+ public Map<Integer, RawAccessor> getRawAccessorMap() {
+ return rawAccessorMap;
+ }
+
+ protected abstract void createDecoderInfo();
+
+ private boolean enableMtom = false;
+ private ThreadLocal<BridgeContext> bridgeContext = new
ThreadLocal<BridgeContext>();
+ protected JAXBRIContext jaxbContext;
+ private String wsdlLocation;
+ private QName serviceName;
+ private QName portName;
+ private QName portTypeName;
+ private Map<Method, JavaMethod> methodToJM = new HashMap<Method,
JavaMethod>();
+ private Map<QName, JavaMethod> nameToJM = new HashMap<QName,
JavaMethod>();
+ private List<JavaMethod> javaMethods = new ArrayList<JavaMethod>();
+ private final Map<TypeReference, Bridge> bridgeMap = new
HashMap<TypeReference, Bridge>();
+ private final Map<QName, Object> payloadMap = new HashMap<QName,
Object>();
+ protected final QName emptyBodyName = new QName("");
+ private String targetNamespace = "";
+ private final Map<Integer, RawAccessor> rawAccessorMap = new
HashMap<Integer, RawAccessor>();
+ private List<String> knownNamespaceURIs = null;
+// protected Collection<TypeReference> globalTypes = new
ArrayList<TypeReference>();
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/RuntimeModel.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/WrapperParameter.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/WrapperParameter.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/WrapperParameter.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,85 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.model;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import com.sun.xml.bind.api.TypeReference;
+
+/**
+ * Models Wrapper parameter
+ *
+ * @author Vivek Pandey
+ */
+public class WrapperParameter extends Parameter{
+ public WrapperParameter(TypeReference type, Mode mode, int index) {
+ super(type, mode, index);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.com.sun.xml.ws.rt.model.Parameter#isWrapperStyle()
+ */
+ @Override
+ public boolean isWrapperStyle() {
+ return true;
+ }
+
+ /**
+ * @return Returns the wrapperChildren.
+ */
+ public List<Parameter> getWrapperChildren() {
+ return Collections.unmodifiableList(wrapperChildren);
+ }
+
+ /**
+ * @param wrapperChildren
+ * The wrapperChildren to set.
+ */
+ public void addWrapperChildren(List<Parameter> wrapperChildren) {
+ this.wrapperChildren.addAll(wrapperChildren);
+ }
+
+ /**
+ * @param wrapperChild
+ */
+ public void addWrapperChild(Parameter wrapperChild) {
+ wrapperChildren.add(wrapperChild);
+ }
+
+ /**
+ * removes the wrapper child from the given index
+ * @param index
+ * @return
+ */
+ public Parameter removeWrapperChild(int index){
+ return wrapperChildren.remove(index);
+ }
+
+ public void clear(){
+ wrapperChildren.clear();
+ }
+ protected final List<Parameter> wrapperChildren = new
ArrayList<Parameter>();
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/WrapperParameter.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/soap/SOAPBinding.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/soap/SOAPBinding.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/soap/SOAPBinding.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,127 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.model.soap;
+
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPVersion;
+
+/**
+ * Binding object that represents soap:binding
+ *
+ * @author Vivek Pandey
+ */
+public class SOAPBinding {
+ public SOAPBinding() {
+ }
+
+ public SOAPBinding(SOAPBinding sb){
+ this.use = sb.use;
+ this.style = sb.style;
+ this.soapVersion = sb.soapVersion;
+ this.soapAction = sb.soapAction;
+ }
+
+ /**
+ * @return Returns the use.
+ */
+ public Use getUse() {
+ return use;
+ }
+
+ /**
+ * @param use
+ * The use to set.
+ */
+ public void setUse(Use use) {
+ this.use = use;
+ }
+
+ /**
+ * @return Returns the style.
+ */
+ public Style getStyle() {
+ return style;
+ }
+
+ /**
+ * @param style
+ * The style to set.
+ */
+ public void setStyle(Style style) {
+ this.style = style;
+ }
+
+ /**
+ * @param version
+ */
+ public void setSOAPVersion(SOAPVersion version) {
+ this.soapVersion = version;
+ }
+
+ /**
+ * @return the SOAPVersion of this SOAPBinding
+ */
+ public SOAPVersion getSOAPVersion() {
+ return soapVersion;
+ }
+
+ /**
+ * @return true if this is a document/literal SOAPBinding
+ */
+ public boolean isDocLit() {
+ return style.equals(Style.DOCUMENT) && use.equals(Use.LITERAL);
+ }
+
+ /**
+ * @return true if this is a rpc/literal SOAPBinding
+ */
+ public boolean isRpcLit() {
+ return style.equals(Style.RPC) && use.equals(Use.LITERAL);
+ }
+
+ /**
+ * @return the soapAction header value. It's always non-null. soap
+ * message serializer needs to generated SOAPAction HTTP header with
+ * the return of this method enclosed in quotes("").
+ */
+ public String getSOAPAction() {
+ if (soapAction == null)
+ return "";
+ return soapAction;
+ }
+
+ /**
+ * @param soapAction
+ * The soapAction to set.
+ */
+ public void setSOAPAction(String soapAction) {
+ this.soapAction = soapAction;
+ }
+
+ private Style style = Style.DOCUMENT;
+
+ private Use use = Use.LITERAL;
+
+ private SOAPVersion soapVersion = SOAPVersion.SOAP_11;
+
+ private String soapAction;
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/soap/SOAPBinding.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/soap/SOAPRuntimeModel.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/soap/SOAPRuntimeModel.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/soap/SOAPRuntimeModel.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,406 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.model.soap;
+
+import com.sun.xml.bind.api.RawAccessor;
+import com.sun.xml.bind.api.TypeReference;
+import org.jboss.com.sun.xml.messaging.saaj.soap.SOAPVersionMismatchException;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.soap.SOAPFaultException;
+import javax.xml.soap.SOAPFault;
+
+import org.jboss.com.sun.xml.ws.encoding.jaxb.JAXBBridgeInfo;
+import org.jboss.com.sun.xml.ws.encoding.jaxb.RpcLitPayload;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPConstants;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.BodyBlock;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.HeaderBlock;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.InternalMessage;
+import org.jboss.com.sun.xml.ws.encoding.soap.message.*;
+import org.jboss.com.sun.xml.ws.model.*;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.server.ServerRtException;
+import org.jboss.com.sun.xml.ws.util.MessageInfoUtil;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Set;
+
+/**
+ * Creates SOAP specific RuntimeModel
+ *
+ * @author Vivek Pandey
+ */
+public class SOAPRuntimeModel extends RuntimeModel {
+
+ protected void createDecoderInfo() {
+ Collection<JavaMethod> methods = getJavaMethods();
+ for (JavaMethod m : methods) {
+ if(m.isAsync())
+ continue;
+ SOAPBinding binding = (SOAPBinding) m.getBinding();
+ setDecoderInfo(m.getRequestParameters(), binding, Mode.IN);
+ setDecoderInfo(m.getResponseParameters(), binding, Mode.OUT);
+ for(CheckedException ce:m.getCheckedExceptions()){
+ JAXBBridgeInfo bi = new JAXBBridgeInfo(getBridge(ce.getDetailType()));
+ addDecoderInfo(ce.getDetailType().tagName, bi);
+ }
+ }
+
+ }
+
+ private void setDecoderInfo(List<Parameter> params, SOAPBinding binding, Mode
mode){
+ for (Parameter param : params) {
+ ParameterBinding paramBinding = (mode ==
Mode.IN)?param.getInBinding():param.getOutBinding();
+ if (paramBinding.isBody() && binding.isRpcLit()) {
+ RpcLitPayload payload = new RpcLitPayload(param.getName());
+ WrapperParameter wp = (WrapperParameter) param;
+ for (Parameter p : wp.getWrapperChildren()) {
+ if(p.getBinding().isUnbound())
+ continue;
+ JAXBBridgeInfo bi = new
JAXBBridgeInfo(getBridge(p.getTypeReference()),
+ null);
+ payload.addParameter(bi);
+ }
+ addDecoderInfo(param.getName(), payload);
+ } else {
+ JAXBBridgeInfo bi = new
JAXBBridgeInfo(getBridge(param.getTypeReference()),
+ null);
+ addDecoderInfo(param.getName(), bi);
+ }
+ }
+ }
+
+ /*
+ * @see RuntimeModel#populateMaps()
+ */
+ @Override
+ protected void populateMaps() {
+ int emptyBodyCount = 0;
+ for(JavaMethod jm:getJavaMethods()){
+ put(jm.getMethod(), jm);
+ boolean bodyFound = false;
+ for(Parameter p:jm.getRequestParameters()){
+ ParameterBinding binding = p.getBinding();
+ if(binding.isBody()){
+ put(p.getName(), jm);
+ bodyFound = true;
+ }
+ }
+ if(!bodyFound){
+ put(emptyBodyName, jm);
+// System.out.println("added empty body for:
"+jm.getMethod().getName());
+ emptyBodyCount++;
+ }
+ }
+ if(emptyBodyCount > 1){
+ //TODO throw exception
+// System.out.println("Error: Unqiue signature violation - more than 1
empty body!");
+ }
+ }
+
+
+ /*
+ * @see RuntimeModel#fillTypes(JavaMethod, List)
+ */
+ @Override
+ protected void fillTypes(JavaMethod m, List<TypeReference> types) {
+ if(!(m.getBinding() instanceof SOAPBinding)){
+ //TODO throws exception
+ System.out.println("Error: Wrong Binding!");
+ return;
+ }
+ if(((SOAPBinding)m.getBinding()).isDocLit()){
+ super.fillTypes(m, types);
+ return;
+ }
+
+ //else is rpclit
+ addTypes(m.getRequestParameters(), types, Mode.IN);
+ addTypes(m.getResponseParameters(), types, Mode.OUT);
+ }
+
+ /**
+ * @param params
+ * @param types
+ * @param mode
+ */
+ private void addTypes(List<Parameter> params, List<TypeReference> types,
Mode mode) {
+ for(Parameter p:params){
+ ParameterBinding binding = (mode ==
Mode.IN)?p.getInBinding():p.getOutBinding();
+ if(!p.isWrapperStyle()){
+ types.add(p.getTypeReference());
+ }else if(binding.isBody()){
+ List<Parameter> wcParams =
((WrapperParameter)p).getWrapperChildren();
+ for(Parameter wc:wcParams){
+ types.add(wc.getTypeReference());
+ }
+ }
+ }
+ }
+
+
+ public Set<QName> getKnownHeaders() {
+ Set<QName> headers = new HashSet<QName>();
+ Iterator<JavaMethod> methods = getJavaMethods().iterator();
+ while (methods.hasNext()) {
+ JavaMethod method = methods.next();
+ // fill in request headers
+ Iterator<Parameter> params = method.getRequestParameters().iterator();
+ fillHeaders(params, headers, Mode.IN);
+
+ // fill in response headers
+ params = method.getResponseParameters().iterator();
+ fillHeaders(params, headers, Mode.OUT);
+ }
+ return headers;
+ }
+
+ /**
+ * @param params
+ * @param headers
+ */
+ private void fillHeaders(Iterator<Parameter> params, Set<QName> headers,
Mode mode) {
+ while (params.hasNext()) {
+ Parameter param = params.next();
+ ParameterBinding binding = (mode ==
Mode.IN)?param.getInBinding():param.getOutBinding();
+ QName name = param.getName();
+ if (binding.isHeader() && !headers.contains(name)) {
+ headers.add(name);
+ }
+ }
+ }
+
+ /**
+ * Called by server
+ *
+ * @param obj
+ * @param actor
+ * @param detail
+ * @param internalMsg
+ * @return the InternalMessage for a fault
+ */
+ public static InternalMessage createFaultInBody(Object obj, String actor,
+ Object detail, InternalMessage internalMsg) {
+ SOAPFaultInfo faultInfo;
+ if (obj instanceof SOAPFaultInfo) {
+ faultInfo = (SOAPFaultInfo)obj;
+ } else if (obj instanceof ServerRtException) {
+ Throwable cause = ((ServerRtException)obj).getCause();
+ Throwable th = (cause == null) ? (ServerRtException)obj : cause;
+ faultInfo = createSOAPFaultInfo(th, actor, detail);
+
+ } else if (obj instanceof SOAPFaultException) {
+ SOAPFaultException e = (SOAPFaultException)obj;
+ faultInfo = new SOAPFaultInfo(e.getFault());
+ } else if (obj instanceof SOAPVersionMismatchException) {
+ QName faultCode = SOAPConstants.FAULT_CODE_VERSION_MISMATCH;
+ String faultString = "SOAP envelope version mismatch";
+ faultInfo =
+ new SOAPFaultInfo(faultString, faultCode, actor, null,
javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING);
+ } else if (obj instanceof Exception) {
+ faultInfo = createSOAPFaultInfo((Exception)obj, actor, detail);
+ } else {
+ QName faultCode = SOAPConstants.FAULT_CODE_SERVER;
+ String faultString = "Unknown fault type:"+obj.getClass();
+ faultInfo =
+ new SOAPFaultInfo(faultString, faultCode, actor,
null,javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING);
+ }
+
+ if (internalMsg == null) {
+ internalMsg = new InternalMessage();
+ }
+
+ BodyBlock bodyBlock = internalMsg.getBody();
+ if (bodyBlock == null) {
+ bodyBlock = new BodyBlock(faultInfo);
+ internalMsg.setBody(bodyBlock);
+ } else {
+ bodyBlock.setFaultInfo(faultInfo);
+ }
+
+ return internalMsg;
+ }
+
+ public static InternalMessage createSOAP12FaultInBody(Object obj, String role, String
node, Object detail, InternalMessage im) {
+ SOAP12FaultInfo faultInfo;
+ if (obj instanceof SOAP12FaultInfo) {
+ faultInfo = (SOAP12FaultInfo)obj;
+ } else if (obj instanceof ServerRtException) {
+ Throwable cause = ((ServerRtException)obj).getCause();
+ Throwable th = (cause == null) ? (ServerRtException)obj : cause;
+ faultInfo = createSOAP12FaultInfo(th, role, node, detail);
+
+ } else if (obj instanceof SOAPFaultException) {
+ SOAPFaultException e = (SOAPFaultException)obj;
+ faultInfo = new SOAP12FaultInfo(e.getFault());
+ } else if (obj instanceof SOAPVersionMismatchException) {
+ String faultString = "SOAP envelope version mismatch";
+ FaultCode code = new FaultCode(FaultCodeEnum.VersionMismatch, (FaultSubcode)
null);
+ FaultReason reason = new FaultReason(new FaultReasonText(faultString,
Locale.getDefault()));
+ faultInfo = new SOAP12FaultInfo(code, reason, null, null, null);
+ } else if (obj instanceof Exception) {
+ faultInfo = createSOAP12FaultInfo((Exception)obj, role, node, detail);
+ } else {
+ String faultString = "Unknown fault type:"+obj.getClass();
+ FaultCode code = new FaultCode(FaultCodeEnum.Receiver, (FaultSubcode) null);
+ FaultReason reason = new FaultReason(new FaultReasonText(faultString,
Locale.getDefault()));
+ faultInfo = new SOAP12FaultInfo(code, reason, null, null, null);
+ }
+ if (im == null) {
+ im = new InternalMessage();
+ }
+ BodyBlock bodyBlock = im.getBody();
+ if (bodyBlock == null) {
+ bodyBlock = new BodyBlock(faultInfo);
+ im.setBody(bodyBlock);
+ } else {
+ bodyBlock.setValue(faultInfo);
+ }
+ return im;
+ }
+
+ // currently adds not understood header blocks if there are any
+ public static void addHeaders(InternalMessage message, MessageInfo mi) {
+ Set<HeaderBlock> notUnderstoodHeaders =
+ MessageInfoUtil.getNotUnderstoodHeaders(mi);
+ if (notUnderstoodHeaders != null) {
+ for (HeaderBlock block : notUnderstoodHeaders) {
+ message.addHeader(block);
+ }
+ }
+ }
+
+ private static SOAP12FaultInfo createSOAP12FaultInfo(Throwable e, String role, String
node, Object detail) {
+ SOAPFaultException soapFaultException = null;
+ FaultCode code = null;
+ FaultReason reason = null;
+ String faultRole = null;
+ String faultNode = null;
+ Throwable cause = e.getCause();
+ if (e instanceof SOAPFaultException) {
+ soapFaultException = (SOAPFaultException)e;
+ } else if (cause != null && cause instanceof SOAPFaultException) {
+ soapFaultException = (SOAPFaultException)e.getCause();
+ }
+ if (soapFaultException != null) {
+ SOAPFault soapFault = soapFaultException.getFault();
+ code = new FaultCode(FaultCodeEnum.get(soapFault.getFaultCodeAsQName()),
(FaultSubcode) null);
+ reason = new FaultReason(new FaultReasonText(soapFault.getFaultString(),
+ soapFault.getFaultStringLocale()));
+ faultRole = soapFault.getFaultRole();
+ if(faultRole == null)
+ faultRole = role;
+ faultNode = soapFault.getFaultNode();
+ if(faultNode == null)
+ faultNode = node;
+ }
+
+ if (code == null || ((code != null) && code.getValue() == null)) {
+ code = new FaultCode(FaultCodeEnum.Receiver, (FaultSubcode) null);
+ }
+
+ if(reason == null){
+ String faultString = e.getMessage();
+ if (faultString == null) {
+ faultString = e.toString();
+ }
+
+ reason = new FaultReason(new FaultReasonText(faultString,
Locale.getDefault()));
+ }
+
+ if ((detail == null) && (soapFaultException != null)) {
+ detail = soapFaultException.getFault().getDetail();
+ }
+
+ return new SOAP12FaultInfo(code, reason, faultRole, faultNode, detail);
+ }
+
+ //TODO: createSOAP12HeaderFault()
+
+
+ /**
+ * @param obj
+ * @param actor
+ * @param detailBlock
+ * @param internalMsg
+ * @return the <code>InteralMessage</code> for a HeaderFault
+ */
+ public static InternalMessage createHeaderFault(Object obj, String actor,
JAXBBridgeInfo detailBlock, InternalMessage internalMsg){
+ //its headerfault so, create body fault with no detail. detail object goes as a
header block
+ internalMsg = createFaultInBody(obj, actor, null, internalMsg);
+ HeaderBlock hdrBlock = new HeaderBlock(detailBlock);
+ internalMsg.addHeader(hdrBlock);
+ return internalMsg;
+ }
+
+ /**
+ * @param e
+ * @param actor
+ * @param detail
+ * @return
+ */
+ private static SOAPFaultInfo createSOAPFaultInfo(Throwable e, String actor,
+ Object detail) {
+// e.printStackTrace();
+ SOAPFaultException soapFaultException = null;
+ QName faultCode = null;
+ String faultString = null;
+ String faultActor = null;
+ Throwable cause = e.getCause();
+ if (e instanceof SOAPFaultException) {
+ soapFaultException = (SOAPFaultException)e;
+ } else if (cause != null && cause instanceof SOAPFaultException) {
+ soapFaultException = (SOAPFaultException)e.getCause();
+ }
+ if (soapFaultException != null) {
+ faultCode = soapFaultException.getFault().getFaultCodeAsQName();
+ faultString = soapFaultException.getFault().getFaultString();
+ faultActor = soapFaultException.getFault().getFaultActor();
+ }
+
+ if (faultCode == null) {
+ faultCode = SOAPConstants.FAULT_CODE_SERVER;
+ }
+
+ if (faultString == null) {
+ faultString = e.getMessage();
+ if (faultString == null) {
+ faultString = e.toString();
+ }
+ }
+
+ if (faultActor == null) {
+ faultActor = actor;
+ }
+
+ if (detail == null && soapFaultException != null) {
+ detail = soapFaultException.getFault().getDetail();
+ }
+
+ return new SOAPFaultInfo(faultString, faultCode, faultActor, detail,
javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING);
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/soap/SOAPRuntimeModel.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/soap/Style.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/soap/Style.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/soap/Style.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,41 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.model.soap;
+
+/**
+ * @author Vivek Pandey
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public enum Style {
+ DOCUMENT(0), RPC(1);
+
+ private Style(int style){
+ this.style = style;
+ }
+
+ public int value() {
+ return style;
+ }
+ private final int style;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/soap/Style.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/soap/Use.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/soap/Use.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/soap/Use.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,39 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.model.soap;
+
+/**
+ * @author Vivek Pandey
+ *
+ */
+public enum Use {
+ LITERAL(0), ENCODED(1);
+
+ private Use(int use){
+ this.use = use;
+ }
+
+ public int value() {
+ return use;
+ }
+ private final int use;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/model/soap/Use.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/modeler/RuntimeModeler.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/modeler/RuntimeModeler.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/modeler/RuntimeModeler.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,1370 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.modeler;
+
+import com.sun.xml.bind.api.TypeReference;
+import com.sun.xml.bind.v2.model.nav.Navigator;
+
+import javax.jws.HandlerChain;
+import javax.jws.Oneway;
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.xml.namespace.QName;
+import javax.xml.ws.AsyncHandler;
+import javax.xml.ws.Holder;
+import javax.xml.ws.RequestWrapper;
+import javax.xml.ws.Response;
+import javax.xml.ws.ResponseWrapper;
+import javax.xml.ws.WebFault;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.rmi.RemoteException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.StringTokenizer;
+import java.util.concurrent.Future;
+import javax.xml.ws.BindingType;
+import javax.xml.ws.http.HTTPBinding;
+
+import org.jboss.com.sun.xml.ws.binding.soap.SOAPBindingImpl;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPVersion;
+import org.jboss.com.sun.xml.ws.model.CheckedException;
+import org.jboss.com.sun.xml.ws.model.ExceptionType;
+import org.jboss.com.sun.xml.ws.model.JavaMethod;
+import org.jboss.com.sun.xml.ws.model.Mode;
+import org.jboss.com.sun.xml.ws.model.Parameter;
+import org.jboss.com.sun.xml.ws.model.ParameterBinding;
+import org.jboss.com.sun.xml.ws.model.RuntimeModel;
+import org.jboss.com.sun.xml.ws.model.WrapperParameter;
+import org.jboss.com.sun.xml.ws.model.soap.SOAPRuntimeModel;
+import org.jboss.com.sun.xml.ws.model.soap.Style;
+import org.jboss.com.sun.xml.ws.pept.presentation.MessageStruct;
+import org.jboss.com.sun.xml.ws.wsdl.parser.BindingOperation;
+import org.jboss.com.sun.xml.ws.wsdl.parser.Part;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ * Creates a runtime model of a SEI (portClass).
+ *
+ * @author WS Developement Team
+ */
+public class RuntimeModeler {
+ private String bindingId;
+ private Class portClass;
+ private RuntimeModel runtimeModel;
+ private org.jboss.com.sun.xml.ws.model.soap.SOAPBinding defaultBinding;
+ private String packageName;
+ private String targetNamespace;
+ private boolean isWrapped = true;
+ private boolean usesWebMethod = false;
+ private ClassLoader classLoader = null;
+ private Object implementor;
+ private org.jboss.com.sun.xml.ws.wsdl.parser.Binding binding;
+ private QName serviceName;
+ private QName portName;
+ private Map<Class, Boolean> classUsesWebMethod = new HashMap<Class,
Boolean>();
+
+ /**
+ *
+ */
+ public static final String PD_JAXWS_PACKAGE_PD = ".jaxws.";
+ /**
+ *
+ */
+ public static final String JAXWS_PACKAGE_PD = "jaxws.";
+ public static final String RESPONSE = "Response";
+ public static final String RETURN = "return";
+ public static final String BEAN = "Bean";
+ public static final String SERVICE = "Service";
+ public static final String PORT = "Port";
+ public static final Class HOLDER_CLASS = Holder.class;
+ public static final Class REMOTE_EXCEPTION_CLASS = RemoteException.class;
+ public static final Class RPC_LIT_PAYLOAD_CLASS =
org.jboss.com.sun.xml.ws.encoding.jaxb.RpcLitPayload.class;
+
+ /**
+ * creates an instance of RunTimeModeler given a <code>portClass</code>
and <code>bindingId</code>
+ * @param portClass The SEI class to be modeled.
+ * @param serviceName The ServiceName to use instead of one calculated from the
implementation class
+ * @param bindingId The binding identifier to be used when modeling the
<code>portClass</code>.
+ */
+ public RuntimeModeler(Class portClass, QName serviceName, String bindingId) {
+ this.portClass = portClass;
+ this.serviceName = serviceName;
+ this.bindingId = bindingId;
+ }
+
+ /**
+ *
+ * creates an instance of RunTimeModeler given a <code>sei</code> and
<code>binding</code>
+ * @param sei The SEI class to be modeled.
+ * @param serviceName The ServiceName to use instead of one calculated from the
implementation class
+ * @param binding The Binding representing WSDL Binding for the given port to be used
when modeling the
+ * <code>sei</code>.
+ */
+ public RuntimeModeler(Class sei, QName serviceName,
org.jboss.com.sun.xml.ws.wsdl.parser.Binding binding){
+ this.portClass = sei;
+ this.serviceName = serviceName;
+ this.bindingId = binding.getBindingId();
+ this.binding = binding;
+ }
+
+ /**
+ * creates an instance of RunTimeModeler given a <code>portClass</code>
and <code>bindingId</code>
+ * implementor object's class may not be portClass, as it could be proxy to
+ * portClass webmethods.
+ *
+ * @param portClass The SEI class to be modeled.
+ * @param implementor The object on which service methods are invoked
+ * @param serviceName The ServiceName to use instead of one calculated from the
implementation class
+ * @param bindingId The binding identifier to be used when modeling the
<code>portClass</code>.
+ */
+ public RuntimeModeler(Class portClass, Object implementor, QName serviceName, String
bindingId) {
+ this(portClass, serviceName, bindingId);
+ this.implementor = implementor;
+ }
+
+ /**
+ * creates an instance of RunTimeModeler given a <code>sei</code> class
and <code>binding</code>
+ * implementor object's class may not be sei Class, as it could be proxy to
+ * sei webmethods.
+ *
+ * @param portClass The SEI class to be modeled.
+ * @param implementor The object on which service methods are invoked
+ * @param binding The Binding representing WSDL Binding for the given port to be used
when modeling the
+ * <code>sei</code>.
+ */
+ public RuntimeModeler(Class portClass, Object implementor, QName serviceName,
org.jboss.com.sun.xml.ws.wsdl.parser.Binding binding) {
+ this(portClass, serviceName, binding);
+ this.implementor = implementor;
+ }
+
+
+ /**
+ * sets the classloader to be used when loading classes by the
<code>RuntimeModeler</code>.
+ * @param classLoader ClassLoader used to load classes
+ */
+ public void setClassLoader(ClassLoader classLoader) {
+ this.classLoader = classLoader;
+ }
+
+ /**
+ * sets the PortName to be used by the <code>RuntimeModeler</code>.
+ * @param portName The PortName to be used instead of the PortName
+ * retrieved via annotations
+ */
+ public void setPortName(QName portName) {
+ this.portName = portName;
+ }
+
+ private static <T> T getPrivClassAnnotation(final Class clazz, final Class T)
{
+ return (T)AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ return clazz.getAnnotation(T);
+ }
+ });
+ }
+
+ private static <T> T getPrivMethodAnnotation(final Method method, final Class
T) {
+ return (T)AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ return method.getAnnotation(T);
+ }
+ });
+ }
+
+ private static Annotation[][] getPrivParameterAnnotations(final Method method) {
+ return (Annotation[][])AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ return method.getParameterAnnotations();
+ }
+ });
+ }
+
+ //currently has many local vars which will be eliminated after debugging issues
+ //first draft
+ /**
+ * builds the runtime model from the <code>portClass</code> using the
binding ID <code>bindingId</code>.
+ * @return the runtime model for the <code>portClass</code>.
+ */
+ public RuntimeModel buildRuntimeModel() {
+ runtimeModel = new SOAPRuntimeModel();
+ Class clazz = portClass;
+ WebService webService = getPrivClassAnnotation(portClass, WebService.class);
+ if (webService == null) {
+ throw new
RuntimeModelerException("runtime.modeler.no.webservice.annotation",
+ new Object[] {portClass.getCanonicalName()});
+ }
+ if (webService.endpointInterface().length() > 0) {
+ clazz = getClass(webService.endpointInterface());
+ WebService seiService = getPrivClassAnnotation(clazz, WebService.class);
+ if (seiService == null) {
+ throw new
RuntimeModelerException("runtime.modeler.endpoint.interface.no.webservice",
+ new Object[] {webService.endpointInterface()});
+ }
+ }
+ if (serviceName == null)
+ serviceName = getServiceName(portClass);
+ runtimeModel.setServiceQName(serviceName);
+
+ String portLocalName = portClass.getSimpleName()+PORT;
+ if (webService.portName().length() >0) {
+ portLocalName = webService.portName();
+ } else if (webService.name().length() >0) {
+ portLocalName = webService.name()+PORT;
+ }
+
+ if (portName == null)
+ portName = new QName(serviceName.getNamespaceURI(), portLocalName);
+
+ if (!portName.getNamespaceURI().equals(serviceName.getNamespaceURI())) {
+ throw new
RuntimeModelerException("runtime.modeler.portname.servicename.namespace.mismatch",
+ new Object[] {serviceName, portName});
+ }
+ runtimeModel.setPortName(portName);
+
+ processClass(clazz);
+ if (runtimeModel.getJavaMethods().size() == 0)
+ throw new RuntimeModelerException("runtime.modeler.no.operations",
+ new Object[] {portClass.getName().toString()});
+ runtimeModel.postProcess();
+ return runtimeModel;
+ }
+
+ /**
+ * utility method to load classes
+ * @param className the name of the class to load
+ * @return the class specified by <code>className</code>
+ */
+ protected Class getClass(String className) {
+ try {
+ if (classLoader == null)
+ return
Thread.currentThread().getContextClassLoader().loadClass(className);
+ else
+ return classLoader.loadClass(className);
+ } catch (ClassNotFoundException e) {
+ throw new
RuntimeModelerException("runtime.modeler.class.not.found",
+ new Object[] {className});
+ }
+ }
+
+ protected void setUsesWebMethod(Class clazz, Boolean usesWebMethod) {
+// System.out.println("class: "+clazz.getName()+" uses WebMethod:
"+usesWebMethod);
+ classUsesWebMethod.put(clazz, usesWebMethod);
+ }
+
+ protected void determineWebMethodUse(Class clazz) {
+ if (clazz == null)
+ return;
+ if (clazz.isInterface()) {
+ setUsesWebMethod(clazz, false);
+ }
+ else {
+ WebMethod webMethod;
+ boolean hasWebMethod = false;
+ for (Method method : clazz.getMethods()) {
+ if (!method.getDeclaringClass().equals(clazz))
+ continue;
+ webMethod = getPrivMethodAnnotation(method, WebMethod.class);
+ if (webMethod != null &&
+ !webMethod.exclude()) {
+ hasWebMethod = true;
+ break;
+ }
+ }
+ setUsesWebMethod(clazz, hasWebMethod);
+ }
+ determineWebMethodUse(clazz.getSuperclass());
+ }
+
+ void processClass(Class clazz) {
+ determineWebMethodUse(clazz);
+ WebService webService = getPrivClassAnnotation(clazz, WebService.class);
+ String portTypeLocalName = clazz.getSimpleName();
+ if (webService.name().length() >0)
+ portTypeLocalName = webService.name();
+
+
+ targetNamespace = webService.targetNamespace();
+ packageName = null;
+ if (clazz.getPackage() != null)
+ packageName = clazz.getPackage().getName();
+ if (targetNamespace.length() == 0) {
+ targetNamespace = getNamespace(packageName);
+ }
+ runtimeModel.setTargetNamespace(targetNamespace);
+ QName portTypeName = new QName(targetNamespace, portTypeLocalName);
+ runtimeModel.setPortTypeName(portTypeName);
+ runtimeModel.setWSDLLocation(webService.wsdlLocation());
+
+ javax.jws.soap.SOAPBinding soapBinding = getPrivClassAnnotation(clazz,
javax.jws.soap.SOAPBinding.class);
+ if (soapBinding != null) {
+ isWrapped = soapBinding.parameterStyle().equals(
+ javax.jws.soap.SOAPBinding.ParameterStyle.WRAPPED);
+ }
+ defaultBinding = createBinding(soapBinding);
+ /*
+ * if clazz != portClass then there is an SEI. If there is an
+ * SEI, then all methods should be processed. However, if there is
+ * no SEI, and the implementation class uses at least one
+ * WebMethod annotation, then only methods with this annotation
+ * will be processed.
+ */
+/* if (clazz == portClass) {
+ WebMethod webMethod;
+ for (Method method : clazz.getMethods()) {
+ webMethod = getPrivMethodAnnotation(method, WebMethod.class);
+ if (webMethod != null &&
+ !webMethod.exclude()) {
+ usesWebMethod = true;
+ break;
+ }
+ }
+ }*/
+
+ for (Method method : clazz.getMethods()) {
+ if (method.getDeclaringClass().equals(Object.class) ||
+ !isWebMethod(method, clazz)) {
+ continue;
+ }
+ processMethod(method, webService);
+ }
+ }
+
+ protected boolean isWebMethod(Method method, Class clazz) {
+ if (clazz.isInterface()) {
+ return true;
+ }
+ Class declClass = method.getDeclaringClass();
+ boolean declHasWebService = getPrivClassAnnotation(declClass, WebService.class)
!= null;
+ WebMethod webMethod = getPrivMethodAnnotation(method, WebMethod.class);
+ if (webMethod != null &&
+ webMethod.exclude() == false &&
+ declHasWebService) {
+ return true;
+ }
+ if (declHasWebService &&
+ !classUsesWebMethod.get(declClass)) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * creates a runtime model <code>SOAPBinding</code> from a
<code>javax.jws.soap.SOAPBinding</code> object
+ * @param soapBinding the <code>javax.jws.soap.SOAPBinding</code> to
model
+ * @return returns the runtime model SOAPBinding corresponding to
<code>soapBinding</code>
+ */
+ protected org.jboss.com.sun.xml.ws.model.soap.SOAPBinding
createBinding(javax.jws.soap.SOAPBinding soapBinding) {
+ org.jboss.com.sun.xml.ws.model.soap.SOAPBinding rtSOAPBinding =
+ new org.jboss.com.sun.xml.ws.model.soap.SOAPBinding();
+ Style style = (soapBinding == null ||
+ soapBinding.style().equals(javax.jws.soap.SOAPBinding.Style.DOCUMENT)) ?
+ Style.DOCUMENT : Style.RPC;
+ rtSOAPBinding.setStyle(style);
+ //default soap version is 1.1, change it to soap 1.2 if the binding id says so
+ if(SOAPVersion.SOAP_12.equals(bindingId))
+ rtSOAPBinding.setSOAPVersion(SOAPVersion.SOAP_12);
+ return rtSOAPBinding;
+ }
+
+ /**
+ * gets the namespace <code>String</code> for a given
<code>packageName</code>
+ * @param packageName the name of the package used to find a namespace
+ * @return the namespace for the specified <code>packageName</code>
+ */
+ public static String getNamespace(String packageName) {
+ if (packageName == null || packageName.length() == 0)
+ return null;
+
+ StringTokenizer tokenizer = new StringTokenizer(packageName, ".");
+ String[] tokens;
+ if (tokenizer.countTokens() == 0) {
+ tokens = new String[0];
+ } else {
+ tokens = new String[tokenizer.countTokens()];
+ for (int i=tokenizer.countTokens()-1; i >= 0; i--) {
+ tokens[i] = tokenizer.nextToken();
+ }
+ }
+ StringBuffer namespace = new StringBuffer("http://");
+ String dot = "";
+ for (int i=0; i<tokens.length; i++) {
+ if (i==1)
+ dot = ".";
+ namespace.append(dot+tokens[i]);
+ }
+ namespace.append('/');
+ return namespace.toString();
+ }
+
+ /**
+ * creates the runtime model for a method on the <code>portClass</code>
+ * @param method the method to model
+ * @param webService the instance of the <code>WebService</code>
annotation on the <code>portClass</code>
+ */
+ protected void processMethod(Method method, WebService webService) {
+ if (!Modifier.isPublic(method.getModifiers())) {
+ return;
+ }
+
+ WebMethod webMethod = getPrivMethodAnnotation(method, WebMethod.class);
+ if (webMethod != null && webMethod.exclude())
+ return;
+
+ // If one WebMethod is used, then only methods with WebMethod will be
+ // processed.
+ if (usesWebMethod && webMethod == null) {
+ return;
+ }
+
+ // Use implementor to find the exact invocation method as implementor
+ // could be a proxy to portClass object
+ JavaMethod javaMethod;
+ Class implementorClass = (implementor != null)
+ ? implementor.getClass() : portClass;
+ if (method.getDeclaringClass().equals(implementorClass)) {
+ javaMethod = new JavaMethod(method);
+ } else {
+ try {
+ Method tmpMethod = implementorClass.getMethod(method.getName(),
+ method.getParameterTypes());
+ javaMethod = new JavaMethod(tmpMethod);
+ } catch (NoSuchMethodException e) {
+ throw new
RuntimeModelerException("runtime.modeler.method.not.found",
+ new Object[] {method.getName(), portClass.getName()});
+ }
+ }
+ String methodName = method.getName();
+ int modifier = method.getModifiers();
+ //use for checking
+
+ //set MEP -oneway, async, req/resp
+ int mep = getMEP(method);
+ javaMethod.setMEP(mep);
+
+ String action = null;
+ String operationName = method.getName();
+ if (webMethod != null ) {
+ action = webMethod.action();
+ operationName = webMethod.operationName().length() > 0 ?
+ webMethod.operationName() :
+ operationName;
+ }
+ javaMethod.setOperationName(operationName);
+ SOAPBinding methodBinding =
+ method.getAnnotation(SOAPBinding.class);
+ if (methodBinding == null &&
!method.getDeclaringClass().equals(portClass)) {
+ if (!method.getDeclaringClass().isInterface()) {
+ methodBinding =
method.getDeclaringClass().getAnnotation(SOAPBinding.class);
+ }
+ }
+ boolean methodIsWrapped = isWrapped;
+ Style style = defaultBinding.getStyle();
+ if (methodBinding != null) {
+ org.jboss.com.sun.xml.ws.model.soap.SOAPBinding mySOAPBinding =
createBinding(methodBinding);
+ style = mySOAPBinding.getStyle();
+ if (action != null)
+ mySOAPBinding.setSOAPAction(action);
+ methodIsWrapped = methodBinding.parameterStyle().equals(
+ javax.jws.soap.SOAPBinding.ParameterStyle.WRAPPED);
+ javaMethod.setBinding(mySOAPBinding);
+ } else {
+ org.jboss.com.sun.xml.ws.model.soap.SOAPBinding sb = new
org.jboss.com.sun.xml.ws.model.soap.SOAPBinding(defaultBinding);
+ if (action != null)
+ sb.setSOAPAction(action);
+ else
+ sb.setSOAPAction("");
+ javaMethod.setBinding(sb);
+ }
+ if (!methodIsWrapped) {
+ processDocBareMethod(javaMethod, methodName, webMethod, operationName,
+ method, webService);
+ } else if (style.equals(Style.DOCUMENT)) {
+ processDocWrappedMethod(javaMethod, methodName, webMethod, operationName,
+ method, webService);
+ } else {
+ processRpcMethod(javaMethod, methodName, webMethod, operationName,
+ method, webService);
+ }
+ runtimeModel.addJavaMethod(javaMethod);
+ }
+
+ private int getMEP(Method m){
+ if (m.isAnnotationPresent(Oneway.class)) {
+ return MessageStruct.ONE_WAY_MEP;
+ }
+ if(Response.class.isAssignableFrom(m.getReturnType())){
+ return MessageStruct.ASYNC_POLL_MEP;
+ }else if(Future.class.isAssignableFrom(m.getReturnType())){
+ return MessageStruct.ASYNC_CALLBACK_MEP;
+ }
+ return MessageStruct.REQUEST_RESPONSE_MEP;
+ }
+
+ /**
+ * models a document/literal wrapped method
+ * @param javaMethod the runtime model <code>JavaMethod</code> instance
being created
+ * @param methodName the runtime model <code>JavaMethod</code> instance
being created
+ * @param webMethod the runtime model <code>JavaMethod</code> instance
being created
+ * @param operationName the runtime model <code>JavaMethod</code>
instance being created
+ * @param method the <code>method</code> to model
+ * @param webService The <code>WebService</code> annotation instance on
the <code>portClass</code>
+ */
+ protected void processDocWrappedMethod(JavaMethod javaMethod, String methodName,
+ WebMethod webMethod, String operationName,
Method method, WebService webService) {
+ boolean isOneway = method.isAnnotationPresent(Oneway.class);
+ RequestWrapper reqWrapper = method.getAnnotation(RequestWrapper.class);
+ ResponseWrapper resWrapper = method.getAnnotation(ResponseWrapper.class);
+ String beanPackage = packageName + PD_JAXWS_PACKAGE_PD;
+ if (packageName == null || (packageName != null && packageName.length()
== 0))
+ beanPackage = JAXWS_PACKAGE_PD;
+ String requestClassName = null;
+ if(reqWrapper != null && reqWrapper.className().length()>0){
+ requestClassName = reqWrapper.className();
+ }else{
+ requestClassName = beanPackage + capitalize(method.getName());
+ }
+
+
+ String responseClassName = null;
+ if(resWrapper != null && resWrapper.className().length()>0){
+ responseClassName = resWrapper.className();
+ }else{
+ responseClassName = beanPackage + capitalize(method.getName()) + RESPONSE;
+ }
+
+ Class requestClass = getClass(requestClassName);
+
+ String reqName = operationName;
+ String reqNamespace = targetNamespace;
+ if (reqWrapper != null) {
+ if (reqWrapper.targetNamespace().length() > 0)
+ reqNamespace = reqWrapper.targetNamespace();
+ if (reqWrapper.localName().length() > 0)
+ reqName = reqWrapper.localName();
+ }
+ QName reqElementName = new QName(reqNamespace, reqName);
+
+ Class responseClass = null;
+ QName resElementName = null;
+ String resName = operationName+"Response";
+ String resNamespace = targetNamespace;
+ if (!isOneway) {
+ responseClass = getClass(responseClassName);
+ if (resWrapper != null) {
+ if (resWrapper.targetNamespace().length() > 0)
+ resNamespace = resWrapper.targetNamespace();
+ if (resWrapper.localName().length() > 0)
+ resName = resWrapper.localName();
+ }
+ }
+ resElementName = new QName(resNamespace, resName);
+
+ TypeReference typeRef =
+ new TypeReference(reqElementName, requestClass, new Annotation[0]);
+ WrapperParameter requestWrapper = new WrapperParameter(typeRef,
+ org.jboss.com.sun.xml.ws.model.Mode.IN, 0);
+ requestWrapper.setBinding(ParameterBinding.BODY);
+ javaMethod.addParameter(requestWrapper);
+ WrapperParameter responseWrapper = null;
+ if (!isOneway) {
+ typeRef = new TypeReference(resElementName, responseClass,
+ new Annotation[0]);
+ responseWrapper = new WrapperParameter(typeRef,
+ org.jboss.com.sun.xml.ws.model.Mode.OUT, -1);
+ javaMethod.addParameter(responseWrapper);
+ responseWrapper.setBinding(ParameterBinding.BODY);
+ }
+
+ // return value
+ String resultName = null;
+ String resultTNS = "";
+ QName resultQName = null;
+ WebResult webResult = method.getAnnotation(WebResult.class);
+ Class returnType = method.getReturnType();
+ boolean isResultHeader = false;
+ if (webResult != null) {
+ if (webResult.name().length() > 0)
+ resultName = webResult.name();
+ else
+ resultName = RETURN;
+ resultTNS = webResult.targetNamespace();
+ isResultHeader = webResult.header();
+ if (resultTNS.length() == 0 && webResult.header()) {
+ // headers must have a namespace
+ resultTNS = targetNamespace;
+ }
+ resultQName = new QName(resultTNS, resultName);
+ } else if (!isOneway && !returnType.getName().equals("void")
&& !javaMethod.isAsync()) {
+ if(resultQName == null){
+ resultQName = new QName(resultTNS, RETURN);
+ }
+ }
+
+ if(javaMethod.isAsync()){
+ returnType = getAsyncReturnType(method, returnType);
+ resultQName = new QName(RETURN);
+ }
+
+ if (!isOneway && (returnType != null) &&
(!returnType.getName().equals("void"))) {
+ Class returnClazz = returnType;
+ Annotation[] rann = method.getAnnotations();
+ if (resultQName.getLocalPart() != null) {
+ TypeReference rTypeReference = new TypeReference(resultQName, returnType,
rann);
+ Parameter returnParameter = new Parameter(rTypeReference,
org.jboss.com.sun.xml.ws.model.Mode.OUT, -1);
+ if (isResultHeader) {
+ returnParameter.setBinding(ParameterBinding.HEADER);
+ javaMethod.addParameter(returnParameter);
+ } else {
+ returnParameter.setBinding(ParameterBinding.BODY);
+ responseWrapper.addWrapperChild(returnParameter);
+ }
+ }
+ }
+
+ //get WebParam
+ Class<?>[] parameterTypes = method.getParameterTypes();
+ Type[] genericParameterTypes = method.getGenericParameterTypes();
+ Annotation[][] pannotations = getPrivParameterAnnotations(method);
+ int pos = 0;
+ QName paramQName = null;
+ for (Class clazzType : parameterTypes) {
+ String partName=null;
+ Parameter param = null;
+ String paramName = "arg"+pos;
+ String paramNamespace = "";
+ boolean isHeader = false;
+
+ if(javaMethod.isAsync() &&
AsyncHandler.class.isAssignableFrom(clazzType)){
+ continue;
+ }
+
+ boolean isHolder = HOLDER_CLASS.isAssignableFrom(clazzType);
+ //set the actual type argument of Holder in the TypeReference
+ if (isHolder) {
+ if(clazzType.getName().equals(Holder.class.getName())){
+ clazzType =
Navigator.REFLECTION.erasure(((ParameterizedType)genericParameterTypes[pos]).getActualTypeArguments()[0]);
+ }
+ }
+ org.jboss.com.sun.xml.ws.model.Mode paramMode = isHolder ?
+ org.jboss.com.sun.xml.ws.model.Mode.INOUT :
+ org.jboss.com.sun.xml.ws.model.Mode.IN;
+ for (Annotation annotation : pannotations[pos]) {
+ if (annotation.annotationType() == javax.jws.WebParam.class) {
+ javax.jws.WebParam webParam = (javax.jws.WebParam) annotation;
+ if (webParam.name().length() > 0)
+ paramName = webParam.name();
+ isHeader = webParam.header();
+ if(webParam.partName().length() > 0)
+ partName = webParam.partName();
+ else
+ partName = paramName;
+ if (isHeader) // headers cannot be in empty namespace
+ paramNamespace = targetNamespace;
+ if (!webParam.targetNamespace().equals("")) {
+ paramNamespace = webParam.targetNamespace();
+ }
+ WebParam.Mode mode = webParam.mode();
+ if (isHolder && mode == javax.jws.WebParam.Mode.IN)
+ mode = javax.jws.WebParam.Mode.INOUT;
+ paramMode = (mode == javax.jws.WebParam.Mode.IN) ?
org.jboss.com.sun.xml.ws.model.Mode.IN :
+ (mode == javax.jws.WebParam.Mode.INOUT) ?
org.jboss.com.sun.xml.ws.model.Mode.INOUT :
+ org.jboss.com.sun.xml.ws.model.Mode.OUT;
+ break;
+ }
+ }
+ paramQName = new QName(paramNamespace, paramName);
+ typeRef =
+ new TypeReference(paramQName, clazzType, pannotations[pos]);
+ param = new Parameter(typeRef, paramMode, pos++);
+ if (isHeader) {
+ param.setBinding(ParameterBinding.HEADER);
+ javaMethod.addParameter(param);
+ param.setPartName(partName);
+ } else {
+ param.setBinding(ParameterBinding.BODY);
+ if (!paramMode.equals(org.jboss.com.sun.xml.ws.model.Mode.OUT)) {
+ requestWrapper.addWrapperChild(param);
+ }
+ if (!paramMode.equals(org.jboss.com.sun.xml.ws.model.Mode.IN)) {
+ if (isOneway) {
+ throw new
RuntimeModelerException("runtime.modeler.oneway.operation.no.out.parameters",
+ new Object[] {portClass.getCanonicalName(),
methodName});
+ }
+ responseWrapper.addWrapperChild(param);
+ }
+ }
+ }
+ processExceptions(javaMethod, method);
+ }
+
+
+ /**
+ * models a rpc/literal method
+ * @param javaMethod the runtime model <code>JavaMethod</code> instance
being created
+ * @param methodName the name of the <code>method</code> being modeled.
+ * @param webMethod the <code>WebMethod</code> annotations instance on
the <code>method</code>
+ * @param operationName the WSDL operation name for this
<code>method</code>
+ * @param method the runtime model <code>JavaMethod</code> instance being
created
+ * @param webService the runtime model <code>JavaMethod</code> instance
being created
+ */
+ protected void processRpcMethod(JavaMethod javaMethod, String methodName,
+ WebMethod webMethod, String operationName, Method
method, WebService webService) {
+ boolean isOneway = method.isAnnotationPresent(Oneway.class);
+ //build ordered list
+ Map<Integer, Parameter> resRpcParams = new HashMap<Integer,
Parameter>();
+ Map<Integer, Parameter> reqRpcParams = new HashMap<Integer,
Parameter>();
+
+ //Lets take the service namespace and overwrite it with the one we get it from
wsdl
+ String reqNamespace = targetNamespace;
+ String respNamespace = targetNamespace;
+ if(binding != null){
+ binding.finalizeBinding();
+ BindingOperation op = binding.get(operationName);
+ if(op != null){
+ //it cant be null, but lets not fail and try to work with service
namespce
+ if(op.getRequestNamespace() != null){
+ reqNamespace = op.getRequestNamespace();
+ }
+
+ //it cant be null, but lets not fail and try to work with service
namespce
+ if(op.getResponseNamespace() != null){
+ respNamespace = op.getResponseNamespace();
+ }
+ }
+ }
+
+ QName reqElementName = new QName(reqNamespace, operationName);
+ QName resElementName = null;
+ if (!isOneway) {
+ resElementName = new QName(respNamespace, operationName+RESPONSE);
+ }
+
+ TypeReference typeRef =
+ new TypeReference(reqElementName, RPC_LIT_PAYLOAD_CLASS, new
Annotation[0]);
+ WrapperParameter requestWrapper = new WrapperParameter(typeRef,
+ org.jboss.com.sun.xml.ws.model.Mode.IN, 0);
+ requestWrapper.setInBinding(ParameterBinding.BODY);
+ javaMethod.addParameter(requestWrapper);
+ WrapperParameter responseWrapper = null;
+ if (!isOneway) {
+ typeRef = new TypeReference(resElementName, RPC_LIT_PAYLOAD_CLASS,
+ new Annotation[0]);
+ responseWrapper = new WrapperParameter(typeRef,
+ org.jboss.com.sun.xml.ws.model.Mode.OUT, -1);
+ responseWrapper.setOutBinding(ParameterBinding.BODY);
+ javaMethod.addParameter(responseWrapper);
+ }
+
+ Class returnType = method.getReturnType();
+ String resultName = RETURN;
+ String resultTNS = targetNamespace;
+ String resultPartName = resultName;
+ QName resultQName = null;
+ boolean isResultHeader = false;
+ WebResult webResult = method.getAnnotation(WebResult.class);
+
+ if (webResult != null) {
+ isResultHeader = webResult.header();
+ if (webResult.name().length() > 0)
+ resultName = webResult.name();
+ else
+ resultName = RETURN;
+ if (webResult.partName().length() > 0) {
+ resultPartName = webResult.partName();
+ if (!isResultHeader)
+ resultName = resultPartName;
+ } else
+ resultPartName = resultName;
+ if (webResult.targetNamespace().length() > 0)
+ resultTNS = webResult.targetNamespace();
+ isResultHeader = webResult.header();
+ }
+ if (isResultHeader)
+ resultQName = new QName(resultTNS, resultName);
+ else
+ resultQName = new QName(resultName);
+
+ if(javaMethod.isAsync()){
+ returnType = getAsyncReturnType(method, returnType);
+ }
+
+ if (!isOneway && (returnType != null) &&
(!returnType.getName().equals("void"))) {
+ Class returnClazz = returnType;
+ Annotation[] rann = method.getAnnotations();
+ TypeReference rTypeReference = new TypeReference(resultQName, returnType,
rann);
+ Parameter returnParameter = new Parameter(rTypeReference,
org.jboss.com.sun.xml.ws.model.Mode.OUT, -1);
+ returnParameter.setPartName(resultPartName);
+ if(isResultHeader){
+ returnParameter.setBinding(ParameterBinding.HEADER);
+ javaMethod.addParameter(returnParameter);
+ }else{
+ ParameterBinding rb = getBinding(binding, operationName, resultPartName,
false, org.jboss.com.sun.xml.ws.model.Mode.OUT);
+ returnParameter.setBinding(rb);
+ if(rb.isBody() || rb.isUnbound()){
+ Part p = getPart(operationName, resultPartName, Mode.OUT);
+ if(p == null)
+ resRpcParams.put(resRpcParams.size(), returnParameter);
+ else
+ resRpcParams.put(p.getIndex(), returnParameter);
+ //responseWrapper.addWrapperChild(returnParameter);
+ }else{
+ javaMethod.addParameter(returnParameter);
+ }
+ }
+ }
+
+ //get WebParam
+ Class<?>[] parameterTypes = method.getParameterTypes();
+ Type[] genericParameterTypes = method.getGenericParameterTypes();
+ Annotation[][] pannotations = getPrivParameterAnnotations(method);
+ int pos = 0;
+ QName paramQName = null;
+ for (Class clazzType : parameterTypes) {
+ Parameter param = null;
+ String paramName = "";
+ String paramNamespace = "";
+ String partName = "";
+ boolean isHeader = false;
+
+ if(javaMethod.isAsync() &&
AsyncHandler.class.isAssignableFrom(clazzType)){
+ continue;
+ }
+
+ boolean isHolder = HOLDER_CLASS.isAssignableFrom(clazzType);
+ //set the actual type argument of Holder in the TypeReference
+ if (isHolder) {
+ if (clazzType.getName().equals(Holder.class.getName()))
+ clazzType =
Navigator.REFLECTION.erasure(((ParameterizedType)genericParameterTypes[pos]).getActualTypeArguments()[0]);
+ }
+ org.jboss.com.sun.xml.ws.model.Mode paramMode = isHolder ?
+ org.jboss.com.sun.xml.ws.model.Mode.INOUT :
+ org.jboss.com.sun.xml.ws.model.Mode.IN;
+ for (Annotation annotation : pannotations[pos]) {
+ if (annotation.annotationType() == javax.jws.WebParam.class) {
+ javax.jws.WebParam webParam = (javax.jws.WebParam) annotation;
+ paramName = webParam.name();
+ partName = webParam.partName();
+ isHeader = webParam.header();
+ WebParam.Mode mode = webParam.mode();
+ paramNamespace = webParam.targetNamespace();
+ if (isHolder && mode == javax.jws.WebParam.Mode.IN)
+ mode = javax.jws.WebParam.Mode.INOUT;
+ paramMode = (mode == javax.jws.WebParam.Mode.IN) ?
org.jboss.com.sun.xml.ws.model.Mode.IN :
+ (mode == javax.jws.WebParam.Mode.INOUT) ?
org.jboss.com.sun.xml.ws.model.Mode.INOUT :
+ org.jboss.com.sun.xml.ws.model.Mode.OUT;
+ break;
+ }
+ }
+
+ if (paramName.length() == 0) {
+ paramName = "arg"+pos;
+ }
+ if (partName.length() == 0) {
+ partName = paramName;
+ } else if (!isHeader) {
+ paramName = partName;
+ }
+ if (partName.length() == 0) {
+ partName = paramName;
+ }
+
+ if (!isHeader) {
+ //its rpclit body param, set namespace to ""
+ paramQName = new QName("", paramName);
+ } else {
+ if (paramNamespace.length() == 0)
+ paramNamespace = targetNamespace;
+ paramQName = new QName(paramNamespace, paramName);
+ }
+ typeRef =
+ new TypeReference(paramQName, clazzType, pannotations[pos]);
+
+ param = new Parameter(typeRef, paramMode, pos++);
+ param.setPartName(partName);
+
+ if(paramMode == Mode.INOUT){
+ ParameterBinding pb = getBinding(binding, operationName, partName,
isHeader, Mode.IN);
+ param.setInBinding(pb);
+ pb = getBinding(binding, operationName, partName, isHeader, Mode.OUT);
+ param.setOutBinding(pb);
+ }else{
+ if (isHeader) {
+ param.setBinding(ParameterBinding.HEADER);
+ } else {
+ ParameterBinding pb = getBinding(binding, operationName, partName,
false, paramMode);
+ param.setBinding(pb);
+ }
+ }
+ if(param.getInBinding().isBody()){
+ if(!param.isOUT()){
+ Part p = getPart(operationName, partName, Mode.IN);
+ if(p == null)
+ reqRpcParams.put(reqRpcParams.size(), param);
+ else
+ reqRpcParams.put(p.getIndex(), param);
+ //requestWrapper.addWrapperChild(param);
+ }
+
+ if(!param.isIN()){
+ if (isOneway) {
+ throw new
RuntimeModelerException("runtime.modeler.oneway.operation.no.out.parameters",
+ new Object[] {portClass.getCanonicalName(),
methodName});
+ }
+ Part p = getPart(operationName, partName, Mode.OUT);
+ if(p == null)
+ resRpcParams.put(resRpcParams.size(), param);
+ else
+ resRpcParams.put(p.getIndex(), param);
+// responseWrapper.addWrapperChild(param);
+ }
+ }else{
+ javaMethod.addParameter(param);
+ }
+ }
+ for(int i = 0; i < reqRpcParams.size();i++)
+ requestWrapper.addWrapperChild(reqRpcParams.get(i));
+ for(int i = 0; i < resRpcParams.size();i++)
+ responseWrapper.addWrapperChild(resRpcParams.get(i));
+ processExceptions(javaMethod, method);
+ }
+
+ /**
+ * models the exceptions thrown by <code>method</code> and adds them to
the <code>javaMethod</code>
+ * runtime model object
+ * @param javaMethod the runtime model object to add the exception model objects to
+ * @param method the <code>method</code> from which to find the
exceptions to model
+ */
+ protected void processExceptions(JavaMethod javaMethod, Method method) {
+ for (Type exception : method.getGenericExceptionTypes()) {
+ if (REMOTE_EXCEPTION_CLASS.isAssignableFrom((Class)exception))
+ continue;
+ Class exceptionBean;
+ Annotation[] anns;
+ WebFault webFault = getPrivClassAnnotation((Class)exception,
WebFault.class);
+ Method faultInfoMethod = getWSDLExceptionFaultInfo((Class)exception);
+ ExceptionType exceptionType = ExceptionType.WSDLException;
+ String namespace = targetNamespace;
+ String name = ((Class)exception).getSimpleName();
+ String beanPackage = packageName + PD_JAXWS_PACKAGE_PD;
+ if (packageName == null || (packageName != null &&
packageName.length() == 0))
+ beanPackage = JAXWS_PACKAGE_PD;
+ String className = beanPackage+ name + BEAN;
+ if (webFault != null) {
+ if (webFault.faultBean().length()>0)
+ className = webFault.faultBean();
+ if (webFault.name().length()>0)
+ name = webFault.name();
+ if (webFault.targetNamespace().length()>0)
+ namespace = webFault.targetNamespace();
+ }
+ if (faultInfoMethod == null) {
+ exceptionBean = getClass(className);
+ exceptionType = ExceptionType.UserDefined;
+ anns = exceptionBean.getAnnotations();
+
+ } else {
+ exceptionBean = faultInfoMethod.getReturnType();
+ anns = faultInfoMethod.getAnnotations();
+ }
+ QName faultName = new QName(namespace, name);
+ TypeReference typeRef = new TypeReference(faultName, exceptionBean,
+ anns);
+ CheckedException checkedException =
+ new CheckedException((Class)exception, typeRef, exceptionType);
+ checkedException.setMessageName(((Class)exception).getSimpleName());
+ javaMethod.addException(checkedException);
+ }
+ }
+
+ /**
+ * returns the method that corresponds to "getFaultInfo". Returns null if
this is not an
+ * exception generated from a WSDL
+ * @param exception the class to search for the "getFaultInfo" method
+ * @return the method named "getFaultInfo" if this is an exception
generated from WSDL or an
+ * exception that contains the <code>WebFault</code> annotation.
Otherwise it returns null
+ */
+ protected Method getWSDLExceptionFaultInfo(Class exception) {
+ if (getPrivClassAnnotation(exception, WebFault.class) == null)
+ return null;
+ try {
+ Method getFaultInfo = exception.getMethod("getFaultInfo", new
Class[0]);
+ return getFaultInfo;
+ } catch (NoSuchMethodException e) {
+ return null;
+ }
+ }
+
+ /**
+ * models a document/literal bare method
+ * @param javaMethod the runtime model <code>JavaMethod</code> instance
being created
+ * @param methodName the runtime model <code>JavaMethod</code> instance
being created
+ * @param webMethod the runtime model <code>JavaMethod</code> instance
being created
+ * @param operationName the runtime model <code>JavaMethod</code>
instance being created
+ * @param method the runtime model <code>JavaMethod</code> instance being
created
+ * @param webService the runtime model <code>JavaMethod</code> instance
being created
+ */
+ protected void processDocBareMethod(JavaMethod javaMethod, String methodName,
+ WebMethod webMethod, String operationName, Method
method, WebService webService) {
+
+ String resultName = operationName+RESPONSE;
+ String resultTNS = targetNamespace;
+ String resultPartName = null;
+ boolean isResultHeader = false;
+ WebResult webResult = method.getAnnotation(WebResult.class);
+ if (webResult != null) {
+ if (webResult.name().length() > 0)
+ resultName = webResult.name();
+ if (webResult.targetNamespace().length() > 0)
+ resultTNS = webResult.targetNamespace();
+ resultPartName = webResult.partName();
+ isResultHeader = webResult.header();
+ }
+ Class returnType = method.getReturnType();
+
+ if(javaMethod.isAsync()){
+ returnType = getAsyncReturnType(method, returnType);
+ }
+
+ QName responseQName = null;
+ if ((returnType != null) &&
(!returnType.getName().equals("void"))) {
+ Class returnClazz = returnType;
+ Annotation[] rann = method.getAnnotations();
+ QName rqname = null;
+ if (resultName != null) {
+ responseQName = new QName(resultTNS, resultName);
+ TypeReference rTypeReference = new TypeReference(responseQName,
returnType, rann);
+ Parameter returnParameter = new Parameter(rTypeReference,
org.jboss.com.sun.xml.ws.model.Mode.OUT, -1);
+
+ if(resultPartName == null || (resultPartName.length() == 0)){
+ resultPartName = resultName;
+ }
+ returnParameter.setPartName(resultPartName);
+ if(isResultHeader){
+ returnParameter.setBinding(ParameterBinding.HEADER);
+ }else{
+ ParameterBinding rb = getBinding(binding, operationName,
resultPartName, false, org.jboss.com.sun.xml.ws.model.Mode.OUT);
+ returnParameter.setBinding(rb);
+ }
+ javaMethod.addParameter(returnParameter);
+ }
+ }
+
+ //get WebParam
+ Class<?>[] parameterTypes = method.getParameterTypes();
+ Type[] genericParameterTypes = method.getGenericParameterTypes();
+ Annotation[][] pannotations = getPrivParameterAnnotations(method);
+ QName requestQName = null;
+ int pos = 0;
+ for (Class clazzType : parameterTypes) {
+ Parameter param = null;
+ String paramName = operationName; //method.getName();
+ String partName = null;
+ String requestNamespace = targetNamespace;
+ boolean isHeader = false;
+
+ //async
+ if(javaMethod.isAsync() &&
AsyncHandler.class.isAssignableFrom(clazzType)){
+ continue;
+ }
+
+ boolean isHolder = HOLDER_CLASS.isAssignableFrom(clazzType);
+ //set the actual type argument of Holder in the TypeReference
+ if (isHolder) {
+ if (clazzType.getName().equals(Holder.class.getName()))
+ clazzType =
Navigator.REFLECTION.erasure(((ParameterizedType)genericParameterTypes[pos]).getActualTypeArguments()[0]);
+ }
+
+ org.jboss.com.sun.xml.ws.model.Mode paramMode = isHolder ?
+ org.jboss.com.sun.xml.ws.model.Mode.INOUT :
+ org.jboss.com.sun.xml.ws.model.Mode.IN;
+ for (Annotation annotation : pannotations[pos]) {
+ if (annotation.annotationType() == javax.jws.WebParam.class) {
+ javax.jws.WebParam webParam = (javax.jws.WebParam) annotation;
+ if (webParam.name().length() > 0)
+ paramName = webParam.name();
+ partName = webParam.partName();
+ if (!webParam.targetNamespace().equals("")) {
+ requestNamespace = webParam.targetNamespace();
+ }
+ isHeader = webParam.header();
+ WebParam.Mode mode = webParam.mode();
+ if (isHolder && mode == javax.jws.WebParam.Mode.IN)
+ mode = javax.jws.WebParam.Mode.INOUT;
+ paramMode = (mode == javax.jws.WebParam.Mode.IN) ?
org.jboss.com.sun.xml.ws.model.Mode.IN :
+ (mode == javax.jws.WebParam.Mode.INOUT) ?
org.jboss.com.sun.xml.ws.model.Mode.INOUT :
+ org.jboss.com.sun.xml.ws.model.Mode.OUT;
+ break;
+ }
+ }
+
+ requestQName = new QName(requestNamespace, paramName);
+ //doclit/wrapped
+ TypeReference typeRef = //operationName with upper 1 char
+ new TypeReference(requestQName, clazzType,
+ pannotations[pos]);
+
+ param = new Parameter(typeRef, paramMode, pos++);
+ if(partName == null || (partName.length() == 0)){
+ partName = paramName;
+ }
+ param.setPartName(partName);
+ if(paramMode == org.jboss.com.sun.xml.ws.model.Mode.INOUT){
+ ParameterBinding pb = getBinding(binding, operationName, partName,
isHeader, org.jboss.com.sun.xml.ws.model.Mode.IN);
+ param.setInBinding(pb);
+ pb = getBinding(binding, operationName, partName, isHeader,
org.jboss.com.sun.xml.ws.model.Mode.OUT);
+ param.setOutBinding(pb);
+ }else{
+ if (isHeader){
+ param.setBinding(ParameterBinding.HEADER);
+ }else{
+ ParameterBinding pb = getBinding(binding, operationName, partName,
false, paramMode);
+ param.setBinding(pb);
+ }
+ }
+ javaMethod.addParameter(param);
+ }
+ processExceptions(javaMethod, method);
+ }
+
+ private Class getAsyncReturnType(Method method, Class returnType) {
+ if(Response.class.isAssignableFrom(returnType)){
+ Type ret = method.getGenericReturnType();
+ return
Navigator.REFLECTION.erasure(((ParameterizedType)ret).getActualTypeArguments()[0]);
+ }else{
+ Type[] types = method.getGenericParameterTypes();
+ Class[] params = method.getParameterTypes();
+ int i = 0;
+ for(Class cls : params){
+ if(AsyncHandler.class.isAssignableFrom(cls)){
+ return
Navigator.REFLECTION.erasure(((ParameterizedType)types[i]).getActualTypeArguments()[0]);
+ }
+ i++;
+ }
+ }
+ return returnType;
+ }
+
+ /**
+ * utility to capitalize the first letter in a string
+ * @param name the string to capitalize
+ * @return the capitalized string
+ */
+ public static String capitalize(String name) {
+ if (name == null || name.length() == 0) {
+ return name;
+ }
+ char chars[] = name.toCharArray();
+ chars[0] = Character.toUpperCase(chars[0]);
+ return new String(chars);
+ }
+
+ /*
+ * Return service QName
+ */
+ /**
+ * gets the <code>wsdl:serviceName</code> for a given implementation
class
+ * @param implClass the implementation class
+ * @return the <code>wsdl:serviceName</code> for the
<code>implClass</code>
+ */
+ public static QName getServiceName(Class implClass) {
+ if (implClass.isInterface()) {
+ throw new
RuntimeModelerException("runtime.modeler.cannot.get.serviceName.from.interface",
+ new Object[] {implClass.getCanonicalName()});
+ }
+
+ String name = implClass.getSimpleName()+SERVICE;
+ String packageName = null;
+ if (implClass.getPackage() != null)
+ packageName = implClass.getPackage().getName();
+
+ WebService webService =
+ (WebService)implClass.getAnnotation(WebService.class);
+ if (webService == null) {
+ throw new
RuntimeModelerException("runtime.modeler.no.webservice.annotation",
+ new Object[] {implClass.getCanonicalName()});
+ }
+ if (webService.serviceName().length() > 0) {
+ name = webService.serviceName();
+ }
+ String targetNamespace = getNamespace(packageName);
+ if (webService.targetNamespace().length() > 0) {
+ targetNamespace = webService.targetNamespace();
+ } else if (targetNamespace == null) {
+ throw new RuntimeModelerException("runtime.modeler.no.package",
+ new Object[] {implClass.getName()});
+ }
+
+
+
+ return new QName(targetNamespace, name);
+ }
+
+ /**
+ * gets the <code>wsdl:portName</code> for a given implementation class
+ * @param implClass the implementation class
+ * @param targetNamespace Namespace URI for service name
+ * @return the <code>wsdl:portName</code> for the
<code>implClass</code>
+ */
+ public static QName getPortName(Class implClass, String targetNamespace) {
+ WebService webService =
+ (WebService)implClass.getAnnotation(WebService.class);
+ if (webService == null) {
+ throw new
RuntimeModelerException("runtime.modeler.no.webservice.annotation",
+ new Object[] {implClass.getCanonicalName()});
+ }
+ String name = null;
+ if (webService.portName().length() > 0) {
+ name = webService.portName();
+ } else if (webService.name().length() > 0) {
+ name = webService.name()+PORT;
+ } else {
+ name = implClass.getSimpleName()+PORT;
+ }
+
+ if (targetNamespace == null) {
+ if (webService.targetNamespace().length() > 0) {
+ targetNamespace = webService.targetNamespace();
+ } else {
+ String packageName = null;
+ if (implClass.getPackage() != null) {
+ packageName = implClass.getPackage().getName();
+ }
+ targetNamespace = getNamespace(packageName);
+ if (targetNamespace == null) {
+ throw new
RuntimeModelerException("runtime.modeler.no.package",
+ new Object[] {implClass.getName()});
+ }
+ }
+
+ }
+
+ return new QName(targetNamespace, name);
+ }
+
+ /**
+ * Gives portType QName from implementatorClass or SEI
+ * @param implOrSeiClass cant be null
+ * @return <code>wsdl:portType@name</code>, null if it could not find
the annotated class.
+ */
+ public static QName getPortTypeName(Class implOrSeiClass){
+ assert(implOrSeiClass != null);
+ Class clazz = implOrSeiClass;
+ WebService webService = null;
+ if (!implOrSeiClass.isAnnotationPresent(javax.jws.WebService.class))
+ throw new
RuntimeModelerException("runtime.modeler.no.webservice.annotation",
+ new Object[]
{implOrSeiClass.getCanonicalName()});
+
+ if (!implOrSeiClass.isInterface()) {
+ webService = (WebService) implOrSeiClass.getAnnotation(WebService.class);
+ String epi = webService.endpointInterface();
+ if (epi.length() > 0) {
+ try {
+ clazz =
Thread.currentThread().getContextClassLoader().loadClass(epi);
+ } catch (ClassNotFoundException e) {
+ throw new
RuntimeModelerException("runtime.modeler.class.not.found",
+ new Object[] {epi});
+ }
+ if (!clazz.isAnnotationPresent(javax.jws.WebService.class)) {
+ throw new
RuntimeModelerException("runtime.modeler.endpoint.interface.no.webservice",
+ new Object[] {webService.endpointInterface()});
+ }
+ }
+ }
+
+ webService = (WebService) clazz.getAnnotation(WebService.class);
+ String name = webService.name();
+ if(name.length() == 0){
+ name = clazz.getSimpleName();
+ }
+
+ String tns = webService.targetNamespace();
+ if (tns.length() == 0)
+ tns = getNamespace(clazz.getPackage().getName());
+ if (tns == null) {
+ throw new RuntimeModelerException("runtime.modeler.no.package",
+ new Object[] {clazz.getName()});
+ }
+ return new QName(tns, name);
+ }
+
+ public static String getBindingId(Class implClass) {
+ BindingType bindingType =
+ (BindingType)implClass.getAnnotation(BindingType.class);
+ if (bindingType != null) {
+ String bindingId = bindingType.value();
+ if (bindingId.length() > 0) {
+ if (!bindingId.equals(javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING)
+ &&
!bindingId.equals(javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_MTOM_BINDING)
+ &&
!bindingId.equals(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING)
+ &&
!bindingId.equals(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_MTOM_BINDING)
+ && !bindingId.equals(HTTPBinding.HTTP_BINDING)
+ && !bindingId.equals(SOAPBindingImpl.X_SOAP12HTTP_BINDING))
{
+ throw new IllegalArgumentException("Wrong binding id
"+bindingId+" in @BindingType");
+ }
+ return bindingId;
+ }
+ }
+ return null;
+ }
+
+ private ParameterBinding getBinding(org.jboss.com.sun.xml.ws.wsdl.parser.Binding
binding, String operation, String part, boolean isHeader, Mode mode){
+ if(binding == null){
+ if(isHeader)
+ return ParameterBinding.HEADER;
+ else
+ return ParameterBinding.BODY;
+ }
+ BindingOperation bo = binding.get(operation);
+
+ //if the binding Operation corresponding to the operation is not found in the
WSDL then
+ //throw the exception
+ if(bo == null){
+ throw new RuntimeModelerException("runtime.operation.noBinding",
operation, portName);
+ }
+
+ return binding.getBinding(bo, part, mode);
+ }
+
+ private Part getPart(String opName, String partName, Mode mode){
+ if(binding != null){
+ BindingOperation bo = binding.get(opName);
+ if(bo != null)
+ return bo.getPart(partName, mode);
+ }
+ return null;
+ }
+
+
+ public String getBindingId() {
+ return bindingId;
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/modeler/RuntimeModeler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/modeler/RuntimeModelerException.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/modeler/RuntimeModelerException.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/modeler/RuntimeModelerException.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,53 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.modeler;
+import org.jboss.com.sun.xml.ws.util.exception.JAXWSExceptionBase;
+import org.jboss.com.sun.xml.ws.util.localization.Localizable;
+
+/**
+ * RuntimeModelerException represents an exception that occurred while
+ * serializing a Java value as XML.
+ *
+ * @see JAXWSExceptionBase
+ *
+ * @author WS Development Team
+ */
+public class RuntimeModelerException extends JAXWSExceptionBase {
+
+ public RuntimeModelerException(String key, Object... args) {
+ super(key, args);
+ }
+
+ public RuntimeModelerException(Throwable throwable) {
+ super(throwable);
+ }
+
+ public RuntimeModelerException(Localizable arg) {
+ super("nestedModelerError", arg);
+ }
+
+ public String getResourceBundleName() {
+ return "org.jboss.com.sun.xml.ws.resources.modeler";
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/modeler/RuntimeModelerException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/package-info.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/package-info.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/package-info.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,62 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+/**
+ *
+ * <P>This document describes the architecture of JAX-WS 2.0 runtime. JAX-WS is
+ * the aggregating component of what is called the integrated Stack
+ * (I-Stack). The I-Stack consists of JAX-WS, JAX-B, StAX, SAAJ and Fast
+ * Infoset. JAX-B is the databinding component of the stack. StAX is the
+ * Streaming XML parser used by the stack. SAAJ is used for its
+ * attachment support with SOAP messages and to allow handler developers
+ * to gain access to the SOAP message via a standard interface. Fast
+ * Infoset is a binary encoding of XML that can improve performance.</P>
+ * <P>JAX-WS 2.0 was originally called JAX-RPC 2.0 and was hence
+ * developed from the JAX-RPC 1.1 code base. JAX-WS has been
+ * significanlty rearchitected to for extensibility going forward by
+ * incorporating and implementing concepts from <A
HREF="pept.html">PEPT</A>.
+ * PEPT presents four main components presentation, encoding, protocol
+ * and transport. Ideally each of these components would not be
+ * dependent on another, however, due to time constraints an optimal
+ * PEPT implementation was not possible and thus some of the PEPT
+ * boundaries have been blurred. Future versions of JAX-WS may sharpen
+ * these boundaries when possible.</P>
+ * <P>The remainder of this document will describe the JAX-WS runtime
+ * architecture from the client and server perspectives.</P>
+ *
+ * <p>
+ * <dl>
+ * <dt>{@link org.jboss.com.sun.xml.ws.server Server}
+ * <dd>
+ * The server side portion of the JAX-WS runtime.
+ *
+ * <dt>{@link org.jboss.com.sun.xml.ws.client Client}
+ * <dd>
+ * The client side portion of the JAX-WS runtime.
+ *
+ * </dl>
+ *
+ * @ArchitectureDocument
+ **/
+package org.jboss.com.sun.xml.ws;
+
+//import javax.xml.ws.Binding;
\ No newline at end of file
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/package-info.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/Delegate.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/Delegate.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/Delegate.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,69 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+/** Java interface "Delegate.java" generated from Poseidon for UML.
+ * Poseidon for UML is developed by <A
HREF="http://www.gentleware.com">Gentleware</A>.
+ * Generated with <A
HREF="http://jakarta.apache.org/velocity/">velocity</A> template
engine.
+ */
+package org.jboss.com.sun.xml.ws.pept;
+
+import org.jboss.com.sun.xml.ws.pept.presentation.MessageStruct;
+
+/**
+ * <p>
+ *
+ * @author Dr. Harold Carr
+ * </p>
+ */
+public interface Delegate {
+
+ ///////////////////////////////////////
+ // operations
+
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * @return a MessageStruct with ...
+ * </p>
+ */
+ public MessageStruct getMessageStruct();
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * </p><p>
+ *
+ * @param message ...
+ * </p>
+ */
+ public void send(MessageStruct message);
+
+} // end Delegate
+
+
+
+
+
+
+
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/Delegate.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/encoding/Decoder.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/encoding/Decoder.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/encoding/Decoder.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,71 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+/** Java interface "Decoder.java" generated from Poseidon for UML.
+ * Poseidon for UML is developed by <A
HREF="http://www.gentleware.com">Gentleware</A>.
+ * Generated with <A
HREF="http://jakarta.apache.org/velocity/">velocity</A> template
engine.
+ */
+package org.jboss.com.sun.xml.ws.pept.encoding;
+
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+
+/**
+ * <p>
+ *
+ * @author Dr. Harold Carr
+ * </p>
+ */
+public interface Decoder {
+
+ ///////////////////////////////////////
+ // operations
+
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * </p><p>
+ *
+ * @param messageInfo ...
+ * </p>
+ */
+ public void decode(MessageInfo messageInfo);
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * </p><p>
+ *
+ * @param messageInfo ...
+ * </p>
+ */
+ public void receiveAndDecode(MessageInfo messageInfo);
+
+} // end Decoder
+
+
+
+
+
+
+
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/encoding/Decoder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/encoding/Encoder.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/encoding/Encoder.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/encoding/Encoder.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,73 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+/** Java interface "Encoder.java" generated from Poseidon for UML.
+ * Poseidon for UML is developed by <A
HREF="http://www.gentleware.com">Gentleware</A>.
+ * Generated with <A
HREF="http://jakarta.apache.org/velocity/">velocity</A> template
engine.
+ */
+package org.jboss.com.sun.xml.ws.pept.encoding;
+
+import java.nio.ByteBuffer;
+
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+
+/**
+ * <p>
+ *
+ * @author Arun Gupta
+ * </p>
+ */
+public interface Encoder {
+
+ ///////////////////////////////////////
+ // operations
+
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * </p><p>
+ *
+ * @param messageInfo ...
+ * </p>
+ */
+ public void encodeAndSend(MessageInfo messageInfo);
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * @return a ByteBuffer with ...
+ * </p><p>
+ * @param messageInfo ...
+ * </p>
+ */
+ public ByteBuffer encode(MessageInfo messageInfo);
+
+} // end Encoder
+
+
+
+
+
+
+
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/encoding/Encoder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/ept/Acceptor.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/ept/Acceptor.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/ept/Acceptor.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,55 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+/** Java interface "Acceptor.java" generated from Poseidon for UML.
+ * Poseidon for UML is developed by <A
HREF="http://www.gentleware.com">Gentleware</A>.
+ * Generated with <A
HREF="http://jakarta.apache.org/velocity/">velocity</A> template
engine.
+ */
+package org.jboss.com.sun.xml.ws.pept.ept;
+
+/**
+ * <p>
+ *
+ * @author Dr. Harold Carr
+ * </p>
+ */
+public interface Acceptor extends EPTFactory {
+
+ ///////////////////////////////////////
+ // operations
+
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * </p>
+ */
+ public void accept();
+
+} // end Acceptor
+
+
+
+
+
+
+
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/ept/Acceptor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/ept/ContactInfo.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/ept/ContactInfo.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/ept/ContactInfo.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,59 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+/** Java interface "ContactInfo.java" generated from Poseidon for UML.
+ * Poseidon for UML is developed by <A
HREF="http://www.gentleware.com">Gentleware</A>.
+ * Generated with <A
HREF="http://jakarta.apache.org/velocity/">velocity</A> template
engine.
+ */
+package org.jboss.com.sun.xml.ws.pept.ept;
+import org.jboss.com.sun.xml.ws.spi.runtime.WSConnection;
+
+/**
+ * <p>
+ *
+ * @author Dr. Harold Carr
+ * </p>
+ */
+public interface ContactInfo extends EPTFactory {
+
+ ///////////////////////////////////////
+ // operations
+
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * @return a Connection with ...
+ * </p><p>
+ * @param messageInfo ...
+ * </p>
+ */
+ public WSConnection getConnection(MessageInfo messageInfo);
+
+} // end ContactInfo
+
+
+
+
+
+
+
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/ept/ContactInfo.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/ept/ContactInfoList.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/ept/ContactInfoList.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/ept/ContactInfoList.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,56 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+/** Java interface "ContactInfoList.java" generated from Poseidon for UML.
+ * Poseidon for UML is developed by <A
HREF="http://www.gentleware.com">Gentleware</A>.
+ * Generated with <A
HREF="http://jakarta.apache.org/velocity/">velocity</A> template
engine.
+ */
+package org.jboss.com.sun.xml.ws.pept.ept;
+
+/**
+ * <p>
+ *
+ * @author Dr. Harold Carr
+ * </p>
+ */
+public interface ContactInfoList {
+
+ ///////////////////////////////////////
+ // operations
+
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * @return a ContactInfoListIterator with ...
+ * </p>
+ */
+ public ContactInfoListIterator iterator();
+
+} // end ContactInfoList
+
+
+
+
+
+
+
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/ept/ContactInfoList.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/ept/ContactInfoListIterator.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/ept/ContactInfoListIterator.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/ept/ContactInfoListIterator.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,65 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+/** Java interface "ContactInfoListIterator.java" generated from Poseidon for
UML.
+ * Poseidon for UML is developed by <A
HREF="http://www.gentleware.com">Gentleware</A>.
+ * Generated with <A
HREF="http://jakarta.apache.org/velocity/">velocity</A> template
engine.
+ */
+package org.jboss.com.sun.xml.ws.pept.ept;
+
+/**
+ * <p>
+ *
+ * @author Dr. Harold Carr
+ * </p>
+ */
+public interface ContactInfoListIterator {
+
+ ///////////////////////////////////////
+ // operations
+
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * @return a boolean with ...
+ * </p>
+ */
+ public boolean hasNext();
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * @return a ContactInfo with ...
+ * </p>
+ */
+ public ContactInfo next();
+
+} // end ContactInfoListIterator
+
+
+
+
+
+
+
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/ept/ContactInfoListIterator.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/ept/EPTFactory.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/ept/EPTFactory.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/ept/EPTFactory.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,108 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+/** Java interface "EPTFactory.java" generated from Poseidon for UML.
+ * Poseidon for UML is developed by <A
HREF="http://www.gentleware.com">Gentleware</A>.
+ * Generated with <A
HREF="http://jakarta.apache.org/velocity/">velocity</A> template
engine.
+ */
+package org.jboss.com.sun.xml.ws.pept.ept;
+
+import org.jboss.com.sun.xml.ws.pept.encoding.Decoder;
+import org.jboss.com.sun.xml.ws.pept.encoding.Encoder;
+import org.jboss.com.sun.xml.ws.pept.presentation.TargetFinder;
+import org.jboss.com.sun.xml.ws.pept.protocol.Interceptors;
+import org.jboss.com.sun.xml.ws.pept.protocol.MessageDispatcher;
+
+/**
+ * <p>
+ *
+ * @author Dr. Harold Carr
+ * </p>
+ */
+public interface EPTFactory {
+
+ ///////////////////////////////////////
+ // operations
+
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * @return a MessageDispatcher with ...
+ * </p><p>
+ * @param messageInfo ...
+ * </p>
+ */
+ public MessageDispatcher getMessageDispatcher(MessageInfo messageInfo);
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * @return a Encoder with ...
+ * </p><p>
+ * @param messageInfo ...
+ * </p>
+ */
+ public Encoder getEncoder(MessageInfo messageInfo);
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * @return a Decoder with ...
+ * </p><p>
+ * @param messageInfo ...
+ * </p>
+ */
+ public Decoder getDecoder(MessageInfo messageInfo);
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * @return a Interceptors with ...
+ * </p><p>
+ * @param x ...
+ * </p>
+ */
+ public Interceptors getInterceptors(MessageInfo x);
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * @return a TargetFinder with ...
+ * </p><p>
+ * @param x ...
+ * </p>
+ */
+ public TargetFinder getTargetFinder(MessageInfo x);
+
+} // end EPTFactory
+
+
+
+
+
+
+
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/ept/EPTFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/ept/MessageInfo.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/ept/MessageInfo.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/ept/MessageInfo.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,153 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+/** Java interface "MessageInfo.java" generated from Poseidon for UML.
+ * Poseidon for UML is developed by <A
HREF="http://www.gentleware.com">Gentleware</A>.
+ * Generated with <A
HREF="http://jakarta.apache.org/velocity/">velocity</A> template
engine.
+ */
+package org.jboss.com.sun.xml.ws.pept.ept;
+
+import org.jboss.com.sun.xml.ws.pept.encoding.Decoder;
+import org.jboss.com.sun.xml.ws.pept.encoding.Encoder;
+import org.jboss.com.sun.xml.ws.pept.presentation.MessageStruct;
+import org.jboss.com.sun.xml.ws.pept.protocol.MessageDispatcher;
+import org.jboss.com.sun.xml.ws.spi.runtime.WSConnection;
+
+/**
+ * <p>
+ *
+ * @author Dr. Harold Carr
+ * </p>
+ */
+public interface MessageInfo extends MessageStruct {
+
+ ///////////////////////////////////////
+ // operations
+
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * @return a EPTFactory with ...
+ * </p>
+ */
+ public EPTFactory getEPTFactory();
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * @return a MessageDispatcher with ...
+ * </p>
+ */
+ public MessageDispatcher getMessageDispatcher();
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * @return a Encoder with ...
+ * </p>
+ */
+ public Encoder getEncoder();
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * @return a Decoder with ...
+ * </p>
+ */
+ public Decoder getDecoder();
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * @return a Connection with ...
+ * </p>
+ */
+ public WSConnection getConnection();
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * </p><p>
+ *
+ * @param eptFactory ...
+ * </p>
+ */
+ public void setEPTFactory(EPTFactory eptFactory);
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * </p><p>
+ *
+ * @param messageDispatcher ...
+ * </p>
+ */
+ public void setMessageDispatcher(MessageDispatcher messageDispatcher);
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * </p><p>
+ *
+ * @param encoder ...
+ * </p>
+ */
+ public void setEncoder(Encoder encoder);
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * </p><p>
+ *
+ * @param decoder ...
+ * </p>
+ */
+ public void setDecoder(Decoder decoder);
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * </p><p>
+ *
+ * @param connection ...
+ * </p>
+ */
+ public void setConnection(WSConnection connection);
+
+} // end MessageInfo
+
+
+
+
+
+
+
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/ept/MessageInfo.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/presentation/MessageStruct.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/presentation/MessageStruct.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/presentation/MessageStruct.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,226 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+/** Java interface "MessageStruct.java" generated from Poseidon for UML.
+ * Poseidon for UML is developed by <A
HREF="http://www.gentleware.com">Gentleware</A>.
+ * Generated with <A
HREF="http://jakarta.apache.org/velocity/">velocity</A> template
engine.
+ */
+package org.jboss.com.sun.xml.ws.pept.presentation;
+
+import java.lang.reflect.Method;
+
+/**
+ * <p>
+ *
+ * @author Dr. Harold Carr
+ * </p>
+ */
+public interface MessageStruct {
+
+ ///////////////////////////////////////
+ //attributes
+
+
+/**
+ * <p>
+ * Represents ...
+ * </p>
+ */
+ public static final int NORMAL_RESPONSE = 0;
+
+/**
+ * <p>
+ * Represents ...
+ * </p>
+ */
+ public static final int CHECKED_EXCEPTION_RESPONSE = 1;
+
+/**
+ * <p>
+ * Represents ...
+ * </p>
+ */
+ public static final int UNCHECKED_EXCEPTION_RESPONSE = 2;
+
+/**
+ * <p>
+ * Represents ...
+ * </p>
+ */
+ public static final int REQUEST_RESPONSE_MEP = 1;
+
+/**
+ * <p>
+ * Represents ...
+ * </p>
+ */
+ public static final int ONE_WAY_MEP = 2;
+
+/**
+ * <p>
+ * Represents ...
+ * </p>
+ */
+ public static final int ASYNC_POLL_MEP = 3;
+
+/**
+ * <p>
+ * Represents ...
+ * </p>
+ */
+ public static final int ASYNC_CALLBACK_MEP = 4;
+
+ ///////////////////////////////////////
+ // operations
+
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * @param data ...
+ * </p><p>
+ *
+ * </p>
+ */
+ public void setData(Object[] data);
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * @return a Object[] with ...
+ * </p>
+ */
+ public Object[] getData();
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * </p><p>
+ *
+ * @param name ...
+ * </p><p>
+ * @param value ...
+ * </p>
+ */
+ public void setMetaData(Object name, Object value);
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * @return a Object with ...
+ * </p><p>
+ * @param name ...
+ * </p>
+ */
+ public Object getMetaData(Object name);
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * </p><p>
+ *
+ * @param messageExchangePattern ...
+ * </p>
+ */
+ public void setMEP(int messageExchangePattern);
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * @return a int with ...
+ * </p>
+ */
+ public int getMEP();
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * @return a int with ...
+ * </p>
+ */
+ public int getResponseType();
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * </p><p>
+ *
+ * @param responseType ...
+ * </p>
+ */
+ public void setResponseType(int responseType);
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * @return a Object with ...
+ * </p>
+ */
+ public Object getResponse();
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * </p><p>
+ *
+ * @param response ...
+ * </p>
+ */
+ public void setResponse(Object response);
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * </p><p>
+ *
+ * @param method ...
+ * </p>
+ */
+ public void setMethod(Method method);
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * @return a Method with ...
+ * </p>
+ */
+ public Method getMethod();
+
+} // end MessageStruct
+
+
+
+
+
+
+
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/presentation/MessageStruct.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/presentation/Stub.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/presentation/Stub.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/presentation/Stub.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,69 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+/** Java interface "Stub.java" generated from Poseidon for UML.
+ * Poseidon for UML is developed by <A
HREF="http://www.gentleware.com">Gentleware</A>.
+ * Generated with <A
HREF="http://jakarta.apache.org/velocity/">velocity</A> template
engine.
+ */
+package org.jboss.com.sun.xml.ws.pept.presentation;
+
+import org.jboss.com.sun.xml.ws.pept.Delegate;
+
+/**
+ * <p>
+ *
+ * @author Dr. Harold Carr
+ * </p>
+ */
+public interface Stub {
+
+ ///////////////////////////////////////
+ // operations
+
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * </p><p>
+ *
+ * @param delegate ...
+ * </p>
+ */
+ public void _setDelegate(Delegate delegate);
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * @return a Delegate with ...
+ * </p>
+ */
+ public Delegate _getDelegate();
+
+} // end Stub
+
+
+
+
+
+
+
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/presentation/Stub.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/presentation/TargetFinder.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/presentation/TargetFinder.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/presentation/TargetFinder.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,60 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+/** Java interface "TargetFinder.java" generated from Poseidon for UML.
+ * Poseidon for UML is developed by <A
HREF="http://www.gentleware.com">Gentleware</A>.
+ * Generated with <A
HREF="http://jakarta.apache.org/velocity/">velocity</A> template
engine.
+ */
+package org.jboss.com.sun.xml.ws.pept.presentation;
+
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+
+/**
+ * <p>
+ *
+ * @author Dr. Harold Carr
+ * </p>
+ */
+public interface TargetFinder {
+
+ ///////////////////////////////////////
+ // operations
+
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * @return a Tie with ...
+ * </p><p>
+ * @param x ...
+ * </p>
+ */
+ public Tie findTarget(MessageInfo x);
+
+} // end TargetFinder
+
+
+
+
+
+
+
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/presentation/TargetFinder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/presentation/Tie.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/presentation/Tie.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/presentation/Tie.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,80 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+/** Java interface "Tie.java" generated from Poseidon for UML.
+ * Poseidon for UML is developed by <A
HREF="http://www.gentleware.com">Gentleware</A>.
+ * Generated with <A
HREF="http://jakarta.apache.org/velocity/">velocity</A> template
engine.
+ */
+package org.jboss.com.sun.xml.ws.pept.presentation;
+
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+
+/**
+ * <p>
+ *
+ * @author Dr. Harold Carr
+ * </p>
+ */
+public interface Tie {
+
+ ///////////////////////////////////////
+ // operations
+
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * </p><p>
+ *
+ * @param servant ...
+ * </p>
+ */
+ public void _setServant(Object servant);
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * @return a Object with ...
+ * </p>
+ */
+ public Object _getServant();
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * </p><p>
+ *
+ * @param messageInfo ...
+ * </p>
+ */
+ public void _invoke(MessageInfo messageInfo);
+
+} // end Tie
+
+
+
+
+
+
+
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/presentation/Tie.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/protocol/Interceptors.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/protocol/Interceptors.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/protocol/Interceptors.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,60 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+/** Java interface "Interceptors.java" generated from Poseidon for UML.
+ * Poseidon for UML is developed by <A
HREF="http://www.gentleware.com">Gentleware</A>.
+ * Generated with <A
HREF="http://jakarta.apache.org/velocity/">velocity</A> template
engine.
+ */
+package org.jboss.com.sun.xml.ws.pept.protocol;
+
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+
+/**
+ * <p>
+ *
+ * @author Dr. Harold Carr
+ * </p>
+ */
+public interface Interceptors {
+
+ ///////////////////////////////////////
+ // operations
+
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * </p><p>
+ *
+ * @param messageInfo ...
+ * </p>
+ */
+ public void interceptMessage(MessageInfo messageInfo);
+
+} // end Interceptors
+
+
+
+
+
+
+
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/protocol/Interceptors.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/protocol/MessageDispatcher.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/protocol/MessageDispatcher.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/protocol/MessageDispatcher.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,71 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+/** Java interface "MessageDispatcher.java" generated from Poseidon for UML.
+ * Poseidon for UML is developed by <A
HREF="http://www.gentleware.com">Gentleware</A>.
+ * Generated with <A
HREF="http://jakarta.apache.org/velocity/">velocity</A> template
engine.
+ */
+package org.jboss.com.sun.xml.ws.pept.protocol;
+
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+
+/**
+ * <p>
+ *
+ * @author Dr. Harold Carr
+ * </p>
+ */
+public interface MessageDispatcher {
+
+ ///////////////////////////////////////
+ // operations
+
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * </p><p>
+ *
+ * @param messageInfo ...
+ * </p>
+ */
+ public void send(MessageInfo messageInfo);
+/**
+ * <p>
+ * Does ...
+ * </p><p>
+ *
+ * </p><p>
+ *
+ * @param messageInfo ...
+ * </p>
+ */
+ public void receive(MessageInfo messageInfo);
+
+} // end MessageDispatcher
+
+
+
+
+
+
+
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/pept/protocol/MessageDispatcher.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/soap/client/SOAPMessageDispatcher.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/soap/client/SOAPMessageDispatcher.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/soap/client/SOAPMessageDispatcher.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,1012 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.protocol.soap.client;
+
+import org.jboss.com.sun.xml.messaging.saaj.soap.MessageImpl;
+import javax.activation.DataHandler;
+import javax.xml.bind.JAXBException;
+import javax.xml.namespace.QName;
+import javax.xml.soap.MimeHeader;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFactory;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.soap.SOAPPart;
+import javax.xml.transform.Source;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.ws.Binding;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.ProtocolException;
+import javax.xml.ws.Service;
+import javax.xml.ws.Response;
+import javax.xml.ws.WebServiceException;
+import static javax.xml.ws.BindingProvider.PASSWORD_PROPERTY;
+import static javax.xml.ws.BindingProvider.USERNAME_PROPERTY;
+import static org.jboss.com.sun.xml.ws.client.BindingProviderProperties.*;
+
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+import javax.xml.ws.soap.SOAPBinding;
+import javax.xml.ws.soap.SOAPFaultException;
+
+import org.jboss.com.sun.xml.ws.binding.BindingImpl;
+import org.jboss.com.sun.xml.ws.client.AsyncHandlerService;
+import org.jboss.com.sun.xml.ws.client.BindingProviderProperties;
+import org.jboss.com.sun.xml.ws.client.ContextMap;
+import org.jboss.com.sun.xml.ws.client.EndpointIFContext;
+import org.jboss.com.sun.xml.ws.client.EndpointIFInvocationHandler;
+import org.jboss.com.sun.xml.ws.client.RequestContext;
+import org.jboss.com.sun.xml.ws.client.ResponseContext;
+import org.jboss.com.sun.xml.ws.client.WSFuture;
+import org.jboss.com.sun.xml.ws.client.dispatch.DispatchContext;
+import org.jboss.com.sun.xml.ws.client.dispatch.ResponseImpl;
+import org.jboss.com.sun.xml.ws.encoding.JAXWSAttachmentMarshaller;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPEncoder;
+import org.jboss.com.sun.xml.ws.encoding.soap.client.SOAP12XMLEncoder;
+import org.jboss.com.sun.xml.ws.encoding.soap.client.SOAPXMLDecoder;
+import org.jboss.com.sun.xml.ws.encoding.soap.client.SOAPXMLEncoder;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.InternalMessage;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.MessageInfoBase;
+import org.jboss.com.sun.xml.ws.encoding.soap.message.SOAPFaultInfo;
+import org.jboss.com.sun.xml.ws.handler.HandlerChainCaller;
+import org.jboss.com.sun.xml.ws.handler.MessageContextUtil;
+import org.jboss.com.sun.xml.ws.handler.SOAPHandlerContext;
+import org.jboss.com.sun.xml.ws.handler.HandlerChainCaller.Direction;
+import org.jboss.com.sun.xml.ws.handler.HandlerChainCaller.RequestOrResponse;
+import org.jboss.com.sun.xml.ws.model.JavaMethod;
+import org.jboss.com.sun.xml.ws.model.RuntimeModel;
+import org.jboss.com.sun.xml.ws.pept.ept.EPTFactory;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.pept.presentation.MessageStruct;
+import org.jboss.com.sun.xml.ws.pept.protocol.MessageDispatcher;
+import org.jboss.com.sun.xml.ws.server.RuntimeContext;
+import org.jboss.com.sun.xml.ws.spi.runtime.ClientTransportFactory;
+import org.jboss.com.sun.xml.ws.spi.runtime.SystemHandlerDelegate;
+import org.jboss.com.sun.xml.ws.spi.runtime.WSConnection;
+import org.jboss.com.sun.xml.ws.transport.http.client.HttpClientTransportFactory;
+import org.jboss.com.sun.xml.ws.util.Base64Util;
+import org.jboss.com.sun.xml.ws.util.FastInfosetUtil;
+import org.jboss.com.sun.xml.ws.util.MessageInfoUtil;
+import org.jboss.com.sun.xml.ws.util.SOAPConnectionUtil;
+import org.jboss.com.sun.xml.ws.util.xml.XmlUtil;
+import org.jboss.com.sun.xml.ws.wsdl.parser.BindingOperation;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.lang.reflect.Proxy;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Callable;
+import java.util.concurrent.FutureTask;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ThreadFactory;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+
+/**
+ * Client-side SOAP protocol-specific {@link com.sun.pept.protocol.MessageDispatcher}
+ *
+ * @author WS Development Team
+ */
+public class SOAPMessageDispatcher implements MessageDispatcher {
+
+ protected static final int MAX_THREAD_POOL_SIZE = 3;
+
+ protected static final long AWAIT_TERMINATION_TIME = 10L;
+
+ protected ExecutorService executorService;
+
+ private final static String MUST_UNDERSTAND_FAULT_MESSAGE_STRING = "SOAP must
understand error";
+
+ /**
+ * Default constructor
+ */
+ public SOAPMessageDispatcher() {
+ }
+
+ /*
+ * Invokes doSendAsync method if the message exchange pattern is asynchronous,
otherwise
+ * invokes doSend method.
+ *
+ * @see com.sun.pept.protocol.MessageDispatcher#send(com.sun.pept.ept.MessageInfo)
+ */
+ public void send(MessageInfo messageInfo) {
+ if (isAsync(messageInfo)) {
+ doSendAsync(messageInfo);
+ } else {
+ doSend(messageInfo);
+ }
+ }
+
+ /**
+ * Orchestrates the sending of a synchronous request
+ */
+ protected SOAPMessage doSend(MessageInfo messageInfo) {
+ //change from LogicalEPTFactory to ContactInfoBase - should be changed back when
we have things working
+ EPTFactory contactInfo = messageInfo.getEPTFactory();
+ SOAPXMLEncoder encoder = (SOAPXMLEncoder) contactInfo.getEncoder(messageInfo);
+ SOAPMessage sm = null;
+ boolean handlerResult = true;
+ boolean isRequestResponse = (messageInfo.getMEP() ==
MessageStruct.REQUEST_RESPONSE_MEP);
+
+ try {
+ if (messageInfo.getMetaData(DispatchContext.DISPATCH_MESSAGE_MODE) ==
Service.Mode.MESSAGE)
+ {
+ sm = (SOAPMessage) messageInfo.getData()[0];
+ // Ensure supplied message is encoded according to conneg
+ FastInfosetUtil.ensureCorrectEncoding(messageInfo, sm);
+ }
+
+ SOAPHandlerContext handlerContext = null;
+ InternalMessage im = encoder.toInternalMessage(messageInfo);
+
+ HandlerChainCaller caller = getHandlerChainCaller(messageInfo);
+ if (caller.hasHandlers()) {
+ im = preHandlerOutboundHook(sm, im);
+ handlerContext = new SOAPHandlerContext(messageInfo, im, sm);
+
+ //this is needed so that attachments are compied from
RESPONSE_MESSAGE_ATTACHMEMTN PROPERTY
+ handlerContext.getMessageContext().put(
+ MessageContext.MESSAGE_OUTBOUND_PROPERTY, Boolean.TRUE);
+
+ encoder.setAttachmentsMap(messageInfo, im);
+ updateMessageContext(messageInfo, handlerContext);
+
+ //now that the MESSAGE_OUTBOUND_PROPERTY is set so populate the
attachemnts
+ handlerContext.populateAttachmentMap();
+
+ JAXWSAttachmentMarshaller am =
MessageInfoUtil.getAttachmentMarshaller(messageInfo);
+ boolean isXopped = false;
+ //there are handlers so disable Xop encoding if enabled, so that they
dont
+ // see xop:Include reference
+ if ((am != null) && am.isXOPPackage()) {
+ isXopped = am.isXOPPackage();
+ am.setXOPPackage(false);
+ }
+ handlerResult = callHandlersOnRequest(handlerContext);
+ // now put back the old value
+ if ((am != null)) {
+ am.setXOPPackage(isXopped);
+ }
+
+ sm = handlerContext.getSOAPMessage();
+ postHandlerOutboundHook(messageInfo, handlerContext, sm);
+ if (sm == null) {
+ sm = encoder.toSOAPMessage(handlerContext.getInternalMessage(),
messageInfo);
+ }
+
+ // the only case where no message is sent
+ if (isRequestResponse && !handlerResult) {
+ SOAPXMLDecoder decoder = (SOAPXMLDecoder)
contactInfo.getDecoder(messageInfo);
+ im = decoder.toInternalMessage(sm, messageInfo);
+ decoder.toMessageInfo(im, messageInfo);
+ return sm;
+ }
+ }
+
+ // Setting encoder here is necessary for calls to getBindingId()
+ messageInfo.setEncoder(encoder);
+
+ SystemHandlerDelegate systemHandlerDelegate =
+ ((org.jboss.com.sun.xml.ws.spi.runtime.Binding)
getBinding(messageInfo)).
+ getSystemHandlerDelegate();
+ if (systemHandlerDelegate != null) {
+ if (handlerContext == null) {
+ handlerContext = new SOAPHandlerContext(messageInfo, im, sm);
+ //this is needed so that attachments are compied from
RESPONSE_MESSAGE_ATTACHMEMTN PROPERTY
+ handlerContext.getMessageContext().put(
+ MessageContext.MESSAGE_OUTBOUND_PROPERTY, Boolean.TRUE);
+
+ //now that the MESSAGE_OUTBOUND_PROPERTY is set so populate the
attachemnts
+ handlerContext.populateAttachmentMap();
+
+ updateMessageContext(messageInfo, handlerContext);
+ }
+
+ encoder.setAttachmentsMap(messageInfo, im);
+ //already used im, we can set that to null
+ if ((sm != null) && (im != null))
+ handlerContext.setInternalMessage(null);
+
+
+ handlerContext.getBindingId();
+ systemHandlerDelegate.processRequest(
+ handlerContext.getSHDSOAPMessageContext());
+ sm = handlerContext.getSOAPMessage();
+ }
+
+ if (sm == null){
+ sm = encoder.toSOAPMessage(im, messageInfo);
+ if (handlerContext == null)
+ handlerContext = new SOAPHandlerContext(messageInfo, im, sm);
+ updateMessageContext(messageInfo, handlerContext);
+ }
+
+
+ Map<String, Object> context = processMetadata(messageInfo, sm);
+
+ setConnection(messageInfo, context);
+
+ if (!isAsync(messageInfo)) {
+ WSConnection connection = (WSConnection) messageInfo.getConnection();
+
+ logRequestMessage(sm, messageInfo);
+ SOAPConnectionUtil.sendResponse(connection, sm);
+ }
+
+ if (isRequestResponse) {
+ receive(messageInfo);
+ } else if (isOneway(messageInfo)) {
+ checkReturnStatus(messageInfo);
+ }
+ } catch (WebServiceException wse) {
+ setResponseType(wse, messageInfo);
+ messageInfo.setResponse(wse);
+ } catch (Throwable e) {
+ RuntimeException ex = (RuntimeException) e;
+ setResponseType(ex, messageInfo);
+ messageInfo.setResponse(ex);
+ }
+ return sm;
+ }
+
+
+ private boolean isOneway(MessageInfo messageInfo) {
+ return messageInfo.getMEP() == MessageStruct.ONE_WAY_MEP ? true : false;
+ }
+
+ /**
+ * Process and classify the metadata in MIME headers or message context.
<String,String> data
+ * is copied into MIME headers and the remaining metadata is passed in message
context to the
+ * transport layer.
+ *
+ * @param messageInfo
+ * @param soapMessage
+ */
+ protected Map<String, Object> processMetadata(MessageInfo messageInfo,
SOAPMessage soapMessage) {
+ Map<String, Object> messageContext = new HashMap<String, Object>();
+ List<String> header = new ArrayList<String>();
+
+ ContextMap properties = (ContextMap)
messageInfo.getMetaData(JAXWS_CONTEXT_PROPERTY);
+
+ if (messageInfo.getMEP() == MessageStruct.ONE_WAY_MEP)
+ messageContext.put(ONE_WAY_OPERATION, "true");
+
+ String soapAction = null;
+ boolean useSoapAction = false;
+
+ // process the properties
+ if (properties != null) {
+ for (Iterator names = properties.getPropertyNames(); names.hasNext();)
+ {
+ String propName = (String) names.next();
+
+ // consume PEPT-specific properties
+ if (propName.equals(ClientTransportFactory.class.getName())) {
+ messageContext.put(CLIENT_TRANSPORT_FACTORY, (ClientTransportFactory)
properties.get(propName));
+ } else if (propName.equals(USERNAME_PROPERTY)) {
+ String credentials = (String) properties.get(USERNAME_PROPERTY);
+ if (credentials != null) {
+ credentials += ":";
+ String password = (String) properties.get(PASSWORD_PROPERTY);
+ if (password != null)
+ credentials += password;
+
+ try {
+ credentials = Base64Util.encode(credentials.getBytes());
+ } catch (Exception ex) {
+ throw new WebServiceException(ex);
+ }
+ soapMessage.getMimeHeaders().addHeader("Authorization",
"Basic " + credentials);
+ }
+ } else
+ if (propName.equals(BindingProvider.SOAPACTION_USE_PROPERTY)) {
+ useSoapAction = ((Boolean)
+
properties.get(BindingProvider.SOAPACTION_USE_PROPERTY)).booleanValue();
+ if (useSoapAction)
+ soapAction = (String)
+ properties.get(BindingProvider.SOAPACTION_URI_PROPERTY);
+ } else {
+ messageContext.put(propName, properties.get(propName));
+ }
+ }
+ }
+
+ // Set accept header depending on content negotiation property
+ String contentNegotiation = (String)
messageInfo.getMetaData(CONTENT_NEGOTIATION_PROPERTY);
+
+ String bindingId = getBindingId(messageInfo);
+ if (bindingId.equals(SOAPBinding.SOAP12HTTP_BINDING) ||
bindingId.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING))
+ {
+ soapMessage.getMimeHeaders().setHeader(ACCEPT_PROPERTY,
+ contentNegotiation != "none" ? SOAP12_XML_FI_ACCEPT_VALUE :
SOAP12_XML_ACCEPT_VALUE);
+ } else {
+ soapMessage.getMimeHeaders().setHeader(ACCEPT_PROPERTY,
+ contentNegotiation != "none" ? XML_FI_ACCEPT_VALUE :
XML_ACCEPT_VALUE);
+ }
+
+ messageContext.put(BINDING_ID_PROPERTY, bindingId);
+
+ // SOAPAction: MIME header
+ RuntimeContext runtimeContext = (RuntimeContext)
messageInfo.getMetaData(JAXWS_RUNTIME_CONTEXT);
+ if (runtimeContext != null) {
+ JavaMethod javaMethod =
runtimeContext.getModel().getJavaMethod(messageInfo.getMethod());
+ if (javaMethod != null) {
+ soapAction = ((org.jboss.com.sun.xml.ws.model.soap.SOAPBinding)
javaMethod.getBinding()).getSOAPAction();
+ header.clear();
+ if (bindingId.equals(SOAPBinding.SOAP12HTTP_BINDING) ||
bindingId.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING))
+ {
+ if ((soapAction != null) && (soapAction.length() > 0)) {
+ ((MessageImpl) soapMessage).setAction(soapAction);
+ }
+ } else {
+ if (soapAction == null) {
+ soapMessage.getMimeHeaders().addHeader("SOAPAction",
"\"\"");
+ } else {
+ soapMessage.getMimeHeaders().addHeader("SOAPAction",
"\"" + soapAction + "\"");
+ }
+ }
+ }
+ } else
+ if (messageInfo.getMetaData(BindingProviderProperties.DISPATCH_CONTEXT) != null)
+ {
+ //bug fix 6344358
+ header.clear();
+ if (bindingId.equals(SOAPBinding.SOAP12HTTP_BINDING) ||
bindingId.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING))
+ {
+ if ((soapAction != null) && (soapAction.length() > 0)) {
+ ((MessageImpl) soapMessage).setAction(soapAction);
+ }
+ } else {
+ if (soapAction == null) {
+ soapMessage.getMimeHeaders().addHeader("SOAPAction",
"\"\"");
+ } else {
+ soapMessage.getMimeHeaders().addHeader("SOAPAction",
"\"" + soapAction + "\"");
+ }
+ }
+ }
+
+ return messageContext;
+ }
+
+ protected void setConnection(MessageInfo messageInfo, Map<String, Object>
context) {
+ ClientTransportFactory clientTransportFactory = (ClientTransportFactory)
context.get(CLIENT_TRANSPORT_FACTORY);
+ WSConnection connection = null;
+ if (clientTransportFactory == null) {
+ clientTransportFactory = new HttpClientTransportFactory();
+ context.put(CLIENT_TRANSPORT_FACTORY, clientTransportFactory);
+ }
+ connection = clientTransportFactory.create(context);
+ messageInfo.setConnection(connection);
+ }
+
+ protected void setResponseType(Throwable e, MessageInfo messageInfo) {
+ if (e instanceof RuntimeException) {
+ messageInfo.setResponseType(MessageStruct.UNCHECKED_EXCEPTION_RESPONSE);
+ } else {
+ messageInfo.setResponseType(MessageStruct.CHECKED_EXCEPTION_RESPONSE);
+ }
+ messageInfo.setResponse(e);
+ }
+
+ public void checkReturnStatus(MessageInfo messageInfo) {
+ WSConnection connection = (WSConnection) messageInfo.getConnection();
+ Map<String, List<String>> headers = connection.getHeaders();
+ if (connection.getStatus() != 202 && connection.getStatus() != 200) {
+ Logger.getAnonymousLogger().log(Level.SEVERE, "HTTP status code for
oneway: expected 202 or 200, got " + connection.getStatus());
+// System.out.println("status: "+connection.getStatus());
+ }
+ }
+
+ /*
+ * Orchestrates the receiving of a synchronous response
+ *
+ * @see com.sun.pept.protocol.MessageDispatcher#receive(com.sun.pept.ept.MessageInfo)
+ *
+ * todo: exception handling with possible saaj error below
+ */
+ public void receive(MessageInfo messageInfo) {
+ // change from LogicalEPTFactory to ContactInfoBase - should be changed back when
we have things working
+ EPTFactory contactInfo = messageInfo.getEPTFactory();
+ //LogicalEPTFactory contactInfo = (LogicalEPTFactory)
messageInfo.getEPTFactory();
+
+ SOAPXMLDecoder decoder = (SOAPXMLDecoder) contactInfo.getDecoder(messageInfo);
+
+
+ SOAPMessage sm = null;
+ try {
+ sm = decoder.toSOAPMessage(messageInfo);
+ } catch (RuntimeException e) {
+ //if there is a transport error HTTP status code and response Headers
+ //need to be populated into messageContext and requestContext
+ //bug 6373688
+ setContexts(messageInfo, sm);
+ throw e;
+ }
+ // Content negotiation logic
+ String contentNegotiationType = (String)
messageInfo.getMetaData(CONTENT_NEGOTIATION_PROPERTY);
+ // If XML request
+ if (contentNegotiationType == "pessimistic") {
+ try {
+ if (((org.jboss.com.sun.xml.messaging.saaj.soap.MessageImpl)
sm).isFastInfoset())
+ {
+ Map requestContext = (Map)
messageInfo.getMetaData(JAXWS_CONTEXT_PROPERTY);
+ // Further requests will be send using FI
+ requestContext.put(CONTENT_NEGOTIATION_PROPERTY,
"optimistic");
+ }
+ }
+ catch (ClassCastException e) {
+ // Content negotiation fails
+ }
+ }
+
+ try {
+ logResponseMessage(sm, messageInfo);
+ } catch (Exception ex) {
+ throw new RuntimeException(ex);
+ }
+ SOAPHandlerContext handlerContext = getInboundHandlerContext(messageInfo, sm);
+ WSConnection con = (WSConnection) messageInfo.getConnection();
+ MessageContextUtil.setHttpStatusCode(handlerContext.getMessageContext(),
+ con.getStatus());
+ MessageContextUtil.setHttpResponseHeaders(handlerContext.getMessageContext(),
+ con.getHeaders());
+
+ //set the handlerContext to RuntimeContext
+ RuntimeContext rtContext = MessageInfoUtil.getRuntimeContext(messageInfo);
+ if (rtContext != null)
+ rtContext.setHandlerContext(handlerContext);
+
+ handlerContext.getMessageContext().put(
+ MessageContext.MESSAGE_OUTBOUND_PROPERTY, Boolean.FALSE);
+ //set MESSAGE_ATTACHMENTS property
+ MessageContext msgCtxt = MessageInfoUtil.getMessageContext(messageInfo);
+ if (msgCtxt != null) {
+ try {
+ //clear the attMap on this messageContext, its from request
+ Map<String, DataHandler> attMap = (Map<String, DataHandler>)
msgCtxt.get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);
+ if (attMap != null)
+ attMap.clear();
+ MessageContextUtil.copyInboundMessageAttachments(msgCtxt,
sm.getAttachments());
+ } catch (SOAPException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ SystemHandlerDelegate systemHandlerDelegate =
+ ((org.jboss.com.sun.xml.ws.spi.runtime.Binding) getBinding(messageInfo)).
+ getSystemHandlerDelegate();
+ if (systemHandlerDelegate != null) {
+// handlerContext.getMessageContext().put(
+// MessageContext.MESSAGE_OUTBOUND_PROPERTY, Boolean.FALSE);
+ try {
+
systemHandlerDelegate.processResponse(handlerContext.getSHDSOAPMessageContext());
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ try {
+ MessageInfoUtil.setHandlerChainCaller(messageInfo,
+ getHandlerChainCaller(messageInfo));
+ decoder.doMustUnderstandProcessing(sm, messageInfo, handlerContext, false);
+ } catch (SOAPException se) { // unusual saaj error
+ throw new RuntimeException(se);
+ } catch (IOException ie) { // unusual saaj error
+ throw new RuntimeException(ie);
+ } catch (SOAPFaultException sfe) {
+ closeAllHandlers(handlerContext);
+ throw sfe;
+ }
+
+ HandlerChainCaller caller = getHandlerChainCaller(messageInfo);
+ if (caller.hasHandlers()) {
+ callHandlersOnResponse(handlerContext);
+ postHandlerInboundHook(messageInfo, handlerContext, sm);
+ }
+
+ SOAPXMLEncoder encoder = (SOAPXMLEncoder) contactInfo.getEncoder(messageInfo);
+
+ InternalMessage im = handlerContext.getInternalMessage();
+ if (messageInfo.getMetaData(DispatchContext.DISPATCH_MESSAGE_MODE) ==
Service.Mode.MESSAGE)
+ im = null;
+ if (im == null) {
+ im = decoder.toInternalMessage(sm, messageInfo);
+ } else {
+ im = decoder.toInternalMessage(sm, im, messageInfo);
+ }
+ decoder.toMessageInfo(im, messageInfo);
+ updateResponseContext(messageInfo, handlerContext);
+ if (messageInfo.getMetaData(DispatchContext.DISPATCH_MESSAGE_MODE) ==
Service.Mode.MESSAGE)
+ {
+ messageInfo.setResponse(sm);
+ postReceiveAndDecodeHook(messageInfo);
+ }
+ }
+
+ private void setContexts(MessageInfo messageInfo, SOAPMessage sm) {
+ WSConnection con = (WSConnection) messageInfo.getConnection();
+ SOAPHandlerContext handlerContext = getInboundHandlerContext(messageInfo, sm);
+ MessageContextUtil.setHttpStatusCode(handlerContext.getMessageContext(),
+ con.getStatus());
+ updateResponseContext(messageInfo, handlerContext);
+ }
+
+
+ private SOAPHandlerContext getInboundHandlerContext(MessageInfo messageInfo,
SOAPMessage sm) {
+ SOAPHandlerContext handlerContext = (SOAPHandlerContext) messageInfo
+ .getMetaData(BindingProviderProperties.JAXWS_HANDLER_CONTEXT_PROPERTY);
+ if (handlerContext != null) {
+ handlerContext.setSOAPMessage(sm);
+ handlerContext.setInternalMessage(null);
+ } else
+ handlerContext = new SOAPHandlerContext(messageInfo, null, sm);
+ return handlerContext;
+ }
+
+ /**
+ * Orchestrates the sending of an asynchronous request
+ */
+ protected void doSendAsync(final MessageInfo messageInfo) {
+ try { // should have already been caught
+ preSendHook(messageInfo);
+ SOAPMessage sm = doSend(messageInfo);
+ postSendHook(messageInfo);
+
+ //pass a copy of MessageInfo to the future task,so that no conflicts
+ //due to threading happens
+ Response r = sendAsyncReceive(MessageInfoBase.copy(messageInfo), sm);
+ if (executorService == null) {
+ executorService =
+ Executors.newFixedThreadPool(MAX_THREAD_POOL_SIZE, new
DaemonThreadFactory());
+ }
+
+ AsyncHandlerService service = (AsyncHandlerService) messageInfo
+ .getMetaData(BindingProviderProperties.JAXWS_CLIENT_ASYNC_HANDLER);
+ WSFuture wsfuture = null;
+ if (service != null) {
+ wsfuture = service.setupAsyncCallback(r);
+ ((ResponseImpl) r).setUID(service.getUID());
+ ((ResponseImpl) r).setHandlerService(service);
+ }
+
+ executorService.execute((FutureTask) r);
+ if (service == null)
+ messageInfo.setResponse(r);
+ else
+ messageInfo.setResponse(wsfuture);
+ } catch (Throwable e) {
+ messageInfo.setResponse(e);
+ }
+ }
+
+ /**
+ * Orchestrates the receiving of an asynchronous response
+ */
+ protected Response<Object> sendAsyncReceive(final MessageInfo messageInfo,
final SOAPMessage sm) {
+
+ final AsyncHandlerService handler = (AsyncHandlerService) messageInfo
+ .getMetaData(BindingProviderProperties.JAXWS_CLIENT_ASYNC_HANDLER);
+ final boolean callback = (messageInfo.getMEP() ==
MessageStruct.ASYNC_CALLBACK_MEP) ? true
+ : false;
+ if (callback && (handler == null))
+ throw new WebServiceException("Asynchronous callback invocation, but no
handler - AsyncHandler required");
+
+ final Response r = new ResponseImpl<Object>(new Callable<Object>() {
+
+ public Object call() throws Exception {
+ // get connection and do http.invoke()
+ try {
+ final WSConnection connection = (WSConnection)
messageInfo.getConnection();
+ logRequestMessage(sm, messageInfo);
+ SOAPConnectionUtil.sendResponse(connection, sm);
+ } catch (Throwable t) {
+ messageInfo.setResponse(t);
+
messageInfo.setResponseType(MessageStruct.UNCHECKED_EXCEPTION_RESPONSE);
+ }
+ // receive response
+ preReceiveHook(messageInfo);
+ try {
+ receive(messageInfo);
+ } catch (Exception ex) {
+ messageInfo.setResponse(ex);
+ }
+ postReceiveHook(messageInfo);
+
+ if (messageInfo.getResponse() instanceof Exception)
+ throw (Exception) messageInfo.getResponse();
+ return messageInfo.getResponse();
+ }
+ });
+ messageInfo.setMetaData(JAXWS_CLIENT_ASYNC_RESPONSE_CONTEXT, r);
+ return r;
+ }
+
+
+ protected boolean callHandlersOnRequest(SOAPHandlerContext handlerContext) {
+ try {
+ HandlerChainCaller caller =
getHandlerChainCaller(handlerContext.getMessageInfo());
+ boolean responseExpected = (handlerContext.getMessageInfo().getMEP() !=
MessageStruct.ONE_WAY_MEP);
+ return caller.callHandlers(Direction.OUTBOUND, RequestOrResponse.REQUEST,
handlerContext,
+ responseExpected);
+ } catch (ProtocolException pe) {
+ if (MessageContextUtil.ignoreFaultInMessage(
+ handlerContext.getMessageContext())) {
+ // Ignore fault in this case and use exception.
+ throw pe;
+ } else
+ return false;
+ } catch (WebServiceException wse) {
+ throw wse;
+ } catch (RuntimeException re) {
+ // handlers are expected to be able to throw RE
+ throw new WebServiceException(re);
+ }
+ }
+
+ /*
+ * User's handler can throw RuntimeExceptions
+ * (e.g., a ProtocolException).
+ * Need to wrap any RuntimeException (other than WebServiceException) in
+ * WebServiceException.
+ */
+ protected boolean callHandlersOnResponse(SOAPHandlerContext handlerContext) {
+ HandlerChainCaller caller =
+ getHandlerChainCaller(handlerContext.getMessageInfo());
+ try {
+ int httpResponseCode = (Integer) handlerContext.getMessageContext().get(
+ MessageContext.HTTP_RESPONSE_CODE);
+ if(httpResponseCode != 200 && httpResponseCode != 202) {
+ //Check if it is a fault message
+ SOAPMessage sm = handlerContext.getSOAPMessage();
+ if((sm != null) && sm.getSOAPBody().hasFault())
+ return caller.callHandleFaultOnClient(handlerContext);
+ }
+
+ return caller.callHandlers(Direction.INBOUND,
+ RequestOrResponse.RESPONSE, handlerContext, false);
+ } catch (SOAPException se) {
+ throw new WebServiceException(se);
+ } catch (WebServiceException wse) {
+ throw wse;
+ } catch (RuntimeException re) {
+ // handlers are expected to be able to throw RE
+ throw new WebServiceException(re);
+ }
+ }
+
+ protected Binding getBinding(MessageInfo messageInfo) {
+ ContextMap context = (ContextMap) ((MessageInfoBase) messageInfo)
+ .getMetaData(BindingProviderProperties.JAXWS_CONTEXT_PROPERTY);
+ BindingProvider provider = (BindingProvider) context
+ .get(JAXWS_CLIENT_HANDLE_PROPERTY);
+ return provider.getBinding();
+ }
+
+ protected HandlerChainCaller getHandlerChainCaller(MessageInfo messageInfo) {
+ BindingImpl binding = (BindingImpl) getBinding(messageInfo);
+ return binding.getHandlerChainCaller();
+ }
+
+ private void updateSOAPMessage(Object value, SOAPMessage sm) {
+ try {
+ if (value instanceof Source) {
+ SOAPBody sb = sm.getSOAPPart().getEnvelope().getBody();
+ sb.removeContents();
+ XmlUtil.newTransformer().transform((Source) value, new DOMResult(sb));
+ sm.saveChanges();
+ }
+ } catch (SOAPException e) {
+ throw new RuntimeException(e);
+ } catch (TransformerException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+
+ protected void updateMessageContext(MessageInfo messageInfo, SOAPHandlerContext
context) {
+ SOAPMessageContext messageContext = context.getSOAPMessageContext();
+ messageInfo.setMetaData(BindingProviderProperties.JAXWS_HANDLER_CONTEXT_PROPERTY,
context);
+ RequestContext ctxt = (RequestContext) messageInfo
+ .getMetaData(BindingProviderProperties.JAXWS_CONTEXT_PROPERTY);
+ Iterator i = ctxt.copy().getPropertyNames();
+ while (i.hasNext()) {
+ String name = (String) i.next();
+ Object value = ctxt.get(name);
+ messageContext.put(name, value);
+ }
+
+ BindingProvider provider = (BindingProvider) context.getMessageContext()
+ .get(JAXWS_CLIENT_HANDLE_PROPERTY);
+
+ QName portTypeQName = null;
+ if (provider != null) {
+ if (Proxy.isProxyClass(provider.getClass())) {
+
+ EndpointIFInvocationHandler invocationHandler =
(EndpointIFInvocationHandler) Proxy.getInvocationHandler(provider);
+ EndpointIFContext endpointContext =
invocationHandler.getEndpointContext();
+ portTypeQName = invocationHandler.getWSDLPortTypeQName();
+
+ messageContext.put(MessageContext.WSDL_SERVICE,
invocationHandler.getServiceQName());
+ messageContext.put(MessageContext.WSDL_PORT,
endpointContext.getPortName());
+
+ context.setBindingId(endpointContext.getBindingID().toString());
+
+ RuntimeContext rtContext = (RuntimeContext)
messageInfo.getMetaData(BindingProviderProperties.JAXWS_RUNTIME_CONTEXT);
+ if (rtContext != null) { //should never be
+ RuntimeModel model = rtContext.getModel();
+ JavaMethod javaMethod =
model.getJavaMethod(messageInfo.getMethod());
+ String opname = javaMethod.getOperationName();
+ if (portTypeQName != null) {
+ String tns = portTypeQName.getNamespaceURI();
+ messageContext.put(MessageContext.WSDL_OPERATION, new
QName(tns,opname));
+ }
+ }
+ //set handlerContext
+ rtContext.setHandlerContext(context);
+ }
+ }
+
+ //now get value for ContentNegotiation
+ Object prop = messageInfo.getMetaData(CONTENT_NEGOTIATION_PROPERTY);
+ if (prop != null) {
+ messageContext.put(CONTENT_NEGOTIATION_PROPERTY, prop);
+ }
+ }
+
+ protected void updateResponseContext(MessageInfo messageInfo,
+ SOAPHandlerContext context) {
+ SOAPMessageContext messageContext = context.getSOAPMessageContext();
+ RequestContext rc = (RequestContext)
messageInfo.getMetaData(JAXWS_CONTEXT_PROPERTY);
+ BindingProvider provider = (BindingProvider)
rc.get(JAXWS_CLIENT_HANDLE_PROPERTY);
+ ResponseContext responseContext = new ResponseContext(provider);
+ for (String name : messageContext.keySet()) {
+ MessageContext.Scope scope = messageContext.getScope(name);
+ if (MessageContext.Scope.APPLICATION == scope) {
+ Object value = messageContext.get(name);
+ responseContext.put(name, value);
+ }
+ }
+ ResponseImpl asyncResponse = (ResponseImpl) messageInfo.getMetaData(
+ JAXWS_CLIENT_ASYNC_RESPONSE_CONTEXT);
+ if (asyncResponse != null) {
+ asyncResponse.setResponseContext(responseContext.copy());
+ } else {
+ messageInfo.setMetaData(JAXWS_RESPONSE_CONTEXT_PROPERTY,
+ responseContext.copy());
+ }
+ }
+
+ /**
+ * @return true if message exchange pattern indicates asynchronous, otherwise returns
false
+ */
+ protected boolean isAsync(MessageInfo messageInfo) {
+ if ((messageInfo.getMEP() == MessageStruct.ASYNC_POLL_MEP)
+ || (messageInfo.getMEP() == MessageStruct.ASYNC_CALLBACK_MEP)) {
+ return true;
+ }
+ return false;
+ }
+
+ private void preSendHook(MessageInfo messageInfo) {
+ }
+
+ private void preReceiveHook(MessageInfo messageInfo) {
+ }
+
+ private void postSendHook(MessageInfo messageInfo) {
+ if (messageInfo.getResponseType() != MessageStruct.NORMAL_RESPONSE) {
+ postReceiveHook(messageInfo);
+ throw (WebServiceException) messageInfo.getResponse();
+ }
+ }
+
+ private void postReceiveAndDecodeHook(MessageInfo messageInfo) {
+ DispatchContext dispatchContext = (DispatchContext) messageInfo
+ .getMetaData(BindingProviderProperties.DISPATCH_CONTEXT);
+ if ((messageInfo.getMetaData(DispatchContext.DISPATCH_MESSAGE_MODE) ==
Service.Mode.MESSAGE)
+ && (dispatchContext.getProperty(DispatchContext.DISPATCH_MESSAGE) ==
DispatchContext.MessageType.SOURCE_MESSAGE))
+ {
+ Object response = messageInfo.getResponse();
+ if (response instanceof SOAPMessage) {
+ SOAPPart part = ((SOAPMessage) response).getSOAPPart();
+ try {
+ messageInfo.setResponse(part.getContent());
+ } catch (SOAPException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+ }
+
+ private void postReceiveHook(MessageInfo messageInfo) {
+ // postReceiveHook exaimines the result for an exception
+ // or SOAPFaultInfo - it will set appropriate
+ // asynchronous exceptions
+ Object response = messageInfo.getResponse();
+ switch (messageInfo.getResponseType()) {
+ case MessageStruct.NORMAL_RESPONSE:
+ // not sure where this belongs yet - but for now-
+ return;
+ case MessageStruct.CHECKED_EXCEPTION_RESPONSE:
+ if (response instanceof SOAPFaultInfo) {
+ SOAPFaultInfo soapFaultInfo = (SOAPFaultInfo) response;
+ JAXBException jbe = null;
+ if (soapFaultInfo.getString().contains("javax.xml.bind"))
{
+ jbe = new JAXBException(soapFaultInfo.getString());
+ // do I need to put this in a jaxws exception
+ }
+ SOAPFaultException sfe = new
SOAPFaultException(soapFaultInfo.getSOAPFault());
+ if (jbe != null)
+ sfe.initCause(jbe);
+ messageInfo.setResponse((SOAPFaultException) sfe);
+ }
+ return;
+ case MessageStruct.UNCHECKED_EXCEPTION_RESPONSE:
+ if (response instanceof SOAPFaultException) {
+ messageInfo.setResponse((SOAPFaultException) response);
+ } else {
+
+ if (response instanceof Exception) {
+ RuntimeException jex = (RuntimeException) response;
+ messageInfo.setResponse(jex);
+ }
+ }
+ return;
+ default:
+ messageInfo.setResponse(response);
+ }
+ }
+
+ private InternalMessage preHandlerOutboundHook(SOAPMessage sm, InternalMessage im) {
+ if ((sm != null) && (im != null))
+ im = null;
+ return im;
+ }
+
+ private void postHandlerOutboundHook(MessageInfo messageInfo, SOAPHandlerContext
handlerContext, SOAPMessage sm) {
+ if (messageInfo.getMetaData(DispatchContext.DISPATCH_MESSAGE_MODE) ==
Service.Mode.MESSAGE)
+ {
+ InternalMessage im = handlerContext.getInternalMessage();
+ if (im != null) {
+ Object value = im.getBody().getValue();
+ updateSOAPMessage(value, sm);
+ im = null;
+ } else
+ try {
+ sm.saveChanges();
+ } catch (SOAPException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ private void postHandlerInboundHook(MessageInfo messageInfo, SOAPHandlerContext
handlerContext, SOAPMessage sm) {
+ if ((messageInfo.getMetaData(DispatchContext.DISPATCH_MESSAGE_MODE) ==
Service.Mode.MESSAGE) ||
+ (messageInfo.getMetaData(DispatchContext.DISPATCH_MESSAGE_MODE) ==
Service.Mode.PAYLOAD))
+ {
+ InternalMessage im = handlerContext.getInternalMessage();
+ if (im != null) {
+ Object value = im.getBody().getValue();
+ updateSOAPMessage(value, sm);
+ im = null;
+ } else
+ try {
+ sm.saveChanges();
+ } catch (SOAPException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+
+ private void closeAllHandlers(SOAPHandlerContext context) {
+ HandlerChainCaller caller = getHandlerChainCaller(context.getMessageInfo());
+ if (caller != null && caller.hasHandlers()) {
+ caller.forceCloseHandlersOnClient(context);
+ }
+ }
+
+ /**
+ * This method is used to create the appropriate SOAPMessage (1.1 or 1.2 using SAAJ
api).
+ *
+ * @return the BindingId associated with messageInfo
+ */
+ protected String getBindingId(MessageInfo messageInfo) {
+ SOAPEncoder encoder = (SOAPEncoder) messageInfo.getEncoder();
+ if (encoder instanceof SOAP12XMLEncoder)
+ return SOAPBinding.SOAP12HTTP_BINDING;
+ else
+ return SOAPBinding.SOAP11HTTP_BINDING;
+ }
+
+ /**
+ * Logs the SOAP request message
+ */
+ protected void logRequestMessage(SOAPMessage soapMessage, MessageInfo messageInfo)
+ throws IOException, SOAPException {
+
+ OutputStream out = ((WSConnection) messageInfo.getConnection()).getDebug();
+
+ if (out != null) {
+ String s = "******************\nRequest\n";
+ out.write(s.getBytes());
+ for (Iterator iter =
+ soapMessage.getMimeHeaders().getAllHeaders();
+ iter.hasNext();
+ ) {
+ MimeHeader header = (MimeHeader) iter.next();
+ s = header.getName() + ": " + header.getValue() +
"\n";
+ out.write(s.getBytes());
+ }
+ out.flush();
+ soapMessage.writeTo(out);
+ s = "\n";
+ out.write(s.getBytes());
+ out.flush();
+ }
+ }
+
+ /**
+ * Logs the SOAP response message
+ */
+ protected void logResponseMessage(SOAPMessage response, MessageInfo messageInfo)
+ throws IOException, SOAPException {
+
+ OutputStream out = ((WSConnection) messageInfo.getConnection()).getDebug();
+ if (out != null) {
+ String s = "Response\n";
+ out.write(s.getBytes());
+ s =
+ "Http Status Code: "
+ + ((WSConnection) messageInfo.getConnection()).getStatus()
+ + "\n\n";
+ out.write(s.getBytes());
+ for (Iterator iter =
+ response.getMimeHeaders().getAllHeaders();
+ iter.hasNext();
+ ) {
+ MimeHeader header = (MimeHeader) iter.next();
+ s = header.getName() + ": " + header.getValue() +
"\n";
+ out.write(s.getBytes());
+ }
+ out.flush();
+ response.writeTo(out);
+ s = "******************\n\n";
+ out.write(s.getBytes());
+ }
+ }
+
+ class DaemonThreadFactory implements ThreadFactory {
+ public Thread newThread(Runnable r) {
+ Thread daemonThread = new Thread(r);
+ daemonThread.setDaemon(Boolean.TRUE);
+ return daemonThread;
+ }
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/soap/client/SOAPMessageDispatcher.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/soap/server/ProviderSOAPMD.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/soap/server/ProviderSOAPMD.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/soap/server/ProviderSOAPMD.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,151 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.protocol.soap.server;
+
+import javax.xml.ws.Service;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.transform.Source;
+
+import org.jboss.com.sun.xml.ws.binding.BindingImpl;
+import org.jboss.com.sun.xml.ws.encoding.internal.InternalEncoder;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPEPTFactory;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPEncoder;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.InternalMessage;
+import org.jboss.com.sun.xml.ws.handler.LogicalMessageImpl;
+import org.jboss.com.sun.xml.ws.handler.SOAPHandlerContext;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.pept.presentation.MessageStruct;
+import org.jboss.com.sun.xml.ws.server.RuntimeContext;
+import org.jboss.com.sun.xml.ws.server.RuntimeEndpointInfo;
+import org.jboss.com.sun.xml.ws.server.ServerRtException;
+import org.jboss.com.sun.xml.ws.server.provider.ProviderModel;
+import org.jboss.com.sun.xml.ws.server.provider.ProviderPeptTie;
+import org.jboss.com.sun.xml.ws.util.FastInfosetUtil;
+import org.jboss.com.sun.xml.ws.util.MessageInfoUtil;
+import org.jboss.com.sun.xml.ws.util.SOAPUtil;
+
+
+import static org.jboss.com.sun.xml.ws.developer.JAXWSProperties.*;
+
+public class ProviderSOAPMD extends SOAPMessageDispatcher {
+
+ /*
+ * Fill the parameters, method in MessageInfo for Provider interface.
+ * invoke(Source, HandlerContext) to Object[]
+ * invoke(SOAPMessage, HandlerContext) to Object[]
+ */
+ @Override
+ protected void toMessageInfo(MessageInfo messageInfo, SOAPHandlerContext context) {
+ Object[] data = new Object[1];
+ RuntimeContext rtCtxt = MessageInfoUtil.getRuntimeContext(messageInfo);
+ RuntimeEndpointInfo endpointInfo = rtCtxt.getRuntimeEndpointInfo();
+ Class providerClass = endpointInfo.getImplementorClass();
+ ProviderModel model = endpointInfo.getProviderModel();
+ boolean isSource = model.isSource();
+ Service.Mode mode = model.getServiceMode();
+
+ if (mode == Service.Mode.PAYLOAD) {
+ if (isSource) {
+ data[0] = new LogicalMessageImpl(context).getPayload();
+ }
+ // else doesn't happen and it is checked while creating the model
+ } else {
+ InternalMessage internalMessage = context.getInternalMessage();
+ SOAPMessage soapMessage = context.getSOAPMessage();
+ try {
+ if (internalMessage != null) {
+ // SOAPMessage's body is replaced by InternalMessage's
BodyBlock
+ SOAPEPTFactory eptf = (SOAPEPTFactory)messageInfo.getEPTFactory();
+ SOAPEncoder encoder = eptf.getSOAPEncoder();
+ soapMessage = encoder.toSOAPMessage(internalMessage, soapMessage);
+ }
+ if (isSource) {
+ // Get SOAPMessage's SOAPPart as Source
+ data[0]= soapMessage.getSOAPPart().getContent();
+ } else {
+ data[0] = soapMessage;
+ }
+ } catch(Exception e) {
+ messageInfo.setResponseType(MessageStruct.UNCHECKED_EXCEPTION_RESPONSE);
+ messageInfo.setResponse(e);
+ }
+ }
+ messageInfo.setData(data);
+ messageInfo.setMethod(ProviderPeptTie.invoke_Method);
+ }
+
+ /*
+ * MessageInfo contains the endpoint invocation results. If the endpoint
+ * returns a SOAPMessage, just set the object in HandlerContext. If the
+ * endpoint returns a Source in Mode.MESSAGE, it is converted to SOAPMessage
+ * and set in HandlerContext. If the endpoint returns a Source in
+ * Mode.PAYLOAD, it is set in InternalMessage, and InternalMessage is set
+ * in HandlerContext
+ */
+ @Override
+ protected void setResponseInContext(MessageInfo messageInfo,
+ SOAPHandlerContext context)
+ {
+ Object obj = messageInfo.getResponse();
+ RuntimeContext rtCtxt = MessageInfoUtil.getRuntimeContext(messageInfo);
+ RuntimeEndpointInfo endpointInfo = rtCtxt.getRuntimeEndpointInfo();
+ Class providerClass = endpointInfo.getImplementorClass();
+ ProviderModel model = endpointInfo.getProviderModel();
+ Service.Mode mode = model.getServiceMode();
+
+ if (messageInfo.getResponseType() == MessageInfo.NORMAL_RESPONSE &&
+ mode == Service.Mode.MESSAGE) {
+ SOAPMessage soapMessage = null;
+ if (obj instanceof SOAPMessage) {
+ soapMessage = (SOAPMessage)obj;
+ } else {
+ // put Source into SOAPPart of SOAPMessage
+ try {
+ Source source = (Source)obj;
+ String bindingId =
((BindingImpl)endpointInfo.getBinding()).getBindingId();
+ soapMessage = SOAPUtil.createMessage(bindingId);
+ soapMessage.getSOAPPart().setContent(source);
+ } catch(SOAPException e) {
+ throw new ServerRtException("soapencoder.err", new
Object[]{e});
+ }
+ }
+
+ // Ensure message is encoded according to conneg
+ FastInfosetUtil.ensureCorrectEncoding(messageInfo, soapMessage);
+
+ context.setSOAPMessage(soapMessage);
+ context.setInternalMessage(null);
+ }
+ else {
+ // set Source or any Exception in InternalMessage's BodyBlock
+ SOAPEPTFactory eptf = (SOAPEPTFactory)messageInfo.getEPTFactory();
+ InternalEncoder ine = eptf.getInternalEncoder();
+ InternalMessage internalMessage =
+ (InternalMessage)ine.toInternalMessage(messageInfo);
+ // set handler context
+ context.setInternalMessage(internalMessage);
+ context.setSOAPMessage(null);
+ }
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/soap/server/ProviderSOAPMD.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/soap/server/SOAPMessageDispatcher.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/soap/server/SOAPMessageDispatcher.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/soap/server/SOAPMessageDispatcher.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,632 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.protocol.soap.server;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.Binding;
+import javax.xml.ws.ProtocolException;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.MessageContext.Scope;
+
+import javax.xml.ws.soap.SOAPBinding;
+import javax.xml.ws.soap.SOAPFaultException;
+
+import org.jboss.com.sun.xml.ws.binding.BindingImpl;
+import org.jboss.com.sun.xml.ws.binding.soap.SOAPBindingImpl;
+import org.jboss.com.sun.xml.ws.client.BindingProviderProperties;
+import org.jboss.com.sun.xml.ws.encoding.JAXWSAttachmentMarshaller;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPConstants;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPDecoder;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPEPTFactory;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPEncoder;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.InternalMessage;
+import org.jboss.com.sun.xml.ws.encoding.soap.message.SOAPFaultInfo;
+import org.jboss.com.sun.xml.ws.handler.HandlerChainCaller;
+import org.jboss.com.sun.xml.ws.handler.MessageContextUtil;
+import org.jboss.com.sun.xml.ws.handler.SOAPHandlerContext;
+import org.jboss.com.sun.xml.ws.handler.HandlerChainCaller.Direction;
+import org.jboss.com.sun.xml.ws.handler.HandlerChainCaller.RequestOrResponse;
+import org.jboss.com.sun.xml.ws.model.soap.SOAPRuntimeModel;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.pept.presentation.MessageStruct;
+import org.jboss.com.sun.xml.ws.pept.presentation.TargetFinder;
+import org.jboss.com.sun.xml.ws.pept.presentation.Tie;
+import org.jboss.com.sun.xml.ws.pept.protocol.MessageDispatcher;
+import org.jboss.com.sun.xml.ws.server.AppMsgContextImpl;
+import org.jboss.com.sun.xml.ws.server.RuntimeContext;
+import org.jboss.com.sun.xml.ws.server.RuntimeEndpointInfo;
+import org.jboss.com.sun.xml.ws.server.ServerRtException;
+import org.jboss.com.sun.xml.ws.spi.runtime.Invoker;
+import org.jboss.com.sun.xml.ws.spi.runtime.SystemHandlerDelegate;
+import org.jboss.com.sun.xml.ws.spi.runtime.WSConnection;
+import org.jboss.com.sun.xml.ws.spi.runtime.WebServiceContext;
+import org.jboss.com.sun.xml.ws.util.FastInfosetUtil;
+import org.jboss.com.sun.xml.ws.util.MessageInfoUtil;
+import org.jboss.com.sun.xml.ws.util.SOAPConnectionUtil;
+
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import static
org.jboss.com.sun.xml.ws.client.BindingProviderProperties.CONTENT_NEGOTIATION_PROPERTY;
+
+public class SOAPMessageDispatcher implements MessageDispatcher {
+
+ private static final String[] contentTypes = {
+ "text/xml", "application/soap+xml",
"application/xop+xml",
+ "application/fastinfoset", "application/soap+fastinfoset"
};
+
+ private static final Logger logger = Logger.getLogger(
+ org.jboss.com.sun.xml.ws.util.Constants.LoggingDomain +
".server.soapmd");
+
+ public SOAPMessageDispatcher() {
+ }
+
+ public void send(MessageInfo messageInfo) {
+ // Not required for server
+ throw new UnsupportedOperationException();
+ }
+
+ public void receive(MessageInfo messageInfo) {
+ // Checks the Content-Type to send unsupported media error
+ try {
+ checkContentType(messageInfo);
+ } catch(ServerRtException e) {
+ SOAPConnectionUtil.sendKnownError(messageInfo,
+ WSConnection.UNSUPPORTED_MEDIA);
+ return;
+ }
+
+ // Gets request stream from WSConnection and creates SOAP message
+ SOAPMessage soapMessage = null;
+ try {
+ soapMessage = getSOAPMessage(messageInfo);
+ } catch(Exception e) {
+ sendResponseError(messageInfo, e);
+ return;
+ }
+
+ // Set it before response is sent on transport. If transport creates
+ // any exception, this can be used not to send again
+ boolean sent = false;
+ try {
+
+ // Content negotiation logic
+ try {
+ // If FI is accepted by client, set property to optimistic
+ if (((org.jboss.com.sun.xml.messaging.saaj.soap.MessageImpl)
soapMessage).acceptFastInfoset()) {
+ messageInfo.setMetaData(CONTENT_NEGOTIATION_PROPERTY,
"optimistic");
+ }
+ }
+ catch (ClassCastException e) {
+ // Content negotiation fails
+ }
+
+ // context holds MessageInfo, InternalMessage, SOAPMessage
+ SOAPHandlerContext context = new SOAPHandlerContext(messageInfo, null,
+ soapMessage);
+ // WebServiceContext's MessageContext is set into HandlerContext
+ updateHandlerContext(messageInfo, context);
+ context.getMessageContext().put(
+ MessageContext.MESSAGE_OUTBOUND_PROPERTY, Boolean.FALSE);
+ //set MESSAGE_ATTACHMENTS property
+ MessageContext msgCtxt = MessageInfoUtil.getMessageContext(messageInfo);
+ if (msgCtxt != null) {
+ MessageContextUtil.copyInboundMessageAttachments(msgCtxt,
soapMessage.getAttachments());
+ }
+ SystemHandlerDelegate shd = getSystemHandlerDelegate(messageInfo);
+ SoapInvoker implementor = new SoapInvoker(messageInfo, soapMessage,
+ context, shd);
+ try {
+ if (shd == null) {
+ // Invokes request handler chain, endpoint, response handler chain
+ implementor.invoke();
+ } else {
+ context.setInvoker(implementor);
+ if (shd.processRequest(context.getSHDSOAPMessageContext())) {
+ implementor.invoke();
+ context.getMessageContext().put(
+ MessageContext.MESSAGE_OUTBOUND_PROPERTY, Boolean.TRUE);
+ shd.processResponse(context.getSHDSOAPMessageContext());
+ }
+ }
+ } finally {
+ sent = implementor.isSent(); // response is sent or not
+ }
+ if (!isOneway(messageInfo)) {
+ makeSOAPMessage(messageInfo, context);
+ sent = true;
+ sendResponse(messageInfo, context);
+ } else if (!sent) {
+ // Oneway and request handler chain reversed the execution direction
+ sent = true;
+ sendResponseOneway(messageInfo);
+ }
+ } catch(Exception e) {
+ e.printStackTrace();
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ if (!sent) {
+ sendResponseError(messageInfo, e);
+ }
+ }
+ assert sent; // Make sure response is sent
+ }
+
+ /*
+ * This decodes the SOAPMessage into InternalMessage. Then InternalMessage
+ * is converted to java method and parameters and populates them into
+ * MessageInfo.
+ *
+ */
+ protected void toMessageInfo(MessageInfo messageInfo, SOAPHandlerContext context) {
+ InternalMessage internalMessage = context.getInternalMessage();
+ try {
+ SOAPMessage soapMessage = context.getSOAPMessage();
+ if (internalMessage == null) {
+ // Bind headers, body from SOAPMessage
+ SOAPEPTFactory eptf = (SOAPEPTFactory)messageInfo.getEPTFactory();
+ SOAPDecoder decoder = eptf.getSOAPDecoder();
+ internalMessage = decoder.toInternalMessage(soapMessage, messageInfo);
+ } else {
+ // Bind headers from SOAPMessage
+ SOAPEPTFactory eptf = (SOAPEPTFactory)messageInfo.getEPTFactory();
+ SOAPDecoder decoder = eptf.getSOAPDecoder();
+ internalMessage = decoder.toInternalMessage(soapMessage, internalMessage,
messageInfo);
+ }
+ //setup JAXWSAttachmentMarshaller for outgoing attachments
+ SOAPEPTFactory eptf = (SOAPEPTFactory)messageInfo.getEPTFactory();
+ SOAPEncoder encoder = eptf.getSOAPEncoder();
+ encoder.setAttachmentsMap(messageInfo, internalMessage);
+
+ } catch(Exception e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ messageInfo.setResponseType(MessageStruct.UNCHECKED_EXCEPTION_RESPONSE);
+ messageInfo.setResponse(e);
+ }
+ // InternalMessage to MessageInfo
+ if (!isFailure(messageInfo)) {
+ SOAPEPTFactory eptf = (SOAPEPTFactory)messageInfo.getEPTFactory();
+ eptf.getInternalEncoder().toMessageInfo(internalMessage, messageInfo);
+ Binding binding =
MessageInfoUtil.getRuntimeContext(messageInfo).getRuntimeEndpointInfo().getBinding();
+ String bindingId = (binding !=
null)?((SOAPBindingImpl)binding).getBindingId():SOAPBinding.SOAP11HTTP_BINDING;
+
+ if (messageInfo.getMethod() == null) {
+ messageInfo.setResponseType(MessageStruct.UNCHECKED_EXCEPTION_RESPONSE);
+ SOAPFaultInfo faultInfo = new SOAPFaultInfo(
+ "Cannot find dispatch method",
+ SOAPConstants.FAULT_CODE_SERVER,
+ null, null, bindingId);
+ messageInfo.setResponse(faultInfo);
+ }
+ }
+ }
+
+ /*
+ * Creates SOAPMessage from the connection's request stream
+ */
+ private SOAPMessage getSOAPMessage(MessageInfo messageInfo) {
+ WSConnection con = (WSConnection)messageInfo.getConnection();
+ return SOAPConnectionUtil.getSOAPMessage(con, messageInfo, null);
+ }
+
+ /*
+ * Checks against known Content-Type headers
+ */
+ private void checkContentType(MessageInfo mi) {
+ WSConnection con = (WSConnection)mi.getConnection();
+ Map<String, List<String>> headers = con.getHeaders();
+ List<String> cts = headers.get("Content-Type");
+ if (cts != null && cts.size() > 0) {
+ String ct = cts.get(0);
+ for(String contentType : contentTypes) {
+ if (ct.indexOf(contentType) != -1) {
+ return;
+ }
+ }
+ }
+ throw new ServerRtException("Incorrect Content-Type="+cts);
+ }
+
+ /*
+ * Sets the WebServiceContext with correct MessageContext which contains
+ * APPLICATION scope properties
+ */
+ protected void updateWebServiceContext(MessageInfo messageInfo, SOAPHandlerContext
hc) {
+ RuntimeContext rtCtxt = MessageInfoUtil.getRuntimeContext(messageInfo);
+ //rtCtxt.setHandlerContext(hc);
+ RuntimeEndpointInfo endpointInfo = rtCtxt.getRuntimeEndpointInfo();
+ WebServiceContext wsContext = endpointInfo.getWebServiceContext();
+ hc.getMessageContext().put(CONTENT_NEGOTIATION_PROPERTY,
+ messageInfo.getMetaData(CONTENT_NEGOTIATION_PROPERTY));
+ hc.getMessageContext().setScope(CONTENT_NEGOTIATION_PROPERTY,
Scope.APPLICATION);
+ if (wsContext != null) {
+ AppMsgContextImpl appCtxt = new AppMsgContextImpl(hc.getMessageContext());
+ wsContext.setMessageContext(appCtxt);
+ }
+ }
+
+ /*
+ * Invokes the endpoint. For Provider endpoints, whether the operation is
+ * oneway or not known only after the endpoint is invoked. ProviderSOAPMD
+ * overrides this and sends the response message on transport for oneway
+ * operations.
+ *
+ * @return true if response is sent on transport
+ */
+ protected void invokeEndpoint(MessageInfo messageInfo, SOAPHandlerContext hc) {
+ TargetFinder targetFinder =
+ messageInfo.getEPTFactory().getTargetFinder(messageInfo);
+ Tie tie = targetFinder.findTarget(messageInfo);
+ tie._invoke(messageInfo);
+ }
+
+ /**
+ * Converts java method parameters, and return value to InternalMessage.
+ * It calls response handlers. At the end, the context has either
+ * InternalMessage or SOAPMessage
+ *
+ */
+ protected void getResponse(MessageInfo messageInfo, SOAPHandlerContext context) {
+ setResponseInContext(messageInfo, context);
+ try {
+ HandlerChainCaller handlerCaller =
+ getCallerFromMessageInfo(messageInfo);
+ if (handlerCaller != null && handlerCaller.hasHandlers()) {
+ int messageType = messageInfo.getResponseType();
+ if (messageType == MessageInfo.CHECKED_EXCEPTION_RESPONSE ||
+ messageType == MessageInfo.UNCHECKED_EXCEPTION_RESPONSE) {
+
+ callHandleFault(handlerCaller, context);
+ } else {
+ //there are handlers so disable Xop encoding if enabled, so that they
dont
+ // see xop:Include reference
+ JAXWSAttachmentMarshaller am =
MessageInfoUtil.getAttachmentMarshaller(messageInfo);
+ boolean isXopped = false;
+ if((am != null) && am.isXOPPackage()){
+ isXopped = am.isXOPPackage();
+ am.setXOPPackage(false);
+ }
+ callHandlersOnResponse(handlerCaller, context);
+ // now put back the old value
+ if((am != null)){
+ am.setXOPPackage(isXopped);
+ }
+ }
+ }
+ } catch(Exception e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ createInternalMessageForException(messageInfo, e, context);
+ }
+ }
+
+ /*
+ *
+ *
+ *
+ */
+ private boolean createInternalMessageForException(MessageInfo messageInfo,
+ Exception e, SOAPHandlerContext context) {
+ boolean soap12 = false;
+ RuntimeEndpointInfo rei = MessageInfoUtil.getRuntimeContext(
+ messageInfo).getRuntimeEndpointInfo();
+ String id = ((SOAPBindingImpl)rei.getBinding()).getBindingId();
+ InternalMessage internalMessage = null;
+ if (id.equals(SOAPBinding.SOAP11HTTP_BINDING)) {
+ internalMessage = SOAPRuntimeModel.createFaultInBody(
+ e, null, null, null);
+ } else if (id.equals(SOAPBinding.SOAP12HTTP_BINDING)) {
+ internalMessage = SOAPRuntimeModel.createSOAP12FaultInBody(
+ e, null, null, null, null);
+ soap12 = true;
+ }
+ context.setInternalMessage(internalMessage);
+ context.setSOAPMessage(null);
+ return soap12;
+ }
+
+ private void makeSOAPMessage(MessageInfo messageInfo, SOAPHandlerContext context) {
+ InternalMessage internalMessage = context.getInternalMessage();
+ if (internalMessage != null) {
+ SOAPEPTFactory eptf = (SOAPEPTFactory)messageInfo.getEPTFactory();
+ SOAPEncoder encoder = eptf.getSOAPEncoder();
+ SOAPMessage soapMesage = encoder.toSOAPMessage(internalMessage,
messageInfo);
+ context.setSOAPMessage(soapMesage);
+ context.setInternalMessage(null);
+ }
+ }
+
+ /*
+ * MessageInfo contains the endpoint invocation results. The information
+ * is converted to InternalMessage or SOAPMessage and set in HandlerContext
+ */
+ protected void setResponseInContext(MessageInfo messageInfo,
+ SOAPHandlerContext context) {
+ // MessageInfo to InternalMessage
+ SOAPEPTFactory eptf = (SOAPEPTFactory)messageInfo.getEPTFactory();
+ InternalMessage internalMessage =
(InternalMessage)eptf.getInternalEncoder().toInternalMessage(
+ messageInfo);
+ // set handler context
+ context.setInternalMessage(internalMessage);
+ context.setSOAPMessage(null);
+ }
+
+ /*
+ * Sends SOAPMessage response on the connection
+ */
+ private void sendResponse(MessageInfo messageInfo, SOAPHandlerContext ctxt) {
+ SOAPMessage soapMessage = ctxt.getSOAPMessage();
+ WSConnection con = (WSConnection)messageInfo.getConnection();
+ Integer status = MessageContextUtil.getHttpStatusCode(ctxt.getMessageContext());
+ int statusCode = (status == null) ? WSConnection.OK : status;
+ SOAPConnectionUtil.setStatus(con, statusCode);
+ SOAPConnectionUtil.sendResponse(con, soapMessage);
+ }
+
+ protected void sendResponseOneway(MessageInfo messageInfo) {
+ SOAPConnectionUtil.sendResponseOneway(messageInfo);
+ }
+
+ private void sendResponseError(MessageInfo messageInfo, Exception e) {
+ e.printStackTrace();
+ WSConnection con = (WSConnection)messageInfo.getConnection();
+ Binding binding =
MessageInfoUtil.getRuntimeContext(messageInfo).getRuntimeEndpointInfo().getBinding();
+ String bindingId = ((SOAPBindingImpl)binding).getBindingId();
+ SOAPConnectionUtil.sendResponseError(con, bindingId);
+ }
+
+ /*
+ * Calls inbound handlers. It also calls outbound handlers incase flow is
+ * reversed. If the handler throws a ProtocolException, SOAP message is
+ * already set in the context. Otherwise, it creates InternalMessage,
+ * and that is used to create SOAPMessage.
+ *
+ * returns whether to invoke endpoint or not.
+ */
+ private boolean callHandlersOnRequest(MessageInfo messageInfo,
+ SOAPHandlerContext context, boolean responseExpected) {
+
+ boolean skipEndpoint = false;
+ HandlerChainCaller handlerCaller =
+ getCallerFromMessageInfo(messageInfo);
+
+ if (handlerCaller != null && handlerCaller.hasHandlers()) {
+ try {
+ skipEndpoint = !handlerCaller.callHandlers(Direction.INBOUND,
+ RequestOrResponse.REQUEST, context, responseExpected);
+ } catch(ProtocolException pe) {
+ skipEndpoint = true;
+ if (MessageContextUtil.ignoreFaultInMessage(
+ context.getMessageContext())) {
+ // don't use the fault, use the exception
+ createInternalMessageForException(messageInfo, pe, context);
+ }
+ } catch(RuntimeException re) {
+ skipEndpoint = true;
+ createInternalMessageForException(messageInfo, re, context);
+ }
+ }
+ return skipEndpoint;
+ }
+
+ private HandlerChainCaller getCallerFromMessageInfo(MessageInfo info) {
+ RuntimeContext context = (RuntimeContext) info.getMetaData(
+ BindingProviderProperties.JAXWS_RUNTIME_CONTEXT);
+ BindingImpl binding =
(BindingImpl)context.getRuntimeEndpointInfo().getBinding();
+ if (binding.hasHandlers()) {
+ HandlerChainCaller caller = binding.getHandlerChainCaller();
+ MessageInfoUtil.setHandlerChainCaller(info, caller);
+ return caller;
+ }
+ return null;
+ }
+
+ /**
+ *
+ * Invokes response handler chain
+ */
+ protected boolean callHandlersOnResponse(HandlerChainCaller caller,
+ SOAPHandlerContext context) {
+
+ return caller.callHandlers(Direction.OUTBOUND,
+ RequestOrResponse.RESPONSE, context, false);
+ }
+
+ /**
+ * Used when the endpoint throws an exception. HandleFault is called
+ * on the server handlers rather than handleMessage.
+ */
+ protected boolean callHandleFault(HandlerChainCaller caller, SOAPHandlerContext
context) {
+ return caller.callHandleFault(context);
+ }
+
+ /**
+ * Server does not know if a message is one-way until after
+ * the handler chain has finished processing the request. If
+ * it is a one-way message, have the handler chain caller
+ * call close on the handlers.
+ */
+ private void closeHandlers(MessageInfo info, SOAPHandlerContext context) {
+ HandlerChainCaller handlerCaller = getCallerFromMessageInfo(info);
+ if (handlerCaller != null && handlerCaller.hasHandlers()) {
+ handlerCaller.forceCloseHandlersOnServer(context);
+ }
+ }
+
+ private static boolean isFailure(MessageInfo messageInfo) {
+ return (messageInfo.getResponseType() ==
MessageStruct.UNCHECKED_EXCEPTION_RESPONSE);
+ }
+
+ public static boolean isOneway(MessageInfo messageInfo) {
+ return (messageInfo.getMEP() == MessageStruct.ONE_WAY_MEP);
+ }
+
+
+ /**
+ * Sets MessageContext into HandlerContext and sets HandlerContext in
+ * RuntimeContext
+ */
+ private void updateHandlerContext(MessageInfo messageInfo,
+ SOAPHandlerContext context) {
+ MessageInfoUtil.getRuntimeContext(messageInfo).setHandlerContext(context);
+ RuntimeEndpointInfo endpointInfo =
+ MessageInfoUtil.getRuntimeContext(messageInfo).getRuntimeEndpointInfo();
+
context.setBindingId(((BindingImpl)endpointInfo.getBinding()).getActualBindingId());
+ WebServiceContext wsContext = endpointInfo.getWebServiceContext();
+ if (wsContext != null) {
+ context.setMessageContext(wsContext.getMessageContext());
+ }
+ }
+
+ /**
+ * Gets SystemHandlerDelegate from endpoint's Binding
+ */
+ private SystemHandlerDelegate getSystemHandlerDelegate(MessageInfo mi) {
+ RuntimeContext rtCtxt = MessageInfoUtil.getRuntimeContext(mi);
+ RuntimeEndpointInfo endpointInfo = rtCtxt.getRuntimeEndpointInfo();
+ return endpointInfo.getBinding().getSystemHandlerDelegate();
+ }
+
+ /**
+ * Invokes request handler chain, endpoint and response handler chain.
+ * Separated as a separate class, so that SHD can call this in doPriv()
+ * block.
+ */
+ private class SoapInvoker implements Invoker {
+
+ MessageInfo messageInfo;
+ SOAPMessage soapMessage;
+ SOAPHandlerContext context;
+ boolean skipEndpoint;
+ SystemHandlerDelegate shd;
+ boolean sent;
+
+ SoapInvoker(MessageInfo messageInfo, SOAPMessage soapMessage,
+ SOAPHandlerContext context, SystemHandlerDelegate shd) {
+ this.messageInfo = messageInfo;
+ this.soapMessage = soapMessage;
+ this.context = context;
+ this.shd = shd;
+ }
+
+ public void invoke() throws Exception {
+ boolean peekOneWay = false;
+ if (!skipEndpoint) {
+ try {
+ SOAPEPTFactory eptf = (SOAPEPTFactory)messageInfo.getEPTFactory();
+ SOAPDecoder decoder = eptf.getSOAPDecoder();
+
+ // add handler chain caller to message info
+ getCallerFromMessageInfo(messageInfo);
+ peekOneWay = decoder.doMustUnderstandProcessing(soapMessage,
+ messageInfo, context, true);
+ context.setMethod(messageInfo.getMethod());
+ } catch (SOAPFaultException e) {
+ skipEndpoint = true;
+ boolean soap12 = createInternalMessageForException(messageInfo, e,
context);
+ SOAPRuntimeModel.addHeaders(context.getInternalMessage(),
+ messageInfo);
+ }
+ }
+
+ // Call inbound handlers. It also calls outbound handlers incase of
+ // reversal of flow.
+ if (!skipEndpoint) {
+ skipEndpoint = callHandlersOnRequest(
+ messageInfo, context, !peekOneWay);
+ }
+
+ if (skipEndpoint) {
+ soapMessage = context.getSOAPMessage();
+ if (soapMessage == null) {
+ InternalMessage internalMessage = context.getInternalMessage();
+ SOAPEPTFactory eptf = (SOAPEPTFactory)messageInfo.getEPTFactory();
+ SOAPEncoder encoder = eptf.getSOAPEncoder();
+ soapMessage = encoder.toSOAPMessage(internalMessage, messageInfo);
+ }
+
+ // Ensure message is encoded according to conneg
+ FastInfosetUtil.ensureCorrectEncoding(messageInfo, soapMessage);
+
+ context.setSOAPMessage(soapMessage);
+ context.setInternalMessage(null);
+ } else {
+ toMessageInfo(messageInfo, context);
+
+ if (isOneway(messageInfo)) {
+ sent = true;
+ sendResponseOneway(messageInfo);
+ if (!peekOneWay) { // handler chain didn't already clos
+ closeHandlers(messageInfo, context);
+ }
+ }
+
+ if (!isFailure(messageInfo)) {
+ if (shd != null) {
+ shd.preInvokeEndpointHook(context.getSHDSOAPMessageContext());
+ }
+ updateWebServiceContext(messageInfo, context);
+ invokeEndpoint(messageInfo, context);
+ // For Provider endpoints Oneway is known only after executing
endpoint
+ if (!sent && isOneway(messageInfo)) {
+ sent = true;
+ sendResponseOneway(messageInfo);
+ }
+ context.getMessageContext().put(
+ MessageContext.MESSAGE_OUTBOUND_PROPERTY, Boolean.TRUE);
+ }
+
+ if (isOneway(messageInfo)) {
+ if (isFailure(messageInfo)) {
+ // Just log the error. Not much to do
+ }
+ } else {
+ getResponse(messageInfo, context);
+ }
+ }
+ }
+
+ /**
+ * Gets the dispatch method in the endpoint for the payload's QName
+ *
+ * @return dispatch method
+ */
+ public Method getMethod(QName name) {
+ RuntimeContext rtCtxt = MessageInfoUtil.getRuntimeContext(messageInfo);
+ return rtCtxt.getDispatchMethod(name, messageInfo);
+ }
+
+ /*
+ * Is the message sent on transport. Happens when the operation is oneway
+ *
+ * @return true if the message is sent
+ * false otherwise
+ */
+ public boolean isSent() {
+ return sent;
+ }
+ }
+
+}
+
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/soap/server/SOAPMessageDispatcher.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/xml/XMLMessageException.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/xml/XMLMessageException.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/xml/XMLMessageException.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,49 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.protocol.xml;
+
+import org.jboss.com.sun.xml.ws.util.exception.JAXWSExceptionBase;
+import org.jboss.com.sun.xml.ws.util.localization.Localizable;
+
+/**
+ * @author WS Development Team
+ */
+public class XMLMessageException extends JAXWSExceptionBase {
+
+ public XMLMessageException(String key, Object... args) {
+ super(key, args);
+ }
+
+ public XMLMessageException(Throwable throwable) {
+ super(throwable);
+ }
+
+ public XMLMessageException(Localizable arg) {
+ super("server.rt.err", arg);
+ }
+
+ public String getResourceBundleName() {
+ return "org.jboss.com.sun.xml.ws.resources.xmlmessage";
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/xml/XMLMessageException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/xml/client/XMLMessageDispatcher.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/xml/client/XMLMessageDispatcher.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/xml/client/XMLMessageDispatcher.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,976 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.protocol.xml.client;
+
+import org.jboss.com.sun.xml.messaging.saaj.packaging.mime.MessagingException;
+
+import javax.activation.DataSource;
+import javax.activation.DataHandler;
+import javax.xml.bind.JAXBContext;
+import javax.xml.soap.MimeHeader;
+import javax.xml.soap.MimeHeaders;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.ws.*;
+import static javax.xml.ws.BindingProvider.PASSWORD_PROPERTY;
+import static javax.xml.ws.BindingProvider.USERNAME_PROPERTY;
+import static org.jboss.com.sun.xml.ws.client.BindingProviderProperties.*;
+
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.http.HTTPBinding;
+import javax.xml.ws.http.HTTPException;
+import javax.xml.ws.soap.SOAPBinding;
+
+import org.jboss.com.sun.xml.ws.binding.BindingImpl;
+import org.jboss.com.sun.xml.ws.client.*;
+import org.jboss.com.sun.xml.ws.client.dispatch.DispatchContext;
+import org.jboss.com.sun.xml.ws.client.dispatch.ResponseImpl;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPEncoder;
+import org.jboss.com.sun.xml.ws.encoding.soap.client.SOAP12XMLEncoder;
+import org.jboss.com.sun.xml.ws.encoding.soap.client.SOAPXMLEncoder;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.MessageInfoBase;
+import org.jboss.com.sun.xml.ws.encoding.xml.XMLEncoder;
+import org.jboss.com.sun.xml.ws.encoding.xml.XMLMessage;
+import org.jboss.com.sun.xml.ws.handler.HandlerChainCaller;
+import org.jboss.com.sun.xml.ws.handler.HandlerContext;
+import org.jboss.com.sun.xml.ws.handler.MessageContextUtil;
+import org.jboss.com.sun.xml.ws.handler.XMLHandlerContext;
+import org.jboss.com.sun.xml.ws.handler.HandlerChainCaller.Direction;
+import org.jboss.com.sun.xml.ws.handler.HandlerChainCaller.RequestOrResponse;
+import org.jboss.com.sun.xml.ws.model.JavaMethod;
+import org.jboss.com.sun.xml.ws.pept.ept.EPTFactory;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.pept.presentation.MessageStruct;
+import org.jboss.com.sun.xml.ws.pept.protocol.MessageDispatcher;
+import org.jboss.com.sun.xml.ws.server.RuntimeContext;
+import org.jboss.com.sun.xml.ws.spi.runtime.ClientTransportFactory;
+import org.jboss.com.sun.xml.ws.spi.runtime.WSConnection;
+import org.jboss.com.sun.xml.ws.transport.http.client.HttpClientTransportFactory;
+import org.jboss.com.sun.xml.ws.util.Base64Util;
+import org.jboss.com.sun.xml.ws.util.XMLConnectionUtil;
+import org.jboss.com.sun.xml.ws.util.xml.XmlUtil;
+
+import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.*;
+import java.util.concurrent.*;
+
+/**
+ * Client-side XML-based message dispatcher {@link
org.jboss.com.sun.xml.ws.pept.protocol.MessageDispatcher}
+ *
+ * @author WS Development Team
+ */
+public class XMLMessageDispatcher implements MessageDispatcher {
+
+ protected static final int MAX_THREAD_POOL_SIZE = 3;
+ protected static final long AWAIT_TERMINATION_TIME = 10L;
+
+ protected ExecutorService executorService = null;
+
+
+ /**
+ * Default constructor
+ */
+
+ public XMLMessageDispatcher() {
+ }
+
+ /*
+ * Invokes doSendAsync method if the message exchange pattern is asynchronous,
otherwise
+ * invokes doSend method.
+ *
+ * @see com.sun.pept.protocol.MessageDispatcher#send(com.sun.pept.ept.MessageInfo)
+ */
+ public void send(MessageInfo messageInfo) {
+ if (isAsync(messageInfo)) {
+ doSendAsync(messageInfo);
+ } else {
+ doSend(messageInfo);
+ }
+ }
+
+ /**
+ * Orchestrates the sending of a synchronous request
+ */
+ protected XMLMessage doSend(MessageInfo messageInfo) {
+ //change from LogicalEPTFactory to ContactInfoBase - should be changed back when
we have things working
+ EPTFactory contactInfo = messageInfo.getEPTFactory();
+ XMLEncoder encoder = (XMLEncoder) contactInfo.getEncoder(messageInfo);
+
+ boolean handlerResult = true;
+ boolean isRequestResponse = (messageInfo.getMEP() ==
MessageStruct.REQUEST_RESPONSE_MEP);
+
+ DispatchContext dispatchContext = (DispatchContext)
messageInfo.getMetaData(BindingProviderProperties.DISPATCH_CONTEXT);
+
+ if (!isHTTPMessageType(dispatchContext)) {
+ throw new WebServiceException("Mode not allowed with HTTP Binding. Must
use other Service.mode");
+ }
+
+ XMLMessage xm = makeXMLMessage(messageInfo);
+
+ try {
+ HandlerChainCaller caller = getHandlerChainCaller(messageInfo);
+ if (caller.hasHandlers()) {
+ XMLHandlerContext handlerContext = new XMLHandlerContext(
+ messageInfo, null, xm);
+ updateMessageContext(messageInfo, handlerContext);
+ handlerResult = callHandlersOnRequest(handlerContext);
+ updateXMLMessage(handlerContext);
+ xm = handlerContext.getXMLMessage();
+ if (xm == null) {
+ xm = encoder.toXMLMessage(
+ handlerContext.getInternalMessage(), messageInfo);
+ }
+
+ // the only case where no message is sent
+ if (isRequestResponse && !handlerResult) {
+ return xm;
+ }
+ }
+
+ // Setting encoder here is necessary for calls to getBindingId()
+// messageInfo.setEncoder(encoder);
+ Map<String, Object> context = processMetadata(messageInfo, xm);
+
+ // set the MIME headers on connection headers
+ Map<String, List<String>> ch = new HashMap<String,
List<String>>();
+ for (Iterator iter = xm.getMimeHeaders().getAllHeaders(); iter.hasNext();)
+ {
+ List<String> h = new ArrayList<String>();
+ MimeHeader mh = (MimeHeader) iter.next();
+
+ h.clear();
+ h.add(mh.getValue());
+ ch.put(mh.getName(), h);
+ }
+
+ setConnection(messageInfo, context);
+ ((WSConnection) messageInfo.getConnection()).setHeaders(ch);
+
+ if (!isAsync(messageInfo)) {
+ WSConnection connection = (WSConnection) messageInfo.getConnection();
+ //logRequestMessage(xm, messageInfo);
+ XMLConnectionUtil.sendResponse(connection, xm);
+ }
+
+ // if handlerResult is false, the receive has already happened
+ if (isRequestResponse && handlerResult) {
+ receive(messageInfo);
+ postReceiveHook(messageInfo);
+ }
+ } catch (Throwable e) {
+ setResponseType(e, messageInfo);
+ messageInfo.setResponse(e);
+ }
+ return xm;
+ }
+
+ /**
+ * Process and classify the metadata in MIME headers or message context.
<String,String> data
+ * is copied into MIME headers and the remaining metadata is passed in message
context to the
+ * transport layer.
+ *
+ * @param messageInfo
+ * @param xm
+ */
+ protected Map<String, Object> processMetadata(MessageInfo messageInfo,
XMLMessage xm) {
+ Map<String, Object> messageContext = new HashMap<String, Object>();
+ List<String> header = new ArrayList<String>();
+
+ ContextMap properties = (ContextMap)
+ messageInfo.getMetaData(JAXWS_CONTEXT_PROPERTY);
+ DispatchContext dcontext = (DispatchContext)
+ messageInfo.getMetaData(BindingProviderProperties.DISPATCH_CONTEXT);
+ if (isHTTPMessageType(dcontext)) {
+ setHTTPContext(messageContext, dcontext, properties);
+ }
+
+ if (messageInfo.getMEP() == MessageStruct.ONE_WAY_MEP)
+ messageContext.put(ONE_WAY_OPERATION, "true");
+
+ // process the properties
+ if (properties != null) {
+ for (Iterator names = properties.getPropertyNames(); names.hasNext();)
+ {
+ String propName = (String) names.next();
+
+ // consume PEPT-specific properties
+ if (propName.equals(ClientTransportFactory.class.getName())) {
+ messageContext.put(CLIENT_TRANSPORT_FACTORY, (ClientTransportFactory)
properties.get(propName));
+ } else if (propName.equals(USERNAME_PROPERTY)) {
+ String credentials = (String) properties.get(USERNAME_PROPERTY);
+ if (credentials != null) {
+ credentials += ":";
+ String password = (String) properties.get(PASSWORD_PROPERTY);
+ if (password != null)
+ credentials += password;
+
+ try {
+ credentials = Base64Util.encode(credentials.getBytes());
+ } catch (Exception ex) {
+ throw new WebServiceException(ex);
+ }
+ xm.getMimeHeaders().addHeader("Authorization",
"Basic " + credentials);
+ }
+ } else
+ if (propName.equals(BindingProvider.SESSION_MAINTAIN_PROPERTY))
+ {
+ Object maintainSession =
properties.get(BindingProvider.SESSION_MAINTAIN_PROPERTY);
+ if (maintainSession != null &&
maintainSession.equals(Boolean.TRUE))
+ {
+ Object cookieJar = properties.get(HTTP_COOKIE_JAR);
+ if (cookieJar != null)
+ messageContext.put(HTTP_COOKIE_JAR, cookieJar);
+ }
+ } else {
+ messageContext.put(propName, properties.get(propName));
+ }
+ }
+ }
+
+ // Set accept header depending on content negotiation property
+ String contentNegotiation = (String)
+ messageInfo.getMetaData(CONTENT_NEGOTIATION_PROPERTY);
+
+ String bindingId = getBindingId(messageInfo);
+
+ if (bindingId.equals(SOAPBinding.SOAP12HTTP_BINDING)) {
+ xm.getMimeHeaders().addHeader(ACCEPT_PROPERTY,
+ contentNegotiation != "none" ? SOAP12_XML_FI_ACCEPT_VALUE :
SOAP12_XML_ACCEPT_VALUE);
+ } else {
+ xm.getMimeHeaders().addHeader(ACCEPT_PROPERTY,
+ contentNegotiation != "none" ? XML_FI_ACCEPT_VALUE :
XML_ACCEPT_VALUE);
+ }
+
+ //setRequestHeaders
+ Map<String, List<String>> requestHeaders = (Map)
+ properties.get(MessageContext.HTTP_REQUEST_HEADERS);
+ //requestHeaders.
+ setMimeHeaders(requestHeaders, xm);
+
+ messageContext.put(BINDING_ID_PROPERTY, bindingId);
+
+ // SOAPAction: MIME header
+ RuntimeContext runtimeContext = (RuntimeContext)
messageInfo.getMetaData(JAXWS_RUNTIME_CONTEXT);
+ if (runtimeContext != null) {
+ JavaMethod javaMethod =
runtimeContext.getModel().getJavaMethod(messageInfo.getMethod());
+ if (javaMethod != null) {
+ String soapAction = ((org.jboss.com.sun.xml.ws.model.soap.SOAPBinding)
javaMethod.getBinding()).getSOAPAction();
+ header.clear();
+ if (soapAction == null) {
+ xm.getMimeHeaders().addHeader("SOAPAction",
"\"\"");
+ } else {
+ xm.getMimeHeaders().addHeader("SOAPAction", soapAction);
+ }
+ }
+ }
+
+ return messageContext;
+ }
+
+
+
+ protected void setConnection(MessageInfo messageInfo, Map<String, Object>
context) {
+ ClientTransportFactory clientTransportFactory = (ClientTransportFactory)
context.get(CLIENT_TRANSPORT_FACTORY);
+ WSConnection connection = null;
+ if (clientTransportFactory == null) {
+ clientTransportFactory = new HttpClientTransportFactory();
+ }
+ connection = clientTransportFactory.create(context);
+ messageInfo.setConnection(connection);
+ }
+
+ protected void setResponseType(Throwable e, MessageInfo messageInfo) {
+ //e.printStackTrace();
+ if (e instanceof RuntimeException) {
+ messageInfo.setResponseType(MessageStruct.UNCHECKED_EXCEPTION_RESPONSE);
+ if (e instanceof ClientTransportException) {
+ Throwable temp = e;
+ e = new WebServiceException(temp.getMessage(), temp);
+ }
+ } else {
+ messageInfo.setResponseType(MessageStruct.CHECKED_EXCEPTION_RESPONSE);
+ }
+ messageInfo.setResponse(e);
+ }
+
+ /*
+ * Orchestrates the receiving of a synchronous response
+ *
+ * @see
com.sun.pept.protocol.MessageDispatcher#receive(com.sun.pept.ept.MessageInfo)
+ *
+ * todo: exception handling with possible saaj error below
+ */
+ public void receive(MessageInfo messageInfo) {
+ // change from LogicalEPTFactory to ContactInfoBase - should be changed back when
we have things working
+ EPTFactory contactInfo = messageInfo.getEPTFactory();
+
+ XMLMessage xm = getXMLMessage(messageInfo);
+
+ // Content negotiation logic
+ String contentNegotiation = (String)
messageInfo.getMetaData(CONTENT_NEGOTIATION_PROPERTY);
+ // If XML request
+ if (contentNegotiation == "pessimistic") {
+ try {
+ if (xm.isFastInfoset()) {
+ Map requestContext = (Map)
messageInfo.getMetaData(JAXWS_CONTEXT_PROPERTY);
+ // Further requests will be send using FI
+ requestContext.put(CONTENT_NEGOTIATION_PROPERTY,
"optimistic");
+ }
+ }
+ catch (ClassCastException e) {
+ // Content negotiation fails
+ }
+ }
+
+ try {
+ //logResponseMessage(xm, messageInfo);
+ } catch (Exception ex) {
+ throw new WebServiceException(ex);
+ }
+
+ XMLHandlerContext handlerContext =
+ getInboundHandlerContext(messageInfo, xm);
+
+ HandlerChainCaller caller = getHandlerChainCaller(messageInfo);
+ if (caller.hasHandlers()) {
+ callHandlersOnResponse(handlerContext);
+ xm = handlerContext.getXMLMessage();
+ }
+
+ //set messageInfo response with appropriate result
+ //at same time sets ResponseContext
+ setResponse(messageInfo, xm, handlerContext);
+ }
+
+ private void setResponse(MessageInfo messageInfo, XMLMessage xm, HandlerContext
handlerContext) {
+
+ Map<String, DataHandler> attachments = getAttachments(handlerContext, xm);
+
+ updateResponseContext(messageInfo, (XMLHandlerContext)handlerContext,
attachments);
+
+ DispatchContext dispatchContext = (DispatchContext)
messageInfo.getMetaData(BindingProviderProperties.DISPATCH_CONTEXT);
+ DispatchContext.MessageType msgtype = (DispatchContext.MessageType)
dispatchContext.getProperty(DispatchContext.DISPATCH_MESSAGE);
+ if (msgtype != null) {
+ switch ((DispatchContext.MessageType) msgtype) {
+ case HTTP_SOURCE_MESSAGE:
+ messageInfo.setResponse(xm.getSource());
+ break;
+ case HTTP_SOURCE_PAYLOAD:
+ messageInfo.setResponse(xm.getSource());
+ break;
+ case HTTP_JAXB_PAYLOAD:
+ messageInfo.setResponse(xm.getPayload(getJAXBContext(messageInfo)));
+ break;
+ case HTTP_DATASOURCE_MESSAGE:
+ if (xm.getDataSource() != null)
+ messageInfo.setResponse(xm.getDataSource());
+ break;
+ default:
+ throw new WebServiceException("Unknown invocation return object
");
+ }
+ } else {
+ //tbd just assume source for now
+ throw new WebServiceException("Unknown invocation return object");
+ }
+
+ }
+
+ private Map<String, DataHandler> getAttachments(HandlerContext handlerContext,
XMLMessage xm) {
+ //are there attachments on the MessageContext properties ? Handlers
+ Map<String, DataHandler> attmc = (Map<String, DataHandler>)
+
handlerContext.getMessageContext().get(MessageContext.INBOUND_MESSAGE_ATTACHMENTS);
+ //can we get it from XMLMessage as well?
+ Map<String, DataHandler> attxm = xm.getAttachments();
+
+ Map<String, DataHandler> attachments = new HashMap<String,
DataHandler>();
+ if (attxm != null && attmc != null) {
+ attachments.putAll(attxm);
+ attachments.putAll(attmc);
+ } else if (attxm != null) {
+ attachments.putAll(attxm);
+ } else if (attmc != null)
+ attachments.putAll(attmc);
+ else {
+ attachments = null; //gc it
+ return null;
+ }
+ return attachments;
+ }
+
+ private XMLHandlerContext getInboundHandlerContext(
+ MessageInfo messageInfo, XMLMessage xm) {
+ XMLHandlerContext handlerContext = (XMLHandlerContext) messageInfo
+ .getMetaData(BindingProviderProperties.JAXWS_HANDLER_CONTEXT_PROPERTY);
+ if (handlerContext != null) {
+ handlerContext.setXMLMessage(xm);
+ handlerContext.setInternalMessage(null);
+ } else {
+ handlerContext = new XMLHandlerContext(messageInfo, null, xm);
+ }
+ return handlerContext;
+ }
+
+ /**
+ * Orchestrates the sending of an asynchronous request
+ */
+ protected void doSendAsync(final MessageInfo messageInfo) {
+ try { // should have already been caught
+ preSendHook(messageInfo);
+ XMLMessage xm = doSend(messageInfo);
+ postSendHook(messageInfo);
+
+ //pass a copy of MessageInfo to the future task,so that no conflicts
+ //due to threading happens
+ Response r = sendAsyncReceive(MessageInfoBase.copy(messageInfo), xm);
+ if (executorService == null) {
+ executorService =
+ Executors.newFixedThreadPool(MAX_THREAD_POOL_SIZE, new
DaemonThreadFactory());
+ }
+
+ AsyncHandlerService service = (AsyncHandlerService) messageInfo
+ .getMetaData(BindingProviderProperties.JAXWS_CLIENT_ASYNC_HANDLER);
+ WSFuture wsfuture = null;
+ if (service != null) {
+ wsfuture = service.setupAsyncCallback(r);
+ ((ResponseImpl) r).setUID(service.getUID());
+ ((ResponseImpl) r).setHandlerService(service);
+ }
+ executorService.execute((FutureTask) r);
+ if (service == null)
+ messageInfo.setResponse(r);
+ else
+ messageInfo.setResponse(wsfuture);
+
+ } catch (Throwable e) {
+ messageInfo.setResponse(e);
+ }
+ }
+
+ /**
+ * Orchestrates the receiving of an asynchronous response
+ */
+ protected Response<Object> sendAsyncReceive(final MessageInfo messageInfo,
final XMLMessage xm) {
+
+ final AsyncHandlerService handler = (AsyncHandlerService) messageInfo
+ .getMetaData(BindingProviderProperties.JAXWS_CLIENT_ASYNC_HANDLER);
+ final boolean callback = (messageInfo.getMEP() ==
MessageStruct.ASYNC_CALLBACK_MEP) ? true
+ : false;
+ if (callback && (handler == null))
+ throw new WebServiceException("Asynchronous callback invocation, but no
handler - AsyncHandler required");
+
+ final Response r = new ResponseImpl<Object>(new Callable<Object>() {
+
+ public Object call() throws Exception {
+ // get connection and do http.invoke()
+ try {
+ final WSConnection connection = (WSConnection)
messageInfo.getConnection();
+ //logRequestMessage(xm, messageInfo);
+ XMLConnectionUtil.sendResponse(connection, xm);
+ } catch (Throwable t) {
+ messageInfo.setResponse(t);
+
messageInfo.setResponseType(MessageStruct.UNCHECKED_EXCEPTION_RESPONSE);
+ }
+ // receive response
+ preReceiveHook(messageInfo);
+ try {
+ receive(messageInfo);
+ } catch (Exception ex) {
+ messageInfo.setResponse(ex);
+ }
+ postReceiveHook(messageInfo);
+
+ if (messageInfo.getResponse() instanceof Exception)
+ throw (Exception) messageInfo.getResponse();
+ return messageInfo.getResponse();
+ }
+ });
+ messageInfo.setMetaData(JAXWS_CLIENT_ASYNC_RESPONSE_CONTEXT, r);
+ return r;
+ }
+
+ protected boolean callHandlersOnRequest(XMLHandlerContext handlerContext) {
+
+ HandlerChainCaller caller = getHandlerChainCaller(
+ handlerContext.getMessageInfo());
+ boolean responseExpected = (handlerContext.getMessageInfo().getMEP() !=
+ MessageStruct.ONE_WAY_MEP);
+ try {
+ return caller.callHandlers(Direction.OUTBOUND,
+ RequestOrResponse.REQUEST, handlerContext, responseExpected);
+ } catch (ProtocolException pe) {
+ if (MessageContextUtil.ignoreFaultInMessage(
+ handlerContext.getMessageContext())) {
+ // Ignore fault in this case and use exception.
+ throw pe;
+ } else
+ return false;
+ } catch (WebServiceException wse) {
+ throw wse;
+ } catch (RuntimeException re) {
+ // handlers are expected to be able to throw RE
+ throw new WebServiceException(re);
+ }
+ }
+
+ /*
+ * User's handler can throw a RuntimeExceptions
+ * (e.g., a ProtocolException).
+ * Need to wrap any RuntimeException (other than WebServiceException) in
+ * WebServiceException.
+ */
+ protected boolean callHandlersOnResponse(XMLHandlerContext handlerContext) {
+ HandlerChainCaller caller = getHandlerChainCaller(
+ handlerContext.getMessageInfo());
+ try {
+ return caller.callHandlers(Direction.INBOUND,
+ RequestOrResponse.RESPONSE, handlerContext, false);
+ } catch (WebServiceException wse) {
+ throw wse;
+ } catch (RuntimeException re) {
+ // handlers are expected to be able to throw RE
+ throw new WebServiceException(re);
+ }
+ }
+
+ protected Binding getBinding(MessageInfo messageInfo) {
+ ContextMap context = (ContextMap) ((MessageInfoBase) messageInfo)
+ .getMetaData(BindingProviderProperties.JAXWS_CONTEXT_PROPERTY);
+ BindingProvider provider = (BindingProvider) context
+ .get(BindingProviderProperties.JAXWS_CLIENT_HANDLE_PROPERTY);
+ return provider.getBinding();
+ }
+
+ protected HandlerChainCaller getHandlerChainCaller(MessageInfo messageInfo) {
+ BindingImpl binding = (BindingImpl) getBinding(messageInfo);
+ return binding.getHandlerChainCaller();
+ }
+
+ protected void updateMessageContext(MessageInfo messageInfo,
+ XMLHandlerContext context) {
+
+ MessageContext messageContext = context.getMessageContext();
+ messageInfo.setMetaData(
+ BindingProviderProperties.JAXWS_HANDLER_CONTEXT_PROPERTY, context);
+ RequestContext ctxt = (RequestContext) messageInfo
+ .getMetaData(BindingProviderProperties.JAXWS_CONTEXT_PROPERTY);
+ Iterator i = ctxt.copy().getPropertyNames();
+ while (i.hasNext()) {
+ String name = (String) i.next();
+ Object value = ctxt.get(name);
+ messageContext.put(name, value);
+ }
+ }
+
+ protected void updateResponseContext(MessageInfo messageInfo,
+ XMLHandlerContext context, Map<String,
DataHandler> attachments) {
+
+
+ MessageContext messageContext = context.getMessageContext();
+ BindingProvider provider = (BindingProvider)
+ messageContext.get(JAXWS_CLIENT_HANDLE_PROPERTY);
+ ResponseContext responseContext = new ResponseContext(provider);
+ for (String name : messageContext.keySet()) {
+ MessageContext.Scope scope = messageContext.getScope(name);
+ if (MessageContext.Scope.APPLICATION == scope) {
+ Object value = messageContext.get(name);
+ responseContext.put(name, value);
+ }
+ }
+
+ //let's update status code
+ MessageContext mc = context.getMessageContext();
+ WSConnection con = messageInfo.getConnection();
+ Map<String, List<String>> headers = con.getHeaders();
+
+ responseContext.put(MessageContext.HTTP_RESPONSE_HEADERS, headers);
+ responseContext.put(MessageContext.HTTP_RESPONSE_CODE, con.getStatus());
+
+ //attachments for ResponseContext
+ if (attachments != null)
+ responseContext.put(MessageContext.INBOUND_MESSAGE_ATTACHMENTS, attachments);
+
+ ResponseImpl asyncResponse = (ResponseImpl) messageInfo.getMetaData(
+ JAXWS_CLIENT_ASYNC_RESPONSE_CONTEXT);
+ if (asyncResponse != null) {
+ asyncResponse.setResponseContext(responseContext.copy());
+ } else {
+ messageInfo.setMetaData(JAXWS_RESPONSE_CONTEXT_PROPERTY,
+ responseContext.copy());
+ }
+ }
+
+ /**
+ * @return true if message exchange pattern indicates asynchronous, otherwise returns
false
+ */
+ protected boolean isAsync(MessageInfo messageInfo) {
+ if ((messageInfo.getMEP() == MessageStruct.ASYNC_POLL_MEP)
+ || (messageInfo.getMEP() == MessageStruct.ASYNC_CALLBACK_MEP)) {
+ return true;
+ }
+ return false;
+ }
+
+ private void preSendHook(MessageInfo messageInfo) {
+ }
+
+ private void preReceiveHook(MessageInfo messageInfo) {
+ }
+
+ private void postSendHook(MessageInfo messageInfo) {
+ if (messageInfo.getResponseType() != MessageStruct.NORMAL_RESPONSE) {
+ postReceiveHook(messageInfo);
+ throw (WebServiceException) messageInfo.getResponse();
+ }
+ }
+
+ private void postReceiveAndDecodeHook(MessageInfo messageInfo) {
+ }
+
+ private void postReceiveHook(MessageInfo messageInfo) {
+
+ if (messageInfo.getMEP() == MessageStruct.ONE_WAY_MEP)
+ return;
+ Object response = messageInfo.getResponse();
+ if (response instanceof StreamSource) {
+ InputStream is = ((StreamSource) response).getInputStream();
+
+ Transformer transformer = XmlUtil.newTransformer();
+ try {
+ ByteArrayOutputStream out = new ByteArrayOutputStream(is.available());
+ if (out.size() > 0) {
+ transformer.transform((StreamSource) response,
+ new StreamResult(out));
+ byte[] bytes = out.toByteArray();
+ //could do to string
+ if (new String(bytes).indexOf("HTTPException") > -1)
+ throw new HTTPException(HttpURLConnection.HTTP_INTERNAL_ERROR);
+ else {
+ InputStream bis = new ByteArrayInputStream(bytes);
+ messageInfo.setResponse(new StreamSource(bis));
+ }
+ }
+ } catch (TransformerException e) {
+ throw new WebServiceException(e);
+ } catch (IOException e) {
+ throw new WebServiceException(e);
+ }
+ }
+ switch (messageInfo.getResponseType()) {
+ case MessageStruct.NORMAL_RESPONSE:
+ // not sure where this belongs yet - but for now-
+ return;
+ case MessageStruct.CHECKED_EXCEPTION_RESPONSE:
+ if (response instanceof Exception) {
+ throw new HTTPException(HttpURLConnection.HTTP_INTERNAL_ERROR);
+ }
+ return;
+ case MessageStruct.UNCHECKED_EXCEPTION_RESPONSE:
+ if (response instanceof ProtocolException) {
+ throw new HTTPException(HttpURLConnection.HTTP_INTERNAL_ERROR);
+ } else {
+ WebServiceException jex = null;
+ if (response instanceof Exception) {
+ throw new WebServiceException((Exception) response);
+ }
+ messageInfo.setResponse(response);
+ }
+ return;
+ default:
+ messageInfo.setResponse(response);
+ }
+ }
+
+ private void closeAllHandlers(XMLHandlerContext context) {
+ HandlerChainCaller caller = getHandlerChainCaller(
+ context.getMessageInfo());
+ if (caller != null && caller.hasHandlers()) {
+ caller.forceCloseHandlersOnClient(context);
+ }
+ }
+
+ /**
+ * This method is used to create the appropriate SOAPMessage (1.1 or 1.2 using SAAJ
api).
+ *
+ * @return the BindingId associated with messageInfo
+ */
+ protected String getBindingId(MessageInfo messageInfo) {
+ SOAPEncoder encoder = (SOAPEncoder) messageInfo.getEncoder();
+ if (encoder instanceof SOAPXMLEncoder)
+ return SOAPBinding.SOAP11HTTP_BINDING;
+ else if (encoder instanceof SOAP12XMLEncoder)
+ return SOAPBinding.SOAP12HTTP_BINDING;
+ else
+ return HTTPBinding.HTTP_BINDING;
+ }
+
+ /**
+ * Logs the SOAP request message
+ */
+ protected void logRequestMessage(XMLMessage request, MessageInfo messageInfo)
+ throws IOException, MessagingException, TransformerException {
+
+ OutputStream out = ((WSConnection) messageInfo.getConnection()).getDebug();
+
+ if (out != null) {
+ String s = "******************\nRequest\n";
+ out.write(s.getBytes());
+ for (Iterator iter =
+ request.getMimeHeaders().getAllHeaders();
+ iter.hasNext();
+ ) {
+ MimeHeader header = (MimeHeader) iter.next();
+ s = header.getName() + ": " + header.getValue() +
"\n";
+ out.write(s.getBytes());
+ }
+ out.flush();
+ request.writeTo(out);
+ s = "\n";
+ out.write(s.getBytes());
+ out.flush();
+ }
+ }
+
+ /**
+ * Logs the SOAP response message
+ */
+ protected void logResponseMessage(XMLMessage response, MessageInfo messageInfo)
+ throws IOException, MessagingException, TransformerException {
+
+ OutputStream out = ((WSConnection) messageInfo.getConnection()).getDebug();
+
+ if (out != null) {
+ String s = "Response\n";
+ out.write(s.getBytes());
+ s =
+ "Http Status Code: "
+ + ((WSConnection) messageInfo.getConnection()).getStatus()
+ + "\n\n";
+ out.write(s.getBytes());
+ for (Iterator iter =
+ response.getMimeHeaders().getAllHeaders();
+ iter.hasNext();
+ ) {
+ MimeHeader header = (MimeHeader) iter.next();
+ s = header.getName() + ": " + header.getValue() +
"\n";
+ out.write(s.getBytes());
+ }
+ out.flush();
+ response.writeTo(out);
+ s = "******************\n\n";
+ out.write(s.getBytes());
+ }
+ }
+
+ /*
+ * Gets XMLMessage from the connection
+ */
+ private XMLMessage getXMLMessage(MessageInfo messageInfo) {
+ WSConnection con = (WSConnection) messageInfo.getConnection();
+ return XMLConnectionUtil.getXMLMessage(con, messageInfo);
+ }
+
+ protected JAXBContext getJAXBContext(MessageInfo messageInfo) {
+ JAXBContext jc = null;
+ RequestContext context = (RequestContext)
messageInfo.getMetaData(BindingProviderProperties.JAXWS_CONTEXT_PROPERTY);
+ if (context != null)
+ jc = (JAXBContext)
context.get(BindingProviderProperties.JAXB_CONTEXT_PROPERTY);
+
+ return jc;
+ }
+
+ public void setHTTPContext(Map<String, Object> messageContext, DispatchContext
dispatchContext, Map requestContext) {
+
+ if (requestContext.get(MessageContext.HTTP_REQUEST_METHOD) != null)
+ messageContext.put(MessageContext.HTTP_REQUEST_METHOD,
requestContext.get(MessageContext.HTTP_REQUEST_METHOD));
+ if (requestContext.get(MessageContext.HTTP_REQUEST_HEADERS) != null)
+ messageContext.put(MessageContext.HTTP_REQUEST_HEADERS,
requestContext.get(MessageContext.HTTP_REQUEST_HEADERS));
+
+ //resolve endpoint look for query parameters, pathInfo
+ String origEndpoint = (String)
requestContext.get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
+
+ String pathInfo = null;
+ String queryString = null;
+ if (requestContext.get(MessageContext.PATH_INFO) != null) {
+ pathInfo = (String) requestContext.get(MessageContext.PATH_INFO);
+ }
+ if (requestContext.get(MessageContext.QUERY_STRING) != null) {
+ queryString = (String) requestContext.get(MessageContext.QUERY_STRING);
+ }
+
+ String resolvedEndpoint = null;
+ if (pathInfo != null || queryString != null) {
+ pathInfo = checkPath(pathInfo);
+ queryString = checkQuery(queryString);
+ if (origEndpoint != null) {
+ try {
+ URI endpointURI = new URI(origEndpoint);
+ resolvedEndpoint = resolveURI(endpointURI, pathInfo, queryString);
+ } catch (URISyntaxException e) {
+ resolvedEndpoint = origEndpoint;
+ }
+ }
+
+ requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
resolvedEndpoint);
+ messageContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
resolvedEndpoint);
+ }
+ }
+
+ protected String resolveURI(URI endpointURI, String pathInfo, String queryString) {
+ String query = null;
+ String fragment = null;
+ if (queryString != null) {
+ URI result = endpointURI.resolve(queryString);
+ query = result.getQuery();
+ fragment = result.getFragment();
+ }
+ //String path = (pathInfo != null) ? endpointURI.getPath() + pathInfo :
endpointURI.getPath();
+ String path = (pathInfo != null) ? pathInfo : endpointURI.getPath();
+ try {
+ URI temp = new URI(null, null, path, query, fragment);
+ return endpointURI.resolve(temp).toString();
+ } catch (URISyntaxException e) {
+ e.printStackTrace();
+ }
+ return endpointURI.toString();
+ }
+
+ private String checkPath(String path) {
+ //does it begin with /
+ return (path == null || path.startsWith("/")) ? path : "/" +
path;
+ }
+
+ private String checkQuery(String query) {
+ //does it begin with ?
+ return (query == null || query.startsWith("?")) ? query : "?"
+ query;
+ }
+
+ protected boolean isHTTPMessageType(DispatchContext dispatchContext) {
+
+ DispatchContext.MessageType type = (DispatchContext.MessageType)
+ dispatchContext.getProperty(DispatchContext.DISPATCH_MESSAGE);
+
+ if ((type == DispatchContext.MessageType.HTTP_DATASOURCE_MESSAGE) ||
+ //(type == DispatchContext.MessageType.HTTP_DATASOURCE_PAYLOAD) ||
+ (type == DispatchContext.MessageType.HTTP_SOURCE_MESSAGE) ||
+ (type == DispatchContext.MessageType.HTTP_SOURCE_PAYLOAD) ||
+ //(type == DispatchContext.MessageType.HTTP_JAXB_MESSAGE) ||
+ (type == DispatchContext.MessageType.HTTP_JAXB_PAYLOAD))
+ return true;
+
+ return false;
+ }
+
+ protected XMLMessage makeXMLMessage
+ (MessageInfo
+ messageInfo) {
+
+ XMLMessage xm = null;
+
+ Class clazz = (Class)
+ messageInfo.getMetaData(DispatchContext.DISPATCH_MESSAGE_CLASS);
+
+ Map<String, Object> context = (Map<String, Object>)
+ messageInfo.getMetaData(BindingProviderProperties.JAXWS_CONTEXT_PROPERTY);
+ Map<String, DataHandler> attachments = (context != null) ?
+ (Map<String, DataHandler>
)context.get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS) : null;
+
+ // Determine if Fast Infoset is to be used
+ boolean useFastInfoset =
+ (messageInfo.getMetaData(CONTENT_NEGOTIATION_PROPERTY) ==
"optimistic");
+
+ Object object = messageInfo.getData()[0];
+
+ if (clazz != null && clazz.isAssignableFrom(Source.class)) {
+ //xm = new XMLMessage((Source) object, useFastInfoset);
+ xm = new XMLMessage((Source) object, attachments, useFastInfoset);
+ } else if (clazz != null && clazz.isAssignableFrom(DataSource.class)) {
+ xm = new XMLMessage((DataSource) object, useFastInfoset);
+ } else {
+ xm = new XMLMessage(object, getJAXBContext(messageInfo), attachments,
useFastInfoset);
+ //xm = new XMLMessage(object, getJAXBContext(messageInfo), useFastInfoset);
+ }
+
+ return xm;
+ }
+
+ private void setMimeHeaders(Map<String, List<String>> requestHeaders,
XMLMessage xm) {
+
+ if ((requestHeaders != null) && (!requestHeaders.isEmpty())) {
+ Set<Map.Entry<String, List<String>>> headerSet =
requestHeaders.entrySet();
+ Iterator<Map.Entry<String, List<String>>> iter =
headerSet.iterator();
+ while (iter.hasNext()) {
+ Map.Entry<String,List<String>> entry =iter.next();
+ MimeHeaders headers = xm.getMimeHeaders();
+ String[] values = entry.getValue().toArray(new
String[entry.getValue().size()] );;
+ StringBuffer buf = new StringBuffer(250);
+ if (values.length > 0)
+ buf.append(values[0]);
+ else break;
+ for (int i = 1; i < values.length - 1; i++){
+ buf.append(values[i]);
+ }
+
+ headers.addHeader(entry.getKey(), buf.toString());
+ }
+ }
+ }
+
+ private XMLMessage updateXMLMessage(XMLHandlerContext context) {
+ // Create a new XMLMessage from existing message and OUTBOUND attachments property
+ MessageContext msgCtxt = context.getMessageContext();
+ Map<String, DataHandler> atts = (Map<String,
DataHandler>)msgCtxt.get(
+ MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);
+ if (atts != null) {
+ XMLMessage xmlMessage = context.getXMLMessage();
+ if (xmlMessage != null) {
+ Map<String, DataHandler> allAtts = xmlMessage.getAttachments();
+ if (allAtts != null) {
+ allAtts.putAll(atts);
+ } else {
+ allAtts = atts;
+ }
+ context.setXMLMessage(new XMLMessage(xmlMessage.getSource(), allAtts,
+ xmlMessage.isFastInfoset()));
+ } else {
+ //can I make a message w/o src
+ }
+
+ }
+ return context.getXMLMessage();
+ }
+
+
+ class DaemonThreadFactory implements ThreadFactory {
+ public Thread newThread(Runnable r) {
+ Thread daemonThread = new Thread(r);
+ daemonThread.setDaemon(Boolean.TRUE);
+ return daemonThread;
+ }
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/xml/client/XMLMessageDispatcher.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/xml/server/ProviderXMLMD.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/xml/server/ProviderXMLMD.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/xml/server/ProviderXMLMD.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,112 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.protocol.xml.server;
+
+import javax.xml.ws.Provider;
+import javax.xml.ws.Service;
+import javax.xml.ws.ServiceMode;
+import javax.xml.transform.Source;
+
+import javax.activation.DataSource;
+
+import org.jboss.com.sun.xml.ws.encoding.xml.XMLMessage;
+import org.jboss.com.sun.xml.ws.handler.XMLHandlerContext;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.pept.presentation.MessageStruct;
+import org.jboss.com.sun.xml.ws.server.RuntimeContext;
+import org.jboss.com.sun.xml.ws.server.RuntimeEndpointInfo;
+import org.jboss.com.sun.xml.ws.server.provider.ProviderModel;
+import org.jboss.com.sun.xml.ws.server.provider.ProviderPeptTie;
+import org.jboss.com.sun.xml.ws.util.MessageInfoUtil;
+
+import static org.jboss.com.sun.xml.ws.client.BindingProviderProperties.*;
+
+/**
+ * @author WS Development Team
+ *
+ */
+
+public class ProviderXMLMD extends XMLMessageDispatcher {
+
+ /*
+ * Fill the parameters, method in MessageInfo for Provider interface.
+ * invoke(Source, XMLHandlerContext) to Object[]
+ * invoke(SOAPMessage, XMLHandlerContext) to Object[]
+ */
+ @Override
+ protected void toMessageInfo(MessageInfo messageInfo, XMLHandlerContext context) {
+ Object[] data = new Object[1];
+ RuntimeContext rtCtxt = MessageInfoUtil.getRuntimeContext(messageInfo);
+ RuntimeEndpointInfo endpointInfo = rtCtxt.getRuntimeEndpointInfo();
+ Provider provider = (Provider)endpointInfo.getImplementor();
+ Class providerClass = provider.getClass();
+ ProviderModel model = endpointInfo.getProviderModel();
+ boolean isSource = model.isSource();
+ Service.Mode mode = model.getServiceMode();
+ XMLMessage xmlMessage = context.getXMLMessage();
+ try {
+ if (isSource) {
+ data[0] = xmlMessage.getSource();
+ } else {
+ data[0] = xmlMessage.getDataSource();
+ }
+ } catch(Exception e) {
+ messageInfo.setResponseType(MessageStruct.UNCHECKED_EXCEPTION_RESPONSE);
+ messageInfo.setResponse(e);
+ }
+ messageInfo.setData(data);
+ messageInfo.setMethod(ProviderPeptTie.invoke_Method);
+ }
+
+ /*
+ * MessageInfo contains the endpoint invocation results. If the endpoint
+ * returns a SOAPMessage, just set the object in HandlerContext. If the
+ * endpoint returns a Source in Mode.MESSAGE, it is converted to SOAPMessage
+ * and set in HandlerContext. If the endpoint returns a Source in
+ * Mode.PAYLOAD, it is set in InternalMessage, and InternalMessage is set
+ * in HandlerContext
+ */
+ @Override
+ protected void setResponseInContext(MessageInfo messageInfo,
+ XMLHandlerContext context) {
+ Object obj = messageInfo.getResponse();
+ RuntimeContext rtCtxt = MessageInfoUtil.getRuntimeContext(messageInfo);
+ RuntimeEndpointInfo endpointInfo = rtCtxt.getRuntimeEndpointInfo();
+ Provider provider = (Provider)endpointInfo.getImplementor();
+ Class providerClass = provider.getClass();
+
+ boolean useFastInfoset =
+ messageInfo.getMetaData(CONTENT_NEGOTIATION_PROPERTY) ==
"optimistic";
+
+ XMLMessage xmlMessage = null;
+ if (messageInfo.getResponseType() == MessageInfo.NORMAL_RESPONSE) {
+ xmlMessage = (obj instanceof DataSource)
+ ? new XMLMessage((DataSource)obj, useFastInfoset)
+ : new XMLMessage((Source)obj, useFastInfoset);
+ } else {
+ xmlMessage = new XMLMessage((Exception)obj, useFastInfoset);
+ }
+ context.setXMLMessage(xmlMessage);
+ context.setInternalMessage(null);
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/xml/server/ProviderXMLMD.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/xml/server/XMLMessageDispatcher.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/xml/server/XMLMessageDispatcher.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/xml/server/XMLMessageDispatcher.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,511 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.protocol.xml.server;
+import java.io.IOException;
+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;
+import javax.activation.DataHandler;
+import javax.xml.namespace.QName;
+import javax.xml.soap.MimeHeader;
+import javax.xml.soap.MimeHeaders;
+import javax.xml.ws.Binding;
+import javax.xml.ws.handler.MessageContext;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.xml.ws.handler.MessageContext.Scope;
+
+import org.jboss.com.sun.xml.ws.client.BindingProviderProperties;
+import org.jboss.com.sun.xml.ws.encoding.xml.XMLMessage;
+import org.jboss.com.sun.xml.ws.handler.HandlerChainCaller;
+import org.jboss.com.sun.xml.ws.handler.MessageContextUtil;
+import org.jboss.com.sun.xml.ws.handler.XMLHandlerContext;
+import org.jboss.com.sun.xml.ws.handler.HandlerChainCaller.Direction;
+import org.jboss.com.sun.xml.ws.handler.HandlerChainCaller.RequestOrResponse;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.pept.presentation.MessageStruct;
+import org.jboss.com.sun.xml.ws.pept.presentation.TargetFinder;
+import org.jboss.com.sun.xml.ws.pept.presentation.Tie;
+import org.jboss.com.sun.xml.ws.pept.protocol.MessageDispatcher;
+import org.jboss.com.sun.xml.ws.server.*;
+import org.jboss.com.sun.xml.ws.server.provider.ProviderModel;
+import org.jboss.com.sun.xml.ws.server.provider.ProviderPeptTie;
+import org.jboss.com.sun.xml.ws.spi.runtime.Invoker;
+import org.jboss.com.sun.xml.ws.spi.runtime.SystemHandlerDelegate;
+import org.jboss.com.sun.xml.ws.spi.runtime.WSConnection;
+import org.jboss.com.sun.xml.ws.spi.runtime.WebServiceContext;
+import org.jboss.com.sun.xml.ws.util.MessageInfoUtil;
+import org.jboss.com.sun.xml.ws.util.XMLConnectionUtil;
+
+import static
org.jboss.com.sun.xml.ws.client.BindingProviderProperties.CONTENT_NEGOTIATION_PROPERTY;
+
+/**
+ * @author WS Development Team
+ *
+ */
+public abstract class XMLMessageDispatcher implements MessageDispatcher {
+
+ private static final Logger logger = Logger.getLogger(
+ org.jboss.com.sun.xml.ws.util.Constants.LoggingDomain +
".server.xmlmd");
+
+ public XMLMessageDispatcher() {
+ }
+
+ public void send(MessageInfo messageInfo) {
+ // Not required for server
+ throw new UnsupportedOperationException();
+ }
+
+ // TODO: need to work the exception logic
+ public void receive(MessageInfo messageInfo) {
+ XMLMessage xmlMessage = null;
+ try {
+ xmlMessage = getXMLMessage(messageInfo);
+ } catch(Exception e) {
+ sendResponseError(messageInfo, e);
+ return;
+ }
+ // Set it before response is sent on transport. If transport creates
+ // any exception, this can be used not to send again
+ boolean sent = false;
+ try {
+
+ // If FI is accepted by client, set property to optimistic
+ if (xmlMessage.acceptFastInfoset()) {
+ messageInfo.setMetaData(CONTENT_NEGOTIATION_PROPERTY,
"optimistic");
+ }
+
+ XMLHandlerContext context = new XMLHandlerContext(messageInfo, null,
+ xmlMessage);
+ updateHandlerContext(messageInfo, context);
+
+
+ SystemHandlerDelegate shd = getSystemHandlerDelegate(messageInfo);
+ XmlInvoker implementor = new XmlInvoker(messageInfo, xmlMessage,
+ context, shd);
+ try {
+ if (shd == null) {
+ // Invokes request handler chain, endpoint, response handler chain
+ implementor.invoke();
+ } else {
+ context.setInvoker(implementor);
+ if (shd.processRequest(context.getSHDXMLMessageContext())) {
+ implementor.invoke();
+ context.getMessageContext().put(
+ MessageContext.MESSAGE_OUTBOUND_PROPERTY, Boolean.TRUE);
+ shd.processResponse(context.getSHDXMLMessageContext());
+ }
+ }
+ } finally {
+ sent = implementor.isSent(); // response is sent or not
+ }
+ if (!isOneway(messageInfo)) {
+ sent = true;
+ sendResponse(messageInfo, context);
+ } else if (!sent) {
+ // Oneway and request handler chain reversed the execution direction
+ sent = true;
+ sendResponseOneway(messageInfo);
+ }
+ } catch(Exception e) {
+ e.printStackTrace();
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ if (!sent) {
+ sendResponseError(messageInfo, e);
+ }
+ }
+ assert sent; // Make sure response is sent
+ }
+
+ protected abstract void toMessageInfo(MessageInfo messageInfo, XMLHandlerContext
context);
+
+ /*
+ * Gets XMLMessage from the connection
+ */
+ private XMLMessage getXMLMessage(MessageInfo messageInfo) {
+ WSConnection con = (WSConnection)messageInfo.getConnection();
+ return XMLConnectionUtil.getXMLMessage(con, messageInfo);
+ }
+
+ /**
+ * Invokes the endpoint
+ *
+ * In this case, Oneway is known only after invoking the endpoint. For other
+ * endpoints, the HTTP response code is sent before invoking the endpoint.
+ * This is taken care here after invoking the endpoint.
+ */
+ private void invokeEndpoint(MessageInfo messageInfo, XMLHandlerContext hc) {
+ TargetFinder targetFinder =
+ messageInfo.getEPTFactory().getTargetFinder(messageInfo);
+ Tie tie = targetFinder.findTarget(messageInfo);
+ tie._invoke(messageInfo);
+ }
+
+ protected XMLMessage getResponse(MessageInfo messageInfo, XMLHandlerContext context)
{
+ setResponseInContext(messageInfo, context);
+ try {
+ HandlerChainCaller handlerCaller =
+ getCallerFromMessageInfo(messageInfo);
+ if (handlerCaller != null && handlerCaller.hasHandlers()) {
+ int messageType = messageInfo.getResponseType();
+ if (messageType == MessageInfo.CHECKED_EXCEPTION_RESPONSE ||
+ messageType == MessageInfo.UNCHECKED_EXCEPTION_RESPONSE) {
+
+ callHandleFault(handlerCaller, context);
+ } else {
+ callHandlersOnResponse(handlerCaller, context);
+ }
+ }
+ } catch(Exception e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ boolean useFastInfoset =
+ messageInfo.getMetaData(CONTENT_NEGOTIATION_PROPERTY) ==
"optimistic";
+ XMLMessage xmlMessage = new XMLMessage(e, useFastInfoset);
+ context.setXMLMessage(xmlMessage);
+ }
+ // Create a new XMLMessage from existing message and OUTBOUND attachments
property
+ MessageContext msgCtxt = context.getMessageContext();
+ Map<String, DataHandler> atts = (Map<String,
DataHandler>)msgCtxt.get(
+ MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);
+ if (atts != null) {
+ XMLMessage xmlMessage = context.getXMLMessage();
+ Map<String, DataHandler> allAtts = xmlMessage.getAttachments();
+ if (allAtts != null) {
+ allAtts.putAll(atts);
+ } else {
+ allAtts = atts;
+ }
+ xmlMessage = new XMLMessage(xmlMessage.getSource(), allAtts,
+ xmlMessage.isFastInfoset());
+ context.setXMLMessage(xmlMessage);
+ }
+ return context.getXMLMessage();
+ }
+
+ /*
+ * MessageInfo contains the endpoint invocation results. The information
+ * is converted to XMLMessage and is set in HandlerContext
+ */
+ protected abstract void setResponseInContext(MessageInfo messageInfo,
+ XMLHandlerContext context);
+
+ /**
+ * Sends XMLMessage response on the connection
+ */
+ private void sendResponse(MessageInfo messageInfo, XMLHandlerContext ctxt)
+ throws IOException {
+ XMLMessage xmlMessage = ctxt.getXMLMessage();
+ MessageContext msgCtxt = ctxt.getMessageContext();
+ WSConnection con = messageInfo.getConnection();
+
+ // See if MessageContext.HTTP_STATUS_CODE is present
+ Integer status = MessageContextUtil.getHttpStatusCode(msgCtxt);
+ int statusCode = (status == null) ? xmlMessage.getStatus() : status;
+
+
+ Map<String, List<String>> headers = new HashMap<String,
List<String>>();
+
+ // put all headers from MessageContext.HTTP_RESPONSE_HEADERS
+ Map<String, List<String>> ctxtHdrs =
MessageContextUtil.getHttpResponseHeaders(msgCtxt);
+ if (ctxtHdrs != null) {
+ headers.putAll(ctxtHdrs);
+ }
+ // put all headers from XMLMessage
+ MimeHeaders mhs = xmlMessage.getMimeHeaders();
+ Iterator i = mhs.getAllHeaders();
+ while (i.hasNext()) {
+ MimeHeader mh = (MimeHeader) i.next();
+ String name = mh.getName();
+ List<String> values = headers.get(name);
+ if (values == null) {
+ values = new ArrayList<String>();
+ headers.put(name, values);
+ }
+ values.add(mh.getValue());
+ }
+
+ // Set HTTP status code
+ con.setStatus(statusCode);
+ // put response headers on the connection
+ con.setHeaders(headers);
+ // Write contents on the connection
+ xmlMessage.writeTo(con.getOutput());
+ con.closeOutput();
+ }
+
+ protected void sendResponseOneway(MessageInfo messageInfo) {
+ WSConnection con = (WSConnection)messageInfo.getConnection();
+ XMLConnectionUtil.sendResponseOneway(con);
+ }
+
+ private void sendResponseError(MessageInfo messageInfo, Exception e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ WSConnection con = (WSConnection)messageInfo.getConnection();
+ XMLConnectionUtil.sendResponseError(con, messageInfo);
+ }
+
+
+
+ /**
+ * Calls inbound handlers. It also calls outbound handlers incase flow is
+ * reversed. If the handler throws a ProtocolException, SOAP message is
+ * already set in the context. Otherwise, it creates InternalMessage,
+ * and that is used to create SOAPMessage.
+ *
+ * returns whether to invoke endpoint or not.
+ */
+ private boolean callHandlersOnRequest(MessageInfo messageInfo,
+ XMLHandlerContext context, boolean responseExpected) {
+
+ boolean skipEndpoint = false;
+ HandlerChainCaller handlerCaller =
+ getCallerFromMessageInfo(messageInfo);
+
+ if (handlerCaller != null && handlerCaller.hasHandlers()) {
+ skipEndpoint = !handlerCaller.callHandlers(Direction.INBOUND,
+ RequestOrResponse.REQUEST, context, responseExpected);
+ }
+ return skipEndpoint;
+ }
+
+ /**
+ * Use this to find out if handlers are there in the execution path or not
+ *
+ * @return true if there are handlers in execution path
+ * falst otherwise
+ */
+ private boolean hasHandlers(MessageInfo messageInfo) {
+ HandlerChainCaller handlerCaller =
+ getCallerFromMessageInfo(messageInfo);
+ return (handlerCaller != null && handlerCaller.hasHandlers()) ? true :
false;
+ }
+
+ private HandlerChainCaller getCallerFromMessageInfo(MessageInfo info) {
+ HandlerChainCaller caller = MessageInfoUtil.getHandlerChainCaller(info);
+ if (caller == null) {
+ RuntimeContext context = (RuntimeContext)
+ info.getMetaData(BindingProviderProperties.JAXWS_RUNTIME_CONTEXT);
+ Binding binding = context.getRuntimeEndpointInfo().getBinding();
+ caller = new HandlerChainCaller(binding.getHandlerChain());
+ MessageInfoUtil.setHandlerChainCaller(info, caller);
+ }
+ return caller;
+ }
+
+ protected boolean callHandlersOnResponse(HandlerChainCaller caller,
+ XMLHandlerContext context) {
+
+ return caller.callHandlers(Direction.OUTBOUND,
+ RequestOrResponse.RESPONSE, context, false);
+ }
+
+ /*
+ * Used when the endpoint throws an exception. HandleFault is called
+ * on the server handlers rather than handleMessage.
+ */
+ protected boolean callHandleFault(HandlerChainCaller caller, XMLHandlerContext
context) {
+ /*
+ return caller.callHandleFault(context);
+ */
+ return false;
+ }
+
+ /*
+ * Server does not know if a message is one-way until after
+ * the handler chain has finished processing the request. If
+ * it is a one-way message, have the handler chain caller
+ * call close on the handlers.
+ */
+ private void closeHandlers(MessageInfo info, XMLHandlerContext context) {
+ HandlerChainCaller handlerCaller = getCallerFromMessageInfo(info);
+ if (handlerCaller != null && handlerCaller.hasHandlers()) {
+ handlerCaller.forceCloseHandlersOnServer(context);
+ }
+ }
+
+ private static boolean isFailure(MessageInfo messageInfo) {
+ return (messageInfo.getResponseType() ==
MessageStruct.UNCHECKED_EXCEPTION_RESPONSE);
+ }
+
+ public static boolean isOneway(MessageInfo messageInfo) {
+ return (messageInfo.getMEP() == MessageStruct.ONE_WAY_MEP);
+ }
+
+ /*
+ * Sets the WebServiceContext with correct MessageContext which contains
+ * APPLICATION scope properties
+ */
+ protected void updateWebServiceContext(MessageInfo messageInfo, XMLHandlerContext hc)
{
+ RuntimeEndpointInfo endpointInfo =
+ MessageInfoUtil.getRuntimeContext(messageInfo).getRuntimeEndpointInfo();
+ WebServiceContext wsContext = endpointInfo.getWebServiceContext();
+ if (wsContext != null) {
+ AppMsgContextImpl appCtxt = new AppMsgContextImpl(hc.getMessageContext());
+ wsContext.setMessageContext(appCtxt);
+ }
+ }
+
+ /**
+ * copy from message info to handler context
+ */
+ private void updateHandlerContext(MessageInfo messageInfo,
+ XMLHandlerContext context) {
+
+ RuntimeEndpointInfo endpointInfo =
+ MessageInfoUtil.getRuntimeContext(messageInfo).getRuntimeEndpointInfo();
+ WebServiceContext wsContext = endpointInfo.getWebServiceContext();
+ if (wsContext != null) {
+ context.setMessageContext(wsContext.getMessageContext());
+ }
+ }
+
+ private SystemHandlerDelegate getSystemHandlerDelegate(MessageInfo mi) {
+ RuntimeContext rtCtxt = MessageInfoUtil.getRuntimeContext(mi);
+ RuntimeEndpointInfo endpointInfo = rtCtxt.getRuntimeEndpointInfo();
+ return endpointInfo.getBinding().getSystemHandlerDelegate();
+ }
+
+ /**
+ * This breaks the XMLMessage into source and attachments. A new XMLMessage
+ * is created with source and is set in XMLHandlerContext. The attachments
+ * are set in MessageContext as INBOUND attachments.
+ */
+ private void setInboundAttachments(MessageInfo messageInfo, XMLHandlerContext
context) {
+ if (hasHandlers(messageInfo)) {
+ XMLMessage xmlMessage = context.getXMLMessage();
+ Map<String, DataHandler> atts = xmlMessage.getAttachments();
+ if (atts != null) {
+ MessageContext msgCtxt = context.getMessageContext();
+ msgCtxt.put(MessageContext.INBOUND_MESSAGE_ATTACHMENTS, atts);
+ msgCtxt.setScope(MessageContext.INBOUND_MESSAGE_ATTACHMENTS,
MessageContext.Scope.APPLICATION);
+ xmlMessage = new XMLMessage(xmlMessage.getSource(),
xmlMessage.isFastInfoset());
+ context.setXMLMessage(xmlMessage);
+ }
+ }
+ }
+
+ /**
+ * This creates a new XMLMessage from existing source and inbound attachments.
+ * inbound attachements cannot be there if there are no handlers.
+ * If the endpoint is Provider<Source>, it doesn't create a new message.
+ */
+ private void processInboundAttachments(MessageInfo messageInfo, XMLHandlerContext
context) {
+ if (hasHandlers(messageInfo)) {
+ RuntimeContext rtCtxt = MessageInfoUtil.getRuntimeContext(messageInfo);
+ RuntimeEndpointInfo endpointInfo = rtCtxt.getRuntimeEndpointInfo();
+ ProviderModel model = endpointInfo.getProviderModel();
+ boolean isSource = model.isSource();
+ if (!isSource) {
+ XMLMessage xmlMessage = context.getXMLMessage();
+ MessageContext msgCtxt = context.getMessageContext();
+ Map<String, DataHandler> atts = (Map<String, DataHandler>)
+ msgCtxt.get(MessageContext.INBOUND_MESSAGE_ATTACHMENTS);
+ xmlMessage = new XMLMessage(xmlMessage.getSource(), atts,
xmlMessage.isFastInfoset());
+ context.setXMLMessage(xmlMessage);
+ }
+ }
+ }
+
+ /**
+ * Invokes request handler chain, endpoint and response handler chain.
+ * Separated as a separate class, so that SHD can call this in doPriv()
+ * block.
+ */
+ private class XmlInvoker implements Invoker {
+
+ MessageInfo messageInfo;
+ XMLMessage xmlMessage;
+ XMLHandlerContext context;
+ SystemHandlerDelegate shd;
+ boolean sent;
+
+ XmlInvoker(MessageInfo messageInfo, XMLMessage xmlMessage,
+ XMLHandlerContext context, SystemHandlerDelegate shd) {
+ this.messageInfo = messageInfo;
+ this.xmlMessage = xmlMessage;
+ this.context = context;
+ this.shd = shd;
+ }
+
+ public void invoke() throws Exception {
+ boolean skipEndpoint = false;
+
+ // Sets INBOUND_MESSAGE_ATTACHMENTS in MessageContext
+ setInboundAttachments(messageInfo, context);
+ // Call inbound handlers. It also calls outbound handlers incase of
+ // reversal of flow.
+ skipEndpoint = callHandlersOnRequest(messageInfo, context, true);
+
+ if (!skipEndpoint) {
+ // new XMLMessage is created using INBOUND_MESSAGE_ATTACHMENTS
+ // in MessageContext
+ processInboundAttachments(messageInfo, context);
+ toMessageInfo(messageInfo, context);
+ if (!isFailure(messageInfo)) {
+ if (shd != null) {
+ shd.preInvokeEndpointHook(context.getSHDXMLMessageContext());
+ }
+ updateWebServiceContext(messageInfo, context);
+ invokeEndpoint(messageInfo, context);
+ // For Provider endpoints Oneway is known only after executing
endpoint
+ if (!sent && isOneway(messageInfo)) {
+ sent = true;
+ sendResponseOneway(messageInfo);
+ }
+ }
+
+ if (isOneway(messageInfo)) {
+ if (isFailure(messageInfo)) {
+ // Just log the error. Not much to do
+ }
+ } else {
+ updateHandlerContext(messageInfo, context);
+ xmlMessage = getResponse(messageInfo, context);
+ context.setXMLMessage(xmlMessage);
+ }
+ }
+ }
+
+ /**
+ * Gets the dispatch method in the endpoint for the payload's QName
+ *
+ * @return dispatch method
+ */
+ public Method getMethod(QName name) {
+ return ProviderPeptTie.invoke_Method;
+ }
+
+ /*
+ * Is the message sent on transport. Happens when the operation is oneway
+ *
+ * @return true if the message is sent
+ * false otherwise
+ */
+ public boolean isSent() {
+ return sent;
+ }
+ }
+}
+
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/protocol/xml/server/XMLMessageDispatcher.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/client.properties
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/client.properties
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/client.properties 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,21 @@
+#
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+#
+http.client.cannot.connect=cannot connect to server: {0}
+http.client.failed=HTTP transport error: {0}
+local.client.failed=local transport error: {0}
+http.client.cannotCreateMessageFactory=cannot create message factory
+http.client.unauthorized=request requires HTTP authentication: {0}
+http.not.found=HTTP Status-Code 404: Not Found - {0}
+http.status.code=HTTP Status-Code {0}: {1}
+invalid.port.name={0} is not a valid port. Valid ports:{1}
+invalid.binding.id=Invalid binding id: {0}. Must be: {1}
+invalid.soap.role.none=Cannot set SOAP 1.2 role "none"
+non.logical.handler.set=Cannot set {0} on binding. Handler must be a LogicalHandler.
+runtime.parser.wsdl.invalidElement=invalid element \"{1}\" in the WSDL (line
{0})
+service.noServiceName=Can't create service! Service name must be non-null
+service.noWSDLUrl=No wsdl metadata with the Service, can't create proxy! Try creating
Service by providing a WSDL URL
+service.invalidPort=Port {0} is not found in service {1} in the wsdl {2}
+service.noPortName=No corresponding port found for the service interface {0} in {1}
+service.invalidServiceName=Cannot create Service instance, service {0} not found in the
WSDL {1}
\ No newline at end of file
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/dispatch.properties
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/dispatch.properties
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/dispatch.properties 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,4 @@
+#
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+#
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/encoding.properties
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/encoding.properties
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/encoding.properties 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,19 @@
+#
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+#
+
+#nested
+nestedSerializationError=serialization error: {0}
+nestedDeserializationError=deserialization error: {0}
+nestedEncodingError=encoding error: {0}
+
+
+#EncoderDecoder
+exception.notfound=exception class: {0} not found in the model!
+exception.incorrectType=incorrect type. Expected java.lang.Exception, found {0}
+incorrect.messageinfo=can't write object! unexpected type: {0}
+unknown.object=don\'t know how to write object: {0}
+xsd.unknownPrefix=unknown prefix \"{0}\"
+xsd.unexpectedElementName=unexpected element name: expected={0}, actual: {1}
+mime.contentId.part=Can't associated the Content-ID \"{0}\" to a WSDL part,
the Content-Id might not be formatted as per R2933 defined in AP 1.0.
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/handler.properties
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/handler.properties
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/handler.properties 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,10 @@
+#
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+#
+handler.nestedError=handler error: {0}
+handler.chain.contains.handler.only=A HandlerChain can only contain Handler instances:
{0}
+cannot.instantiate.handler=Unable to instantiate handler: {0} because: {1}
+cannot.extend.handler.directly=Handler {0} must implement LogicalHandler or SOAPHandler.
+handler.not.valid.type= {0} does not implement one of the handler interfaces.
+handler.messageContext.invalid.class= \"{0}\" is not an allowed value for the
property \"{1}\"
\ No newline at end of file
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/httpserver.properties
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/httpserver.properties
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/httpserver.properties 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,8 @@
+#
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+#
+
+html.title=Web Services
+html.notFound=<h1>404 Not Found: {0}</h1>
+unexpected.http.method=Cannot handle HTTP method: {0}
\ No newline at end of file
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/modeler.properties
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/modeler.properties
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/modeler.properties 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,16 @@
+#
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+#
+nestedModelernError=runtime modeler error: {0}
+
+runtime.modeler.no.webservice.annotation=A WebService annotation is not present on class:
{0}
+runtime.modeler.endpoint.interface.no.webservice=The Endpoint Interface: {0} does not
have WebService Annotation
+runtime.modeler.class.not.found=class: {0} could not be found
+runtime.modeler.method.not.found=method: {0} could not be found on class: {1}
+runtime.modeler.oneway.operation.no.out.parameters=oneway operation should not have out
parameters class: {0} method: {1}
+runtime.modeler.cannot.get.serviceName.from.interface=The serviceName cannot be retrieved
from an interface. class {0}
+runtime.modeler.portname.servicename.namespace.mismatch=The namespace of the serviceName
\"{0}\" and the namespace of the portName \"{1}\" must match
+runtime.modeler.no.package=A @WebService.targetNamespace must be specified on classes
with no package. Class: {0}
+runtime.modeler.no.operations=The web service defined by the class {0} does not contain
any valid WebMethods.
+runtime.operation.noBinding=Binding for operation {0} in port {1} not found! Probably
WSDL doesn't contain binding for this operation.
\ No newline at end of file
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/sender.properties
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/sender.properties
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/sender.properties 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,10 @@
+#
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+#
+sender.nestedError=sender error: {0}
+sender.request.messageNotReady=message not ready to be sent
+sender.response.cannotDecodeFaultDetail=fault detail cannot be decoded
+sender.request.illegalValueForContentNegotiation=illegal value for content negotiation
property \"{0}\"
+
+
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/server.properties
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/server.properties
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/server.properties 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,59 @@
+#
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+#
+
+soapdecoder.err=Error in decoding SOAP Message
+server.rt.err=Server Runtime Error: {0}
+soapencoder.err=Error in encoding SOAP Message
+
+annotation.only.once=Only one method should have the annotation \"{0}\"
+not.zero.parameters=Method \"{0}\" shouldn''t have any arguments
+
+wrong.field.type=Incorrect type for field \"{0}\"
+wrong.no.parameters=Incorrect no of arguments for method \"{0}\"
+wrong.parameter.type=Incorrect argument types for method \"{0}\"
+
+can.not.generate.wsdl=Cannot generate WSDL for binding \"{0}\"
+generate.non.standard.wsdl=Generating non-standard WSDL for the specified binding
+null.implementor=Implementor cannot be null
+
+runtime.wsdl.patcher=error while patching WSDL related document
+
+not.implement.provider=Class \"{0}\" doesn't implement Provider
+wsdl.required=wsdl is required
+service.name.required=Service QName is not found
+port.name.required=Port QName is not found
+wrong.tns.for.port=Port namespace {0} doesn't match Service namespace {1}
+
+already.http.server=There is already a HTTP server at : {0}
+already.https.server=There is already a HTTPS server at : {0}
+not.HttpContext.type=Required com.sun.net.httpserver.HttpContext. Got : {0}
+
+cannot.load.wsdl=WSDL cannot be loaded from given location : {0}
+
+not.primary.wsdl=WSDL specified by wsdlLocation={0} is not a primary WSDL.
+duplicate.primary.wsdl=Metadata has more than one WSDL that has Service definiton for the
endpoint. WSDL={0} is one such WSDL.
+duplicate.abstract.wsdl=Metadata has more than one WSDL that has PortType definiton for
the endpoint. WSDL={0} is one such WSDL.
+no.ws.annotation=Endpoint implementation {0} doesn''t have @WebService or
@WebServiceProvider annotation
+both.ws.annotations=Endpoint implementation {0} cannot have both @WebService and
@WebServiceProvider annotations
+
+runtime.parser.wrong.wsdl.location=Incorrect WSDL localtion: {0}. It should start with
WEB-INF/wsdl
+runtime.parser.classNotFound=class not found in runtime descriptor: {0}
+runtime.parser.xmlReader=error parsing runtime descriptor: {0}
+runtime.parser.invalidReaderState=error parsing runtime descriptor: {0}
+runtime.parser.unexpectedContent=unexpected content in runtime descriptor (line {0})
+runtime.parser.invalidElement=invalid element \"{1}\" in runtime descriptor
(line {0})
+runtime.parser.invalidAttributeValue=invalid value for attribute \"{2}\" of
element \"{1}\" in runtime descriptor (line {0})
+runtime.parser.invalidVersionNumber=unsupported runtime descriptor version: {2}
+runtime.parser.missing.attribute=missing attribute \"{2}\" in element
\"{1}\" of runtime descriptor (line {0})
+runtime.parser.invalid.attribute.value=invalid attribute value \"{1}\" in
runtime descriptor (line {0})
+runtime.parser.missing.attribute.no.line=missing attribute \"{2}\" in element
\"{1}\" of runtime descriptor
+runtime.parser.wrong.element=found element \"{1}\", expected \"{2}\"
in runtime descriptor (line {0})
+runtime.parser.wsdl=exception during WSDL parsing: {0}
+runtime.saxparser.exception={0}\n{1}
+runtime.parser.wsdl.noservice=can\'t apply binding! service {0} not found in the WSDL
{1}
+runtime.parser.wsdl.nobinding=can\'t apply binding! no binding found for binding ID
{0] for service {1} in WSDL {2}
+runtime.parser.wsdl.multiplebinding=multiple bindings found for binding ID {0} for
service {1} in WSDL {2}
+runtime.parser.wsdl.incorrectserviceport=could not get binding from WSDL! service: {0} or
port {1} not found in the WSDL {2}
+
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/soap.properties
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/soap.properties
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/soap.properties 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,9 @@
+#
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+#
+soap.msg.create.err=Couldn''t create SOAP message due to exception: {0}
+soap.msg.factory.create.err=Couldn''t create SOAP message factory due to
exception: {0}
+soap.protocol.invalidFaultCode=Invalid fault code: {0}
+soap.factory.create.err=Couldn''t create SOAP factory due to exception: {0}
+soap.fault.create.err=Couldn''t create SOAP Fault due to exception: {0}
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/streaming.properties
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/streaming.properties
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/streaming.properties 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,28 @@
+#
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+#
+streaming.ioException=XML parsing error: {0}
+streaming.parseException=XML parsing error: {0}
+
+xmlreader.illegalStateEncountered=XML reader internal error: illegal state ({0})
+xmlreader.unexpectedCharacterContent=XML reader error: unexpected character content:
\"{0}\"
+xmlreader.ioException=XML reader error: {0}
+xmlreader.parseException=XML parsing error: {0}
+xmlreader.nestedError=XML reader error: {0}
+
+xmlwriter.noPrefixForURI=XML writer error: no prefix for URI: \"{0}\"
+xmlwriter.ioException=XML writer error: {0}
+xmlwriter.nestedError=XML writer error: {0}
+xmlreader.unexpectedState=unexpected XML reader state. expected: {0} but found: {1}
+xmlreader.unexpectedState.message=unexpected XML reader state. expected: {0} but found:
{1}. {2}
+xmlreader.unexpectedState.tag=unexpected XML tag. expected: {0} but found: {1}
+
+xmlrecorder.recording.ended=no more recorded elements available
+
+stax.cantCreate=Unable to create StAX reader or writer
+staxreader.xmlstreamexception=XML stream reader exception: {0}
+
+fastinfoset.noImplementation=Unable to locate compatible implementation of Fast Infoset
in classpath
+
+sourcereader.invalidSource=Unable to create reader from source \"{0}\"
\ No newline at end of file
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/util.properties
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/util.properties
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/util.properties 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,12 @@
+#
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+#
+util.handler.no.webservice.annotation="A WebService annotation is not present on
class: {0}"
+util.handler.endpoint.interface.no.webservice="The Endpoint Interface: {0} does not
have WebService Annotation"
+util.handler.class.not.found="Class: {0} could not be found"
+util.handler.cannot.combine.soapmessagehandlers=You must use HanlderChain annotation, not
SOAPMessageHandlers
+util.parser.wrong.element=found element \"{1}\", expected \"{2}\" in
handler chain configuration (line {0})
+util.failed.to.find.handlerchain.file=Could not find handler chain file {1} for class
{0}
+util.failed.to.parse.handlerchain.file=Could not parse handler chain file {1} for class
{0}
+
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/wsservlet.properties
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/wsservlet.properties
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/wsservlet.properties 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,214 @@
+#
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+#
+# the following properties are used by the http package
+listener.parsingFailed=WSSERVLET11: failed to parse runtime descriptor: {0}
+JAXRPCSERVLET11.diag.cause.1=WSRuntimeInfoParser cauld not parse sun-jaxws.xml runtime
descriptor
+WSSERVLET11.diag.check.1=Please check the sun-jaxws.xml file to make sure it is correct
+WSSERVLET11.diag.cause.2=The sun-jaxws.xml runtime deployment descriptor may be missing
+WSSERVLET11.diag.check.2=Please check the jaxrpc-ri.xml file to make sure it is present
in the war file
+
+
+listener.info.initialize=WSSERVLET12: JAX-WS context listener initializing
+WSSERVLET12.diag.cause.1=Context listener starting
+WSSERVLET12.diag.check.1=Normal web service startup
+
+listener.info.destroy=WSSERVLET13: JAX-WS context listener destroyed
+WSSERVLET13.diag.cause.1=Context listener shutdown
+WSSERVLET13.diag.check.1=Normal web service shutdown
+
+servlet.info.initialize=WSSERVLET14: JAX-WS servlet initializing
+WSSERVLET14.diag.cause.1=Web Services servlet starting up.
+WSSERVLET14.diag.check.1=Normal Web Service deployment. Deployment of service complete.
+
+servlet.info.destroy=WSSERVLET15: JAX-WS servlet destroyed
+WSSERVLET15.diag.cause.1=Web Services servlet shutdown.
+WSSERVLET15.diag.check.1=Normal Web service undeployment. Undeployment complete.
+
+servlet.warning.missingContextInformation=WSSERVLET16: missing context information
+WSSERVLET16.diag.cause.1=The jaxrpc-ri.xml file may be missing from the war file
+WSSERVLET16.diag.check.1=Unjar the service war file; check to see that the
jaxrpc-ri-runtime.xml file is present
+
+
+servlet.warning.duplicateEndpointName=WSSERVLET17: duplicate endpoint name
+WSSERVLET17.diag.cause.1=Two or more endpoints with the same name where found in the
jaxrpc-ri.xml runtime descriptor
+WSSERVLET17.diag.check.1=Note that this may cause problems with service deployment
+
+
+servlet.info.emptyRequestMessage=WSSERVLET18: got empty request message
+WSSERVLET18.diag.cause.1=Message sent by client is empty
+WSSERVLET18.diag.check.1=This may or may not be intentional. If not examine client
program for errors.
+
+servlet.trace.gotRequestForEndpoint=WSSERVLET19: got request for endpoint: {0}
+WSSERVLET19.diag.cause.1=Client request for this endpoint arrived
+WSSERVLET19.diag.check.1=Informational message only. Normal operation.
+
+servlet.error.noImplementorForEndpoint=WSSERVLET20: no implementor for endpoint: {0}
+WSSERVLET20.diag.cause.1=Implementation for this service can not be found
+WSSERVLET20.diag.check.1=Unzip the war, are the tie and serializer classes found?
+
+servlet.trace.invokingImplementor=WSSERVLET21: invoking implementor: {0}
+WSSERVLET21.diag.cause.1=The Web service is being invoked
+WSSERVLET21.diag.check.1=Normal web service invocation.
+
+servlet.error.noEndpointSpecified=WSSERVLET22: no endpoint specified
+WSSERVLET22.diag.cause.1=A request was invoked with no endpoint
+WSSERVLET22.diag.check.1=Set endpoint with stub.setTargetEndpoint property
+
+servlet.error.noResponseMessage=WSSERVLET23: no response message
+WSSERVLET23.diag.cause.1=The request generated no response from the service
+WSSERVLET23.diag.check.1=If a response was expected, check that a request message was
actually sent
+WSSERVLET23.diag.cause.1=The request generated no response from the service
+WSSERVLET23.diag.check.2=The request may be malformed and be accepted by the service, yet
did not generate a response
+
+servlet.trace.writingFaultResponse=WSSERVLET24: writing fault response
+WSSERVLET24.diag.cause.1=SOAPFault message is being returned to the client.
+WSSERVLET24.diag.check.1=Tracing message fault recorded.
+
+servlet.trace.writingSuccessResponse=WSSERVLET25: writing success response
+WSSERVLET25.diag.cause.1=SOAPMessage response is being returned to client
+WSSERVLET25.diag.check.1=Tracing message, normal response.
+
+servlet.warning.duplicateEndpointUrlPattern=WSSERVLET26: duplicate URL pattern in
endpoint: {0}
+WSSERVLET26.diag.cause.1=The endpoint URL is a duplicate
+WSSERVLET26.diag.check.1=This may cause a problem, please remove duplicate endpoints
+
+servlet.warning.ignoringImplicitUrlPattern=WSSERVLET27: unsupported implicit URL pattern
in endpoint: {0}
+WSSERVLET27.diag.cause.1=Implicit URLS are not supported in this realease
+WSSERVLET27.diag.check.1=Remove the implicit URL
+
+servlet.faultstring.missingPort=WSSERVLET28: Missing port information
+WSSERVLET28.diag.cause.1=Target endpoint is null
+WSSERVLET28.diag.check.1=Set target endpoint with stub.setTargetEndpoint() property.
+
+servlet.faultstring.portNotFound=WSSERVLET29: Port not found ({0})
+WSSERVLET29.diag.cause.1=A port is specified, but a corresponding service implementation
is not found
+WSSERVLET29.diag.check.1=Is the port valid? Unzip the war file and make sure the tie and
serializers are present
+
+servlet.faultstring.internalServerError=WSSERVLET30: Internal server error ({0})
+WSSERVLET30.diag.cause.1=There was a server error processing the request
+WSSERVLET30.diag.check.1=This could be due to a number of causes. Check the server log
file for exceptions.
+
+error.servlet.caughtThrowableWhileRecovering=WSSERVLET51: caught throwable while
recovering from a previous exception: {0}
+WSSERVLET51.diag.cause.1=Service processing of the request generated an exception; while
attempting to return a SOAPPFaultMessage a thowable was again generated
+WSSERVLET51.diag.check.1=Check the server.xml log file for exception information
+
+error.servlet.caughtThrowable=WSSERVLET49: caught throwable: {0}
+WSSERVLET49.diag.cause.1=Service processing of the request generated an exception; while
attempting to return a SOAPFaultMessage a thowable was again generated
+WSSERVLET49.diag.check.1=Check the server.xml log file for exception information
+
+error.servlet.caughtThrowableInInit=WSSERVLET50: caught throwable during servlet
initialization: {0}
+WSSERVLET50.diag.cause.1=WS runtime sun-jaxws.xml or web.xml may be incorrect
+WSSERVLET50.diag.check.1=Verify that sun-jaxws.xml and web.xml are correct in the service
war file
+WSSERVLET50.diag.cause.2=Application server deployment descriptors may be incorrect
+WSSERVLET50.diag.check.2=Verify that Application server deployment descriptors are
correct in the service war file
+WSSERVLET50.diag.cause.3=There may some Application Server initialization problems
+WSSERVLET50.diag.check.3=Check the server.xml file in the domain directory for failures
+
+publisher.info.applyingTransformation=WSSERVLET31: applying transformation with actual
address: {0}
+WSSERVLET31.diag.cause.1=Transformation being applied
+WSSERVLET31.diag.check.1=Normal operation
+
+publisher.info.generatingWSDL=WSSERVLET32: generating WSDL for endpoint: {0}
+WSSERVLET32.diag.cause.1=WSDL being generated
+WSSERVLET32.diag.check.1=Normal Operation.
+
+exception.cannotCreateTransformer=WSSERVLET33: cannot create transformer
+WSSERVLET33.diag.cause.1=When publishing the service wsdl, the http location is patched
with the deployed location/endpoint using XSLT transformation. The transformer could not
be created to do the transformation.
+WSSERVLET33.diag.check.1=There maybe a tranformation engine being used that is not
compatible. Make sure you are using the correct transformer and version.
+WSSERVLET33.diag.cause.2=When publishing the service wsdl, the http location is patched
with the deployed location/endpoint using XSLT transformation. The transformer could not
be created to do the transformation.
+WSSERVLET33.diag.check.2=There maybe a tranformation engine may not be supported or
compatible. Check the server.xml file for exceptions.
+
+
+exception.transformationFailed=WSSERVLET34: transformation failed : {0}
+WSSERVLET34.diag.cause.1=The location patching on the wsdl failed when attempting to
transform.
+WSSERVLET34.diag.check.1=Check the log file(s) for more detailed errors/exceptions.
+
+exception.templateCreationFailed=WSSERVLET35: failed to create a template object
+WSSERVLET35.diag.cause.1=A XSLT stylesheet template is create for the wsdl location
patching using transformation. Template create failed.
+WSSERVLET35.diag.check.1=An exception was thrown during creation of the template. View
exception and stacktrace for more details.
+
+servlet.html.method=WSSERVLET63: must use Post for this type of request
+WSSERVLET63.diag.cause.1=Web service requests must use HTTP POST method: WSI BP 1.0
+WSSERVLET63.diag.check.1=Make sure that your HTTP client is using POST requests, not GET
requests
+
+
+servlet.faultstring.invalidContentType=WSSERVLET64: Invalid Content-Type, text/xml
required
+WSSERVLET64.diag.cause.1=Web service requests must be a content type text/xml: WSI BP
1.0
+WSSERVLET64.diag.check.1=Make sure the client request is using text/xml
+
+error.implementorFactory.newInstanceFailed=WSSERVLET43: failed to instantiate service
implementor for port \"{0}\"
+WSSERVLET43.diag.cause.1=Instantiation of the web service failed.
+WSSERVLET43.diag.check.1=Make sure web service is available and public. Examine exception
for more details
+
+error.implementorFactory.servantInitFailed=WSSERVLET44: failed to initialize the service
implementor for port \"{0}\"
+WSSERVLET44.diag.cause.1=The web service was instantiated, however, it could not be
initialized
+WSSERVLET44.diag.check.1=Check the exception for more details. Make sure all the
configuration files are correct.
+
+#not used by anything currently
+servlet.faultstring.invalidSOAPAction=WSSERVLET65: Invalid Header SOAPAction required
+WSSERVLET65.diag.cause.1=SOAP Action is required
+WSSERVLET65.diag.check.1=Add SOAPAction and appropriate value
+
+servlet.html.title= Web Services
+servlet.html.title2=<h1>Web Services</h1>
+servlet.html.noInfoAvailable=<p>No JAX-WS context information available.</p>
+servlet.html.columnHeader.portName=Port Name
+servlet.html.columnHeader.status=Status
+servlet.html.columnHeader.information=Information
+servlet.html.status.active=ACTIVE
+servlet.html.status.error=ERROR
+servlet.html.information.table=<table
border\='0'><tr><td>Address\:</td><td>{0}</td></tr><tr><td>WSDL\:</td><td><a
href\="{3}">{3}</a></td></tr><tr><td>Port
QName\:</td><td>{1}</td></tr><tr><td>Implementation
class\:</td><td>{2}</td></tr></table>
+servlet.html.notFound=<h1>404 Not Found: {0}</h1>
+
+
+#
+#
+# all the following properties are used by the http/ea package
+# these properties are not longer used as http/ea is no longer used
+#
+error.implementorFactory.noConfiguration=WSSERVLET36: no configuration specified
+error.implementorFactory.noInputStream=WSSERVLET37: no configuration specified
+error.implementorRegistry.unknownName=WSSERVLET38: unknown port name: {0}
+error.implementorRegistry.cannotReadConfiguration=WSSERVLET39: cannot read configuration
+error.implementorRegistry.classNotFound=WSSERVLET40: class not found: {0}
+error.implementorRegistry.incompleteInformation=WSSERVLET41: configuration information is
incomplete
+error.implementorRegistry.duplicateName=WSSERVLET42: duplicate port name: {0}
+
+error.implementorRegistry.fileNotFound=WSSERVLET45: file not found: {0}
+error.wsdlPublisher.cannotReadConfiguration=WSSERVLET46: cannot read configuration
+error.servlet.init.config.parameter.missing=WSSERVLET47: cannot find configuration
parameter: \"{0}\"
+error.servlet.init.config.fileNotFound=WSSERVLET48: config file: \"{0}\" not
found
+#
+
+error.servlet.noImplementorForPort=WSSERVLET52: no implementor registered for port: {0}
+error.servlet.noPortSpecified=WSSERVLET53: no port specified in HTTP POST request URL
+error.servlet.noResponseWasProduced=WSSERVLET54: no response was produced (internal
error)
+#
+info.servlet.gotEmptyRequestMessage=WSSERVLET55: got empty request message
+info.servlet.initializing=WSSERVLET56: JAX-WS servlet: init
+info.servlet.destroying=WSSERVLET57: JAX-WS servlet: destroy
+#
+trace.servlet.requestForPortNamed=WSSERVLET58: got request for port: {0}
+trace.servlet.handingRequestOverToImplementor=WSSERVLET59: handing request over to
implementor: {0}
+trace.servlet.gotResponseFromImplementor=WSSERVLET60: got response from implementor: {0}
+trace.servlet.writingFaultResponse=WSSERVLET61: writing fault response
+trace.servlet.writingSuccessResponse=WSSERVLET62: writing success response
+#
+html.nonRootPage.title= Web Service
+html.nonRootPage.body1= <p>A Web Service is installed at this URL.</p>
+html.nonRootPage.body2= <p>Invalid request URI.</p><p>Please check your
deployment information.</p>
+html.nonRootPage.body3a= <p>Please refer to <a href=\'
+html.nonRootPage.body3b= \'>this page</a> for information about the deployed
services.</p>
+html.wsdlPage.title= Web Service
+html.wsdlPage.noWsdl=<p>No WSDL document available for
publishing.</p><p>Please check your deployment information.</p>
+html.rootPage.title= Web Service
+html.rootPage.body1=<p>A Web Service is installed at this URL.</p>
+html.rootPage.body2a=<p>It supports the following ports:
+html.rootPage.body2b=</p>
+html.rootPage.body3a=<p>A WSDL description of these ports is available <a
href='
+html.rootPage.body3b='>here.</a></p>
+html.rootPage.body4=<p>This endpoint is incorrectly configured. Please check the
location and contents of the configuration file.</p>
+
+
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/xmlmessage.properties
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/xmlmessage.properties
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/resources/xmlmessage.properties 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,16 @@
+#
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+#
+xml.null.headers=Invalid argument. MimeHeaders=null
+xml.no.Content-Type=MimeHeaders doesn't contain Content-Type header
+xml.unknown.Content-Type=Unrecognized Content-Type
+xml.cannot.internalize.message=Cannot create XMLMessage
+xml.root.part.invalid.Content-Type= Bad Content-Type for Root Part : {0}
+xml.get.source.err=Couldn't return Source
+xml.set.payload.err=Couldn't set Payload in XMLMessage
+xml.get.ds.err=Couldn't get DataSource
+xml.content-type.mustbe.multipart=Content-Type needs to be Multipart/Related and with
type=text/xml
+xml.invalid.content-type=Invalid Content-Type: {0}
+xml.Content-Type.parse.err=Error while parsing MimeHeaders for Content-Type
+
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/AppMsgContextImpl.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/AppMsgContextImpl.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/AppMsgContextImpl.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,155 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.server;
+import javax.xml.ws.handler.MessageContext;
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import javax.xml.ws.handler.MessageContext.Scope;
+
+public class AppMsgContextImpl implements MessageContext {
+
+ private MessageContext ctxt;
+ private Map<String, Object> appContext; // properties in APPLICATION scope
+
+ private void init() {
+ if (appContext == null) {
+ appContext = new HashMap<String, Object>();
+ Iterator<Entry<String, Object>> i = ctxt.entrySet().iterator();
+ while(i.hasNext()) {
+ Entry<String, Object> entry = i.next();
+ if (ctxt.getScope(entry.getKey()) == Scope.APPLICATION) {
+ appContext.put(entry.getKey(), entry.getValue());
+ }
+ }
+ }
+ }
+
+ public AppMsgContextImpl(MessageContext ctxt) {
+ this.ctxt = ctxt;
+ }
+
+ /* java.util.Map methods below here */
+
+ public void clear() {
+ init();
+ Set<Entry<String, Object>> props = appContext.entrySet();
+ for (Entry<String, Object> prop : props) {
+ ctxt.remove(prop.getKey());
+ }
+ appContext.clear();
+ }
+
+ public boolean containsKey(Object obj) {
+ init();
+ return appContext.containsKey(obj);
+ }
+
+ public boolean containsValue(Object obj) {
+ init();
+ return appContext.containsValue(obj);
+ }
+
+ public Set<Entry<String, Object>> entrySet() {
+ init();
+ return appContext.entrySet();
+ }
+
+ public Object get(Object obj) {
+ init();
+ return appContext.get(obj);
+ }
+
+ public boolean isEmpty() {
+ init();
+ return appContext.isEmpty();
+ }
+
+ public Set<String> keySet() {
+ init();
+ return appContext.keySet();
+ }
+
+ public Object put(String str, Object obj) {
+ init();
+ Scope scope = null;
+ try {
+ scope = ctxt.getScope(str);
+ } catch(IllegalArgumentException ie) {
+ // It's okay, MessageContext didn't have this property
+ }
+ if (scope != null && scope == Scope.HANDLER) {
+ throw new IllegalArgumentException(
+ "Cannot overwrite property in HANDLER scope");
+ }
+ ctxt.put(str, obj);
+ ctxt.setScope(str, Scope.APPLICATION);
+ return appContext.put(str, obj);
+ }
+
+ public void putAll(Map<? extends String, ? extends Object> map) {
+ init();
+ Set<? extends Entry<? extends String, ? extends Object>> props =
map.entrySet();
+ for(Entry<? extends String, ? extends Object> prop : props) {
+ put(prop.getKey(), prop.getValue());
+ }
+ }
+
+ public Object remove(Object key) {
+ init();
+ Scope scope = null;
+ try {
+ scope = ctxt.getScope((String)key);
+ } catch(IllegalArgumentException ie) {
+ // It's okay, MessageContext didn't have this property
+ }
+ if (scope != null && scope == Scope.HANDLER) {
+ throw new IllegalArgumentException(
+ "Cannot remove property in HANDLER scope");
+ }
+ ctxt.remove(key);
+ return appContext.remove(key);
+ }
+
+ public int size() {
+ init();
+ return appContext.size();
+ }
+
+ public Collection<Object> values() {
+ init();
+ return appContext.values();
+ }
+
+ public void setScope(String name, Scope scope) {
+
+ }
+
+ public Scope getScope(String name) {
+ return null;
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/AppMsgContextImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/DocInfo.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/DocInfo.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/DocInfo.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,98 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.server;
+import java.io.InputStream;
+import java.net.URL;
+
+import org.jboss.com.sun.xml.ws.wsdl.parser.Service;
+
+
+public interface DocInfo {
+
+ public enum DOC_TYPE { WSDL, SCHEMA, OTHER };
+
+ /*
+ * The implemenation needs to work for multiple invocations of this method
+ */
+ public InputStream getDoc();
+
+ /*
+ * @return wsdl=a, xsd=c etc
+ */
+ public String getQueryString();
+
+ /*
+ * set wsdl=a, xsd=c etc as queryString
+ */
+ public void setQueryString(String queryString);
+
+ /*
+ * Sets document type : WSDL, or Schema ?
+ */
+ public void setDocType(DOC_TYPE docType);
+
+ /*
+ * return document type : WSDL, or Schema ?
+ */
+ public DOC_TYPE getDocType();
+
+ /*
+ * Sets targetNamespace of WSDL, and schema
+ */
+ public void setTargetNamespace(String ns);
+
+ /*
+ * Sets targetNamespace of WSDL, and schema
+ */
+ public String getTargetNamespace();
+
+ /*
+ * Sets if the endpoint service is defined in this document
+ */
+ public void setService(Service service);
+
+ /*
+ * returns true if endpoint service is present in this document
+ */
+ public Service getService();
+
+ /*
+ * Sets if the endpoint Port Type is defined in this document
+ */
+ public void setHavingPortType(boolean portType);
+
+ /*
+ * returns true if endpoint PortType is present in this document
+ */
+ public boolean isHavingPortType();
+
+ /*
+ * @return /WEB-INF/wsdl/xxx.wsdl
+ */
+ public String getPath();
+
+ /*
+ * @return URL for /WEB-INF/wsdl/xxx.wsdl
+ */
+ public URL getUrl();
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/DocInfo.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/EPTFactoryBase.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/EPTFactoryBase.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/EPTFactoryBase.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,113 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.server;
+
+import org.jboss.com.sun.xml.ws.encoding.internal.InternalEncoder;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPDecoder;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPEPTFactory;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPEncoder;
+import org.jboss.com.sun.xml.ws.pept.encoding.Decoder;
+import org.jboss.com.sun.xml.ws.pept.encoding.Encoder;
+import org.jboss.com.sun.xml.ws.pept.ept.EPTFactory;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.pept.presentation.TargetFinder;
+import org.jboss.com.sun.xml.ws.pept.protocol.Interceptors;
+import org.jboss.com.sun.xml.ws.pept.protocol.MessageDispatcher;
+
+/**
+ * @author WS Development Team
+ */
+public class EPTFactoryBase implements EPTFactory, SOAPEPTFactory {
+ private Encoder encoder;
+ private Decoder decoder;
+ private SOAPEncoder soapEncoder;
+ private SOAPDecoder soapDecoder;
+ private InternalEncoder internalEncoder;
+ private TargetFinder targetFinder;
+ private MessageDispatcher messageDispatcher;
+
+ public EPTFactoryBase(Encoder encoder, Decoder decoder,
+ TargetFinder targetFinder, MessageDispatcher messageDispatcher) {
+ this.encoder = encoder;
+ this.decoder = decoder;
+ this.targetFinder = targetFinder;
+ this.messageDispatcher = messageDispatcher;
+ }
+
+ public EPTFactoryBase(SOAPEncoder soapEncoder, SOAPDecoder soapDecoder,
+ InternalEncoder internalEncoder,
+ TargetFinder targetFinder, MessageDispatcher messageDispatcher)
{
+ this.encoder = null;
+ this.decoder = null;
+ this.soapEncoder = soapEncoder;
+ this.soapDecoder = soapDecoder;
+ this.internalEncoder = internalEncoder;
+ this.targetFinder = targetFinder;
+ this.messageDispatcher = messageDispatcher;
+ }
+
+ public Encoder getEncoder(MessageInfo messageInfo) {
+ messageInfo.setEncoder(encoder);
+ return messageInfo.getEncoder();
+ }
+
+ public Decoder getDecoder(MessageInfo messageInfo) {
+ messageInfo.setDecoder(decoder);
+ return messageInfo.getDecoder();
+ }
+
+ public TargetFinder getTargetFinder(MessageInfo messageInfo) {
+ return targetFinder;
+ }
+
+ public MessageDispatcher getMessageDispatcher(MessageInfo messageInfo) {
+ messageInfo.setMessageDispatcher(messageDispatcher);
+ return messageDispatcher;
+ }
+
+ /*
+ * @see EPTFactory#getInterceptors(com.sun.istack.pept.ept.MessageInfo)
+ */
+ public Interceptors getInterceptors(MessageInfo x) {
+ return null;
+ }
+
+ /*
+ * @see LogicalEPTFactory#getSoapEncoder()
+ */
+ public SOAPEncoder getSOAPEncoder() {
+ return soapEncoder;
+ }
+
+ /*
+ * @see LogicalEPTFactory#getSoapDecoder()
+ */
+ public SOAPDecoder getSOAPDecoder() {
+ return soapDecoder;
+ }
+
+ public InternalEncoder getInternalEncoder() {
+ return internalEncoder;
+ }
+
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/EPTFactoryBase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/EPTFactoryFactoryBase.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/EPTFactoryFactoryBase.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/EPTFactoryFactoryBase.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,146 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.server;
+
+import javax.xml.ws.Provider;
+import javax.xml.ws.soap.SOAPBinding;
+
+import javax.xml.ws.http.HTTPBinding;
+
+import org.jboss.com.sun.xml.ws.binding.BindingImpl;
+import org.jboss.com.sun.xml.ws.encoding.internal.InternalEncoder;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPDecoder;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPEncoder;
+import org.jboss.com.sun.xml.ws.encoding.soap.ServerEncoderDecoder;
+import org.jboss.com.sun.xml.ws.encoding.soap.server.ProviderSED;
+import org.jboss.com.sun.xml.ws.encoding.soap.server.SOAP12XMLDecoder;
+import org.jboss.com.sun.xml.ws.encoding.soap.server.SOAP12XMLEncoder;
+import org.jboss.com.sun.xml.ws.encoding.soap.server.SOAPXMLDecoder;
+import org.jboss.com.sun.xml.ws.encoding.soap.server.SOAPXMLEncoder;
+import org.jboss.com.sun.xml.ws.encoding.xml.XMLDecoder;
+import org.jboss.com.sun.xml.ws.encoding.xml.XMLEncoder;
+import org.jboss.com.sun.xml.ws.pept.ept.EPTFactory;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.pept.presentation.TargetFinder;
+import org.jboss.com.sun.xml.ws.pept.protocol.MessageDispatcher;
+import org.jboss.com.sun.xml.ws.protocol.soap.server.ProviderSOAPMD;
+import org.jboss.com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher;
+import org.jboss.com.sun.xml.ws.protocol.xml.server.ProviderXMLMD;
+import org.jboss.com.sun.xml.ws.server.provider.ProviderPeptTie;
+import org.jboss.com.sun.xml.ws.spi.runtime.MessageContext;
+import org.jboss.com.sun.xml.ws.util.MessageInfoUtil;
+
+/**
+ * factory for creating the appropriate EPTFactory given the BindingId from the
EndpointInfo
+ * in the RuntimeContext of the MessageInfo
+ * Based on MessageInfo data(Binding, Implementor) it selects one the static EPTFactories
+ * using Binding information
+ * Has a static EPTFactory object for each particular binding.
+ * EPTFactories are reused for all the requests.
+ * Has static provider EPTFactory objects.
+ * The provider EPTFactories are reused for all the requests.
+ * The factories reuse encoder, decoder, message dispatcher objects since these objects
+ * are Stateless. They are reused for all the requests.
+ *
+ * @author WS Development Team
+ */
+public abstract class EPTFactoryFactoryBase {
+
+ public static final ProviderSOAPMD providerMessageDispatcher =
+ new ProviderSOAPMD();
+ public static final SOAPEncoder soap11Encoder = new SOAPXMLEncoder();
+ public static final SOAPDecoder soap11Decoder = new SOAPXMLDecoder();
+ public static final SOAPEncoder soap12Encoder = new SOAP12XMLEncoder();
+ public static final SOAPDecoder soap12Decoder = new SOAP12XMLDecoder();
+
+ public static final XMLEncoder xmlEncoder = null; //new XMLEncoder();
+ public static final XMLDecoder xmlDecoder = null; //new XMLDecoder();
+
+ public static final SOAPMessageDispatcher soap11MessageDispatcher =
+ new SOAPMessageDispatcher();
+ public static final MessageDispatcher providerXmlMD =
+ new ProviderXMLMD();
+ public static final InternalEncoder internalSED = new ServerEncoderDecoder();
+ public static final InternalEncoder providerSED = new ProviderSED();
+ public static final TargetFinder providerTargetFinder =
+ new TargetFinderImpl(new ProviderPeptTie());
+ public static final TargetFinder targetFinder =
+ new TargetFinderImpl(new PeptTie());
+
+ public static final EPTFactory providerSoap11 =
+ new EPTFactoryBase(soap11Encoder, soap11Decoder,
+ providerSED, providerTargetFinder,
+ providerMessageDispatcher);
+
+ public static final EPTFactory providerSoap12 =
+ new EPTFactoryBase(soap12Encoder, soap12Decoder,
+ providerSED, providerTargetFinder,
+ providerMessageDispatcher);
+
+ public static final EPTFactory soap11 =
+ new EPTFactoryBase(
+ soap11Encoder, soap11Decoder,
+ internalSED, targetFinder,
+ soap11MessageDispatcher);
+
+ public static final EPTFactory soap12 =
+ new EPTFactoryBase(
+ soap12Encoder, soap12Decoder,
+ internalSED, targetFinder,
+ soap11MessageDispatcher);
+
+ public static final EPTFactory providerXml =
+ new XMLEPTFactoryImpl(
+ xmlEncoder, xmlDecoder,
+ providerSED, providerTargetFinder,
+ providerXmlMD);
+
+ /**
+ * Choose correct EPTFactory. MessageInfo contains all the needed
+ * information like Binding, WSConnection to make that decision.
+ * @param mi the MessageInfo object to obtain the BindingID from.
+ * @return returns the appropriate EPTFactory for the BindingID in the mi
+ */
+ public static EPTFactory getEPTFactory(MessageInfo mi) {
+ RuntimeContext rtCtxt = MessageInfoUtil.getRuntimeContext(mi);
+ RuntimeEndpointInfo endpointInfo = rtCtxt.getRuntimeEndpointInfo();
+ String bindingId = ((BindingImpl)endpointInfo.getBinding()).getBindingId();
+ if(bindingId.equals(SOAPBinding.SOAP11HTTP_BINDING)){
+ if (endpointInfo.getImplementor() instanceof Provider) {
+ return providerSoap11;
+ } else {
+ return soap11;
+ }
+ }else if(bindingId.equals(SOAPBinding.SOAP12HTTP_BINDING)){
+ if (endpointInfo.getImplementor() instanceof Provider) {
+ return providerSoap12;
+ } else {
+ return soap12;
+ }
+ } else if(bindingId.equals(HTTPBinding.HTTP_BINDING)){
+ if (endpointInfo.getImplementor() instanceof Provider) {
+ return providerXml;
+ }
+ }
+ return null;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/EPTFactoryFactoryBase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/PeptTie.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/PeptTie.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/PeptTie.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,94 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.server;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import java.rmi.RemoteException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.pept.presentation.MessageStruct;
+import org.jboss.com.sun.xml.ws.pept.presentation.Tie;
+import org.jboss.com.sun.xml.ws.util.MessageInfoUtil;
+
+/**
+ * Creates a Stateless Tie object so that it is created only once and reused.
+ */
+public class PeptTie implements Tie {
+
+ private static final Logger logger = Logger.getLogger(
+ org.jboss.com.sun.xml.ws.util.Constants.LoggingDomain +
".server.PeptTie");
+
+ public void _setServant(Object servant) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object _getServant() {
+ throw new UnsupportedOperationException();
+ }
+
+ /*
+ * @see Tie#_invoke(MessageInfo)
+ */
+ public void _invoke(MessageInfo messageInfo) {
+ Object[] oa = messageInfo.getData();
+ Method method = messageInfo.getMethod();
+ RuntimeContext rtCtxt = MessageInfoUtil.getRuntimeContext(messageInfo);
+ RuntimeEndpointInfo endpointInfo = rtCtxt.getRuntimeEndpointInfo();
+ Object servant = endpointInfo.getImplementor();
+ try {
+ Object ret = method.invoke(servant, oa);
+ messageInfo.setResponseType(MessageStruct.NORMAL_RESPONSE);
+ messageInfo.setResponse(ret);
+ } catch (IllegalArgumentException e) {
+ setRuntimeException(messageInfo, e);
+ } catch (IllegalAccessException e) {
+ setRuntimeException(messageInfo, e);
+ } catch (InvocationTargetException e) {
+ Throwable cause = e.getCause();
+ if (cause != null) {
+ // Consider RemoteException as RuntimeException
+ if (!(cause instanceof RuntimeException) && cause instanceof
Exception
+ && !(cause instanceof RemoteException)) {
+ // Service specific exception
+ messageInfo.setResponseType(
+ MessageStruct.CHECKED_EXCEPTION_RESPONSE);
+ messageInfo.setResponse(cause);
+ } else {
+ setRuntimeException(messageInfo, cause);
+ }
+ } else {
+ setRuntimeException(messageInfo, e);
+ }
+ }
+ }
+
+ private void setRuntimeException(MessageInfo messageInfo, Throwable e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ messageInfo.setResponseType(MessageStruct.UNCHECKED_EXCEPTION_RESPONSE);
+ messageInfo.setResponse(e);
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/PeptTie.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/RuntimeContext.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/RuntimeContext.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/RuntimeContext.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,122 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.server;
+
+import java.lang.reflect.Method;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.xml.ws.handler.HandlerContext;
+import org.jboss.com.sun.xml.ws.model.RuntimeModel;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+
+import com.sun.xml.bind.api.BridgeContext;
+
+
+
+
+/**
+ * $author: WS Development Team
+ */
+public class RuntimeContext {
+
+ public RuntimeContext(RuntimeModel model) {
+ this.model = model;
+ }
+
+ /**
+ * @return Returns the model.
+ */
+ public RuntimeModel getModel() {
+ return model;
+ }
+
+ /**
+ * @return Returns info about endpoint
+ */
+ public RuntimeEndpointInfo getRuntimeEndpointInfo() {
+ return endpointInfo;
+ }
+
+ /**
+ * sets info about endpoint
+ */
+ public void setRuntimeEndpointInfo(RuntimeEndpointInfo endpointInfo) {
+ this.endpointInfo = endpointInfo;
+ }
+
+ /**
+ * @param name
+ * @param mi
+ * @return the <code>Method</code> associated with the operation named
name
+ */
+ public Method getDispatchMethod(QName name, MessageInfo mi) {
+ return getDispatchMethod(name);
+ }
+
+ /**
+ * @param name
+ * @return the <code>Method</code> associated with the operation named
name
+ */
+ public Method getDispatchMethod(QName name){
+ return model.getDispatchMethod(name);
+ }
+
+ /**
+ * @param qname
+ * @param mi
+ */
+ public void setMethodAndMEP(QName qname, MessageInfo mi) {
+ if (model != null) {
+ mi.setMethod(model.getDispatchMethod(qname));
+
+ // if null, default MEP is ok
+ if (qname != null && model.getJavaMethod(qname) != null) {
+ mi.setMEP(model.getJavaMethod(qname).getMEP());
+ }
+ }
+ }
+
+ /**
+ * @param name
+ * @return the decoder Info associated with operation named name
+ */
+ public Object getDecoderInfo(QName name) {
+ return model.getDecoderInfo(name);
+ }
+
+ public BridgeContext getBridgeContext() {
+ return (model != null)?model.getBridgeContext():null;
+ }
+
+ public HandlerContext getHandlerContext() {
+ return handlerContext;
+ }
+
+ public void setHandlerContext(HandlerContext handlerContext) {
+ this.handlerContext = handlerContext;
+ }
+
+ private RuntimeModel model;
+ private HandlerContext handlerContext;
+ private RuntimeEndpointInfo endpointInfo;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/RuntimeContext.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/RuntimeEndpointInfo.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/RuntimeEndpointInfo.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/RuntimeEndpointInfo.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,843 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.server;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.logging.Logger;
+import java.io.IOException;
+import java.util.Map.Entry;
+import java.util.concurrent.Executor;
+
+import javax.annotation.Resource;
+import javax.jws.WebService;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Provider;
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.soap.SOAPBinding;
+import javax.xml.transform.Source;
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.xml.ws.WebServiceProvider;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.ws.Endpoint;
+
+
+import org.jboss.com.sun.xml.ws.binding.BindingImpl;
+import org.jboss.com.sun.xml.ws.binding.soap.SOAPBindingImpl;
+import org.jboss.com.sun.xml.ws.model.RuntimeModel;
+import org.jboss.com.sun.xml.ws.modeler.RuntimeModeler;
+import org.jboss.com.sun.xml.ws.server.DocInfo.DOC_TYPE;
+import org.jboss.com.sun.xml.ws.server.provider.ProviderModel;
+import org.jboss.com.sun.xml.ws.spi.runtime.Binding;
+import org.jboss.com.sun.xml.ws.spi.runtime.WebServiceContext;
+import org.jboss.com.sun.xml.ws.util.HandlerAnnotationInfo;
+import org.jboss.com.sun.xml.ws.util.HandlerAnnotationProcessor;
+import org.jboss.com.sun.xml.ws.util.localization.LocalizableMessageFactory;
+import org.jboss.com.sun.xml.ws.util.localization.Localizer;
+import org.jboss.com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser;
+import org.jboss.com.sun.xml.ws.wsdl.parser.Service;
+import org.jboss.com.sun.xml.ws.wsdl.parser.WSDLDocument;
+import org.jboss.com.sun.xml.ws.wsdl.writer.WSDLGenerator;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.SAXException;
+
+
+
+
+/**
+ * modeled after the javax.xml.ws.Endpoint class in API.
+ * Contains all the information about Binding, handler chain, Implementor object,
+ * WSDL & Schema Metadata
+ * @author WS Development Team
+ */
+public class RuntimeEndpointInfo implements
org.jboss.com.sun.xml.ws.spi.runtime.RuntimeEndpointInfo {
+
+ private String name;
+ private QName portName;
+ private QName serviceName;
+ private String wsdlFileName;
+ private boolean deployed;
+ private String urlPattern;
+ private List<Source> metadata;
+ private Binding binding;
+ private RuntimeModel runtimeModel;
+ private Object implementor;
+ private Class implementorClass;
+ private Map<String, DocInfo> docs; // /WEB-INF/wsdl/xxx.wsdl ->
DocInfo
+ private Map<String, DocInfo> query2Doc; // (wsdl=a) --> DocInfo
+ private WebServiceContext wsContext;
+ private boolean beginServiceDone;
+ private boolean endServiceDone;
+ private boolean injectedContext;
+ private URL wsdlUrl;
+ private EntityResolver wsdlResolver;
+ private QName portTypeName;
+ private Integer mtomThreshold;
+ private static final Logger logger = Logger.getLogger(
+ org.jboss.com.sun.xml.ws.util.Constants.LoggingDomain +
".server.endpoint");
+ private static final Localizer localizer = new Localizer();
+ private static final LocalizableMessageFactory messageFactory =
+ new
LocalizableMessageFactory("org.jboss.com.sun.xml.ws.resources.server");
+ private WebService ws;
+ private WebServiceProvider wsProvider;
+ private ProviderModel providerModel;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String s) {
+ name = s;
+ }
+
+ public String getWSDLFileName() {
+ return wsdlFileName;
+ }
+
+ public void setWSDLFileName(String s) {
+ wsdlFileName = s;
+ }
+
+ /**
+ * set the URL for primary WSDL, and an EntityResolver to resolve all
+ * imports/references
+ */
+ public void setWsdlInfo(URL wsdlUrl, EntityResolver wsdlResolver) {
+ this.wsdlUrl = wsdlUrl;
+ this.wsdlResolver = wsdlResolver;
+ }
+
+ public EntityResolver getWsdlResolver() {
+ return wsdlResolver;
+ }
+
+ public URL getWsdlUrl() {
+ return wsdlUrl;
+ }
+
+ public boolean isDeployed() {
+ return deployed;
+ }
+
+ public void createProviderModel() {
+ providerModel = new ProviderModel(implementorClass, binding);
+ }
+
+ public void createSEIModel() {
+ // Create runtime model for non Provider endpoints
+
+ // wsdlURL will be null, means we will generate WSDL. Hence no need to apply
+ // bindings or need to look in the WSDL
+ if(wsdlUrl == null){
+ RuntimeModeler rap = new RuntimeModeler(getImplementorClass(),
+ getImplementor(), getServiceName(),
((BindingImpl)binding).getBindingId());
+ if (getPortName() != null) {
+ rap.setPortName(getPortName());
+ }
+ runtimeModel = rap.buildRuntimeModel();
+ }else {
+ try {
+ WSDLDocument wsdlDoc = RuntimeWSDLParser.parse(getWsdlUrl(),
getWsdlResolver());
+ org.jboss.com.sun.xml.ws.wsdl.parser.Binding wsdlBinding = null;
+ if(serviceName == null)
+ serviceName = RuntimeModeler.getServiceName(getImplementorClass());
+ if(getPortName() != null){
+ wsdlBinding = wsdlDoc.getBinding(getServiceName(), getPortName());
+ if(wsdlBinding == null)
+ throw new
ServerRtException("runtime.parser.wsdl.incorrectserviceport", new
Object[]{serviceName, portName, getWsdlUrl()});
+ }else{
+ Service service = wsdlDoc.getService(serviceName);
+ if(service == null)
+ throw new
ServerRtException("runtime.parser.wsdl.noservice", new Object[]{serviceName,
getWsdlUrl()});
+
+ String bindingId = ((BindingImpl)binding).getBindingId();
+ List<org.jboss.com.sun.xml.ws.wsdl.parser.Binding> bindings =
wsdlDoc.getBindings(service, bindingId);
+ if(bindings.size() == 0)
+ throw new
ServerRtException("runtime.parser.wsdl.nobinding", new Object[]{bindingId,
serviceName, getWsdlUrl()});
+
+ if(bindings.size() > 1)
+ throw new
ServerRtException("runtime.parser.wsdl.multiplebinding", new Object[]{bindingId,
serviceName, getWsdlUrl()});
+ }
+ //now we got the Binding so lets build the model
+ RuntimeModeler rap = new RuntimeModeler(getImplementorClass(),
getImplementor(), getServiceName(), wsdlBinding);
+ if (getPortName() != null) {
+ rap.setPortName(getPortName());
+ }
+ runtimeModel = rap.buildRuntimeModel();
+ } catch (IOException e) {
+ throw new ServerRtException("runtime.parser.wsdl",
getWsdlUrl().toString());
+ } catch (XMLStreamException e) {
+ throw new ServerRtException("runtime.saxparser.exception",
+ new Object[]{e.getMessage(), e.getLocation()});
+ } catch (SAXException e) {
+ throw new ServerRtException("runtime.parser.wsdl",
getWsdlUrl().toString());
+ }
+ }
+ }
+
+
+ public boolean isProviderEndpoint() {
+ Annotation ann = getImplementorClass().getAnnotation(
+ WebServiceProvider.class);
+ return (ann != null);
+ }
+
+ /*
+ * If serviceName is not already set via DD or programmatically, it uses
+ * annotations on implementorClass to set ServiceName.
+ */
+ public void doServiceNameProcessing() {
+ if (getServiceName() == null) {
+ if (isProviderEndpoint()) {
+ WebServiceProvider wsProvider =
+ (WebServiceProvider)getImplementorClass().getAnnotation(
+ WebServiceProvider.class);
+ String tns = wsProvider.targetNamespace();
+ String local = wsProvider.serviceName();
+ // create QName("", ""), if the above values are
default
+ setServiceName(new QName(tns, local));
+ } else {
+ setServiceName(RuntimeModeler.getServiceName(getImplementorClass()));
+ }
+ }
+ }
+
+ /*
+ * If portName is not already set via DD or programmatically, it uses
+ * annotations on implementorClass to set PortName.
+ */
+ public void doPortNameProcessing() {
+ if (getPortName() == null) {
+ if (isProviderEndpoint()) {
+ WebServiceProvider wsProvider =
+ (WebServiceProvider)getImplementorClass().getAnnotation(
+ WebServiceProvider.class);
+ String tns = wsProvider.targetNamespace();
+ String local = wsProvider.portName();
+ // create QName("", ""), if the above values are
default
+ setPortName(new QName(tns, local));
+
+ } else {
+ setPortName(RuntimeModeler.getPortName(getImplementorClass(),
+ getServiceName().getNamespaceURI()));
+ }
+ } else {
+ String serviceNS = getServiceName().getNamespaceURI();
+ String portNS = getPortName().getNamespaceURI();
+ if (!serviceNS.equals(portNS)) {
+ throw new ServerRtException("wrong.tns.for.port",
+ new Object[] { portNS, serviceNS });
+
+ }
+ }
+ }
+
+ /*
+ * Sets PortType QName
+ */
+ public void doPortTypeNameProcessing() {
+ if (getPortTypeName() == null) {
+ if (!isProviderEndpoint()) {
+ setPortTypeName(RuntimeModeler.getPortTypeName(getImplementorClass()));
+ }
+ }
+ }
+
+
+ /**
+ * creates a RuntimeModel using @link
org.jboss.com.sun.xml.ws.modeler.RuntimeModeler.
+ * The modeler creates the model by reading annotations on ImplementorClassobject.
+ * RuntimeModel is read only and is accessed from multiple threads afterwards.
+
+ */
+ public void init() {
+ if (implementor == null) {
+ throw new ServerRtException("null.implementor");
+ }
+ if (implementorClass == null) {
+ setImplementorClass(getImplementor().getClass());
+ }
+
+ // verify if implementor class has @WebService or @WebServiceProvider
+ verifyImplementorClass();
+
+ // ServiceName processing
+ doServiceNameProcessing();
+
+ // Port Name processing
+ doPortNameProcessing();
+
+ // PortType Name processing
+ //doPortTypeNameProcessing();
+
+ // setting a default binding
+ if (binding == null) {
+ String bindingId = RuntimeModeler.getBindingId(getImplementorClass());
+ setBinding(new SOAPBindingImpl(SOAPBinding.SOAP11HTTP_BINDING));
+ }
+
+ if (isProviderEndpoint()) {
+ checkProvider();
+ createProviderModel();
+ } else {
+ // Create runtime model for non Provider endpoints
+ createSEIModel();
+ if (getServiceName() == null) {
+ setServiceName(runtimeModel.getServiceQName());
+ }
+ if (getPortName() == null) {
+ setPortName(runtimeModel.getPortName());
+ }
+ //set mtom processing
+ if(binding instanceof SOAPBindingImpl){
+ runtimeModel.enableMtom(((SOAPBinding)binding).isMTOMEnabled());
+ }
+ }
+ // Process @HandlerChain, if handler-chain is not set via Deployment
+ // Descriptor
+ if (getBinding().getHandlerChain() == null) {
+ String bindingId = ((BindingImpl) binding).getActualBindingId();
+ HandlerAnnotationInfo chainInfo =
+ HandlerAnnotationProcessor.buildHandlerInfo(
+ implementorClass, getServiceName(),
+ getPortName(), bindingId);
+ if (chainInfo != null) {
+ getBinding().setHandlerChain(chainInfo.getHandlers());
+ if (getBinding() instanceof SOAPBinding) {
+ ((SOAPBinding) getBinding()).setRoles(
+ chainInfo.getRoles());
+ }
+ }
+ }
+ deployed = true;
+ }
+
+ public boolean needWSDLGeneration() {
+ if (isProviderEndpoint()) {
+ return false;
+ }
+ return (getWsdlUrl() == null);
+ }
+
+ /*
+ * Generates the WSDL and XML Schema for the endpoint if necessary
+ * It generates WSDL only for SOAP1.1, and for XSOAP1.2 bindings
+ */
+ public void generateWSDL() {
+ BindingImpl bindingImpl = (BindingImpl)getBinding();
+ String bindingId = bindingImpl.getActualBindingId();
+ if (!bindingId.equals(SOAPBinding.SOAP11HTTP_BINDING) &&
+ !bindingId.equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING) &&
+ !bindingId.equals(SOAPBindingImpl.X_SOAP12HTTP_BINDING)) {
+ throw new ServerRtException("can.not.generate.wsdl", bindingId);
+ }
+
+ if (bindingId.equals(SOAPBindingImpl.X_SOAP12HTTP_BINDING)) {
+ String msg = localizer.localize(
+ messageFactory.getMessage("generate.non.standard.wsdl"));
+ logger.warning(msg);
+ }
+
+ // Generate WSDL and schema documents using runtime model
+ if (getDocMetadata() == null) {
+ setMetadata(new HashMap<String, DocInfo>());
+ }
+ WSDLGenResolver wsdlResolver = new WSDLGenResolver(getDocMetadata());
+ WSDLGenerator wsdlGen = new WSDLGenerator(runtimeModel, wsdlResolver,
+ ((BindingImpl)binding).getBindingId());
+ try {
+ wsdlGen.doGeneration();
+ } catch(Exception e) {
+ throw new ServerRtException("server.rt.err",e);
+ }
+ setWSDLFileName(wsdlResolver.getWSDLFile());
+ }
+
+ /*
+ * Provider endpoint validation
+ */
+ private void checkProvider() {
+ if (!Provider.class.isAssignableFrom(getImplementorClass())) {
+ throw new ServerRtException("not.implement.provider",
+ new Object[] {getImplementorClass()});
+ }
+ }
+
+ public QName getPortName() {
+ return portName;
+ }
+
+ public void setPortName(QName n) {
+ portName = n;
+ }
+
+ public QName getPortTypeName() {
+ return portTypeName;
+ }
+
+ public void setPortTypeName(QName n) {
+ portTypeName = n;
+ }
+
+ public QName getServiceName() {
+ return serviceName;
+ }
+
+ public void setServiceName(QName n) {
+ serviceName = n;
+ }
+
+ public String getUrlPattern() {
+ return urlPattern;
+ }
+
+ public String getUrlPatternWithoutStar() {
+ if (urlPattern.endsWith("/*")) {
+ return urlPattern.substring(0, urlPattern.length() - 2);
+ } else {
+ return urlPattern;
+ }
+ }
+
+
+ public void setUrlPattern(String s) {
+ urlPattern = s;
+ }
+
+ public void setBinding(Binding binding){
+ this.binding = binding;
+ }
+
+ public Binding getBinding() {
+ return binding;
+ }
+
+ public java.util.List<Source> getMetadata() {
+ return metadata;
+ }
+
+ public void setMetadata(java.util.List<Source> metadata) {
+
+ this.metadata = metadata;
+ }
+
+ public RuntimeModel getRuntimeModel() {
+ return runtimeModel;
+ }
+
+ public Object getImplementor() {
+ return implementor;
+ }
+
+ public void setImplementor(Object implementor) {
+ this.implementor = implementor;
+ }
+
+ public Class getImplementorClass() {
+ if (implementorClass == null) {
+ implementorClass = implementor.getClass();
+ }
+ return implementorClass;
+ }
+
+ public void setImplementorClass(Class implementorClass) {
+ this.implementorClass = implementorClass;
+ }
+
+ public void setMetadata(Map<String, DocInfo> docs) {
+ this.docs = docs;
+ }
+
+ private void updateQuery2DocInfo() {
+ // update (wsdl, xsd=1 )-->DocInfo map
+ if (query2Doc != null) {
+ query2Doc.clear();
+ } else {
+ query2Doc = new HashMap<String, DocInfo>();
+ }
+ Set<Map.Entry<String, DocInfo>> entries = docs.entrySet();
+ for(Map.Entry<String, DocInfo> entry : entries) {
+ DocInfo docInfo = entry.getValue();
+ // Check to handle ?WSDL
+ if (docInfo.getQueryString().equals("wsdl")) {
+ query2Doc.put("WSDL", docInfo);
+ }
+ query2Doc.put(docInfo.getQueryString(), docInfo);
+ }
+ }
+
+ public WebServiceContext getWebServiceContext() {
+ return wsContext;
+ }
+
+ public void setWebServiceContext(WebServiceContext wsContext) {
+ this.wsContext = wsContext;
+ }
+
+
+ /*
+ * key - /WEB-INF/wsdl/xxx.wsdl
+ */
+ public Map<String, DocInfo> getDocMetadata() {
+ return docs;
+ }
+
+ /*
+ * path - /WEB-INF/wsdl/xxx.wsdl
+ * return - xsd=a | wsdl | wsdl=b etc
+ */
+ public String getQueryString(URL url) {
+ Set<Entry<String, DocInfo>> entries = getDocMetadata().entrySet();
+ for(Entry<String, DocInfo> entry : entries) {
+ // URLs are not matching. servlet container bug ?
+ if (entry.getValue().getUrl().toString().equals(url.toString())) {
+ return entry.getValue().getQueryString();
+ }
+ }
+ return null;
+ }
+
+ /*
+ * queryString - xsd=a | wsdl | wsdl=b etc
+ * return - /WEB-INF/wsdl/xxx.wsdl
+ */
+ public String getPath(String queryString) {
+ if (query2Doc != null) {
+ DocInfo docInfo = query2Doc.get(queryString);
+ return (docInfo == null) ? null : docInfo.getUrl().toString();
+ }
+ return null;
+ }
+
+ /*
+ * Injects the WebServiceContext. Called from Servlet.init(), or
+ * Endpoint.publish(). Used synchronized because multiple servlet
+ * instances may call this in their init()
+ */
+ public synchronized void injectContext()
+ throws IllegalAccessException, InvocationTargetException {
+ if (injectedContext) {
+ return;
+ }
+ try {
+ doFieldsInjection();
+ doMethodsInjection();
+ } finally {
+ injectedContext = true;
+ }
+ }
+
+ private void doFieldsInjection() {
+ Class c = getImplementorClass();
+ Field[] fields = c.getDeclaredFields();
+ for(final Field field: fields) {
+ Resource resource = field.getAnnotation(Resource.class);
+ if (resource != null) {
+ Class resourceType = resource.type();
+ Class fieldType = field.getType();
+ if (resourceType.equals(Object.class)) {
+ if (fieldType.equals(javax.xml.ws.WebServiceContext.class)) {
+ injectField(field);
+ }
+ } else if (resourceType.equals(javax.xml.ws.WebServiceContext.class)) {
+ if (fieldType.isAssignableFrom(javax.xml.ws.WebServiceContext.class))
{
+ injectField(field);
+ } else {
+ throw new ServerRtException("wrong.field.type",
+ field.getName());
+ }
+ }
+ }
+ }
+ }
+
+ private void doMethodsInjection() {
+ Class c = getImplementorClass();
+ Method[] methods = c.getDeclaredMethods();
+ for(final Method method : methods) {
+ Resource resource = method.getAnnotation(Resource.class);
+ if (resource != null) {
+ Class[] paramTypes = method.getParameterTypes();
+ if (paramTypes.length != 1) {
+ throw new ServerRtException("wrong.no.parameters",
+ method.getName());
+ }
+ Class resourceType = resource.type();
+ Class argType = paramTypes[0];
+ if (resourceType.equals(Object.class)
+ && argType.equals(javax.xml.ws.WebServiceContext.class)) {
+ invokeMethod(method, new Object[] { wsContext });
+ } else if (resourceType.equals(javax.xml.ws.WebServiceContext.class)) {
+ if (argType.isAssignableFrom(javax.xml.ws.WebServiceContext.class))
{
+ invokeMethod(method, new Object[] { wsContext });
+ } else {
+ throw new ServerRtException("wrong.parameter.type",
+ method.getName());
+ }
+ }
+ }
+ }
+ }
+
+ /*
+ * injects a resource into a Field
+ */
+ private void injectField(final Field field) {
+ try {
+ AccessController.doPrivileged(new PrivilegedExceptionAction() {
+ public Object run() throws IllegalAccessException,
+ InvocationTargetException {
+ if (!field.isAccessible()) {
+ field.setAccessible(true);
+ }
+ field.set(implementor, wsContext);
+ return null;
+ }
+ });
+ } catch(PrivilegedActionException e) {
+ throw new ServerRtException("server.rt.err",e.getException());
+ }
+ }
+
+ /*
+ * Helper method to invoke a Method
+ */
+ private void invokeMethod(final Method method, final Object[] args) {
+ try {
+ AccessController.doPrivileged(new PrivilegedExceptionAction() {
+ public Object run() throws IllegalAccessException,
+ InvocationTargetException {
+ if (!method.isAccessible()) {
+ method.setAccessible(true);
+ }
+ method.invoke(implementor, args);
+ return null;
+ }
+ });
+ } catch(PrivilegedActionException e) {
+ throw new ServerRtException("server.rt.err",e.getException());
+ }
+ }
+
+ /*
+ * Calls the first method in the implementor object that has @BeginService
+ * annotation. Servlet.init(), or Endpoint.publish() may call this. Used
+ * synchronized because multiple servlet instances may call this in their
+ * init()
+ */
+ public synchronized void beginService() {
+ if (beginServiceDone) {
+ return; // Already called for this endpoint object
+ }
+ try {
+ invokeOnceMethod(PostConstruct.class);
+ } finally {
+ beginServiceDone = true;
+ }
+ }
+
+ /*
+ * Calls the first method in the implementor object that has @EndService
+ * annotation. Servlet.destory(), or Endpoint.stop() may call this. Used
+ * synchronized because multiple servlet instances may call this in their
+ * destroy()
+ */
+ public synchronized void endService() {
+ if (endServiceDone) {
+ return; // Already called for this endpoint object
+ }
+ try {
+ invokeOnceMethod(PreDestroy.class);
+ destroy();
+ } finally {
+ endServiceDone = true;
+ }
+ }
+
+ /*
+ * Helper method to invoke methods which don't take any arguments
+ * Also the annType annotation should be set only on one method
+ */
+ private void invokeOnceMethod(Class annType) {
+ Class c = getImplementorClass();
+ Method[] methods = c.getDeclaredMethods();
+ boolean once = false;
+ for(final Method method : methods) {
+ if (method.getAnnotation(annType) != null) {
+ if (once) {
+ // Err: Multiple methods have annType annotation
+ throw new ServerRtException("annotation.only.once",
+ new Object[] { annType } );
+ }
+ if (method.getParameterTypes().length != 0) {
+ throw new ServerRtException("not.zero.parameters",
+ method.getName());
+ }
+ invokeMethod(method, new Object[]{ });
+ once = true;
+ }
+ }
+ }
+
+ /*
+ * Called when the container calls endService(). Used for any
+ * cleanup. Currently calls @PreDestroy method on existing
+ * handlers. This should not throw an exception, but we ignore
+ * it if it happens and continue with the next handler.
+ */
+ public void destroy() {
+ Binding binding = getBinding();
+ if (binding != null) {
+ List<Handler> handlers = binding.getHandlerChain();
+ if (handlers != null) {
+ for (Handler handler : handlers) {
+ for (Method method : handler.getClass().getMethods()) {
+ if (method.getAnnotation(PreDestroy.class) == null) {
+ continue;
+ }
+ try {
+ method.invoke(handler, new Object [0]);
+ } catch (Exception e) {
+ logger.warning("exception ignored from handler " +
+ "@PreDestroy method: " +
+ e.getMessage());
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * @return returns null if no motm-threshold-value is specified in the descriptor
+ */
+
+ public Integer getMtomThreshold() {
+ return mtomThreshold;
+ }
+
+ public void setMtomThreshold(int mtomThreshold) {
+ this.mtomThreshold = mtomThreshold;
+ }
+
+ // Fill DocInfo with document info : WSDL or Schema, targetNS etc.
+ public static void fillDocInfo(RuntimeEndpointInfo endpointInfo)
+ throws XMLStreamException {
+ Map<String, DocInfo> metadata = endpointInfo.getDocMetadata();
+ if (metadata != null) {
+ for(Entry<String, DocInfo> entry: metadata.entrySet()) {
+ RuntimeWSDLParser.fillDocInfo(entry.getValue(),
+ endpointInfo.getServiceName(),
+ endpointInfo.getPortTypeName());
+ }
+ }
+ }
+
+ public static void publishWSDLDocs(RuntimeEndpointInfo endpointInfo) {
+ // Set queryString for the documents
+ Map<String, DocInfo> docs = endpointInfo.getDocMetadata();
+ if (docs == null) {
+ return;
+ }
+ Set<Entry<String, DocInfo>> entries = docs.entrySet();
+ List<String> wsdlSystemIds = new ArrayList<String>();
+ List<String> schemaSystemIds = new ArrayList<String>();
+ for(Entry<String, DocInfo> entry : entries) {
+ DocInfo docInfo = (DocInfo)entry.getValue();
+ DOC_TYPE docType = docInfo.getDocType();
+ String query = docInfo.getQueryString();
+ if (query == null && docType != null) {
+ switch(docType) {
+ case WSDL :
+ wsdlSystemIds.add(entry.getKey());
+ break;
+ case SCHEMA :
+ schemaSystemIds.add(entry.getKey());
+ break;
+ case OTHER :
+ //(docInfo.getUrl()+" is not a WSDL or Schema file.");
+ }
+ }
+ }
+
+ Collections.sort(wsdlSystemIds);
+ int wsdlnum = 1;
+ for(String wsdlSystemId : wsdlSystemIds) {
+ DocInfo docInfo = docs.get(wsdlSystemId);
+ docInfo.setQueryString("wsdl="+(wsdlnum++));
+ }
+ Collections.sort(schemaSystemIds);
+ int xsdnum = 1;
+ for(String schemaSystemId : schemaSystemIds) {
+ DocInfo docInfo = docs.get(schemaSystemId);
+ docInfo.setQueryString("xsd="+(xsdnum++));
+ }
+ endpointInfo.updateQuery2DocInfo();
+ }
+
+ public void verifyImplementorClass() {
+ if (wsProvider == null) {
+ wsProvider = (WebServiceProvider)implementorClass.getAnnotation(
+ WebServiceProvider.class);
+ }
+ if (ws == null) {
+ ws = (WebService)implementorClass.getAnnotation(WebService.class);
+ }
+ if (wsProvider == null && ws == null) {
+ throw new ServerRtException("no.ws.annotation", implementorClass);
+
+ }
+ if (wsProvider != null && ws != null) {
+ throw new ServerRtException("both.ws.annotations",
implementorClass);
+ }
+ }
+
+ public String getWsdlLocation() {
+ if (wsProvider != null && wsProvider.wsdlLocation().length() > 0) {
+ return wsProvider.wsdlLocation();
+ } else if (ws != null && ws.wsdlLocation().length() > 0) {
+ return ws.wsdlLocation();
+ }
+ return null;
+ }
+
+ public ProviderModel getProviderModel() {
+ return providerModel;
+ }
+
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/RuntimeEndpointInfo.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/ServerPropertyConstants.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/ServerPropertyConstants.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/ServerPropertyConstants.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,37 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.server;
+
+/**
+ * @author Vivek Pandey
+ *
+ * Defines server side constants
+ *
+ */
+public interface ServerPropertyConstants {
+ /*public static final String ATTACHMENT_CONTEXT =
+ "org.jboss.com.sun.xml.ws.attachment.AttachmentContext";*/
+ public static final String SET_ATTACHMENT_PROPERTY =
+ "org.jboss.com.sun.xml.ws.attachment.SetAttachmentContext";
+ public static final String GET_ATTACHMENT_PROPERTY =
+ "org.jboss.com.sun.xml.ws.attachment.GetAttachmentContext";
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/ServerPropertyConstants.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/ServerRtException.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/ServerRtException.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/ServerRtException.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,51 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.server;
+
+import org.jboss.com.sun.xml.ws.util.exception.JAXWSExceptionBase;
+import org.jboss.com.sun.xml.ws.util.localization.Localizable;
+
+/**
+ */
+public class ServerRtException extends JAXWSExceptionBase {
+
+ public ServerRtException(String key, Object... args) {
+ super(key, args);
+ }
+
+ public ServerRtException(Throwable throwable) {
+ super(throwable);
+ }
+
+ public ServerRtException(Localizable arg) {
+ super("server.rt.err", arg);
+ }
+
+ /* (non-Javadoc)
+ * @see JAXWSExceptionBase#getResourceBundleName()
+ */
+ public String getResourceBundleName() {
+ return "org.jboss.com.sun.xml.ws.resources.server";
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/ServerRtException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/TargetFinderImpl.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/TargetFinderImpl.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/TargetFinderImpl.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,46 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+//
+// Created : 2004 Apr 09 (Fri) 06:16:58 by Harold Carr.
+// Last Modified : 2004 May 03 (Mon) 17:28:38 by Harold Carr.
+//
+// @(#)FakeTargetFinder.java 1.2 04/05/03
+//
+
+package org.jboss.com.sun.xml.ws.server;
+
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.pept.presentation.TargetFinder;
+import org.jboss.com.sun.xml.ws.pept.presentation.Tie;
+
+public class TargetFinderImpl implements TargetFinder {
+
+ private Tie tie;
+
+ public TargetFinderImpl(Tie tie) {
+ this.tie = tie;
+ }
+
+ public Tie findTarget(MessageInfo messageInfo) {
+ return tie;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/TargetFinderImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/Tie.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/Tie.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/Tie.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,108 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.server;
+
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.MessageContext.Scope;
+
+import org.jboss.com.sun.xml.ws.developer.JAXWSProperties;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.DelegateBase;
+import org.jboss.com.sun.xml.ws.model.RuntimeModel;
+import org.jboss.com.sun.xml.ws.pept.Delegate;
+import org.jboss.com.sun.xml.ws.pept.ept.EPTFactory;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.pept.protocol.MessageDispatcher;
+import org.jboss.com.sun.xml.ws.spi.runtime.WSConnection;
+import org.jboss.com.sun.xml.ws.util.MessageInfoUtil;
+
+/**
+ * Entry point for all server requests.
+ *
+ * @author WS Development Team
+ */
+public class Tie implements org.jboss.com.sun.xml.ws.spi.runtime.Tie {
+
+ /**
+ * Common entry point for server runtime. <br>
+ * Creates a MessageInfo for every Request/Response.<br>
+ * Creates a RuntimeContext for every Request/Response and sets that as a metadata in
+ * MessageInfo. Doesn't create any other metadata on MessageInfo. If anything is
needed,
+ * that can be created on RuntimeContext<br>
+ * EPTFactoryFactoryBase is used to select a correct EPTFactory<br>
+ * Calls MessageDispatcher.receive(MessageInfo). <br>
+ * MessageDispatcher orchestrates all the flow: reading from WSConnection,
+ * decodes message to parameters, invoking implementor, encodes parameters to
message,
+ * and writing to WSConnection
+ *
+ * @param connection encapsulates multiple transports
+ * @param endpoint has all the information about target endpoint
+ * @throws Exception throws Exception if any error occurs
+ */
+ public void handle(WSConnection connection,
+ org.jboss.com.sun.xml.ws.spi.runtime.RuntimeEndpointInfo endpoint)
+ throws Exception {
+
+ // Create MessageInfo. MessageInfo holds all the info for this request
+ Delegate delegate = new DelegateBase();
+ MessageInfo messageInfo = (MessageInfo)delegate.getMessageStruct();
+
+ // Create runtime context, runtime model for dynamic runtime
+ RuntimeEndpointInfo endpointInfo = (RuntimeEndpointInfo)endpoint;
+ RuntimeModel runtimeModel = endpointInfo.getRuntimeModel();
+ RuntimeContext runtimeContext = new RuntimeContext(runtimeModel);
+ runtimeContext.setRuntimeEndpointInfo(endpointInfo);
+
+ // Update MessageContext
+ MessageContext msgCtxt =
+ endpointInfo.getWebServiceContext().getMessageContext();
+ updateMessageContext(endpointInfo, msgCtxt);
+
+ // Set runtime context on MessageInfo
+ MessageInfoUtil.setRuntimeContext(messageInfo, runtimeContext);
+ messageInfo.setConnection(connection);
+
+ // Select EPTFactory based on binding, and transport
+ EPTFactory eptFactory = EPTFactoryFactoryBase.getEPTFactory(messageInfo);
+ messageInfo.setEPTFactory(eptFactory);
+
+ // MessageDispatcher archestrates the flow
+ MessageDispatcher messageDispatcher =
+ messageInfo.getEPTFactory().getMessageDispatcher(messageInfo);
+ messageDispatcher.receive(messageInfo);
+ }
+
+ /**
+ * Updates MessageContext object with Service, and Port QNames
+ */
+ private void updateMessageContext( RuntimeEndpointInfo endpoint,
+ MessageContext ctxt) {
+
+ ctxt.put(MessageContext.WSDL_SERVICE, endpoint.getServiceName());
+ ctxt.setScope(MessageContext.WSDL_SERVICE, Scope.APPLICATION);
+ ctxt.put(MessageContext.WSDL_PORT, endpoint.getPortName());
+ ctxt.setScope(MessageContext.WSDL_PORT, Scope.APPLICATION);
+ ctxt.put(JAXWSProperties.MTOM_THRESHOLOD_VALUE, endpoint.getMtomThreshold());
+ ctxt.setScope(JAXWSProperties.MTOM_THRESHOLOD_VALUE, Scope.APPLICATION);
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/Tie.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/WSDLGenResolver.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/WSDLGenResolver.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/WSDLGenResolver.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,253 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.server;
+
+
+import javax.xml.transform.Result;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.ws.Holder;
+
+import org.jboss.com.sun.xml.ws.server.DocInfo.DOC_TYPE;
+import org.jboss.com.sun.xml.ws.util.ByteArrayBuffer;
+import org.jboss.com.sun.xml.ws.wsdl.parser.Service;
+import org.jboss.com.sun.xml.ws.wsdl.writer.WSDLOutputResolver;
+
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+/**
+ * @author WS Development Team
+ */
+
+public class WSDLGenResolver implements WSDLOutputResolver {
+
+ private Map<String, DocInfo> docs;
+ private DocInfo abstractWsdl;
+ private DocInfo concreteWsdl;
+ private Map<String, List<String>> nsMapping; // targetNS -> system
id list
+
+ public WSDLGenResolver(Map<String, DocInfo> docs) {
+ this.docs = docs;
+ nsMapping = new HashMap<String, List<String>>();
+ Set<Entry<String, DocInfo>> docEntries = docs.entrySet();
+ for(Entry<String, DocInfo> entry : docEntries) {
+ DocInfo docInfo = entry.getValue();
+ if (docInfo.isHavingPortType()) {
+ abstractWsdl = docInfo;
+ }
+ if (docInfo.getDocType() == DOC_TYPE.SCHEMA) {
+ List<String> sysIds = nsMapping.get(docInfo.getTargetNamespace());
+ if (sysIds == null) {
+ sysIds = new ArrayList<String>();
+ nsMapping.put(docInfo.getTargetNamespace(), sysIds);
+ }
+ sysIds.add(docInfo.getUrl().toString());
+ }
+ }
+ }
+
+ public String getWSDLFile() {
+ return concreteWsdl.getUrl().toString();
+ }
+
+ public Map<String, DocInfo> getDocs() {
+ return docs;
+ }
+
+ /*
+ public Result getWSDLOutput(String suggestedFileName) {
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+
+ StreamDocInfo docInfo = new StreamDocInfo(suggestedFileName, bout);
+
+ if (wsdlFile == null) {
+ docInfo.setQueryString("wsdl");
+ wsdlFile = suggestedFileName;
+ } else {
+ docInfo.setQueryString("wsdl="+suggestedFileName);
+ }
+ docs.put(docInfo.getPath(), docInfo);
+
+ StreamResult result = new StreamResult();
+ result.setOutputStream(bout);
+ result.setSystemId(suggestedFileName);
+ return result;
+ }
+ */
+
+ public Result getSchemaOutput(String namespaceUri, String suggestedFileName) {
+ ByteArrayBuffer bout = new ByteArrayBuffer();
+
+ StreamDocInfo docInfo = new StreamDocInfo(suggestedFileName, bout);
+ docInfo.setQueryString("xsd="+suggestedFileName);
+ docInfo.setDocType(DOC_TYPE.SCHEMA);
+ docs.put(docInfo.getUrl().toString(), docInfo);
+
+ StreamResult result = new StreamResult();
+ result.setOutputStream(bout);
+ result.setSystemId(docInfo.getUrl().toString());
+ return result;
+ }
+
+ /*
+ * return null if concrete WSDL need not be generated
+ */
+ public Result getWSDLOutput(String filename) {
+ ByteArrayBuffer bout = new ByteArrayBuffer();
+ StreamDocInfo docInfo = new StreamDocInfo(filename, bout);
+ docInfo.setDocType(DOC_TYPE.WSDL);
+ docInfo.setQueryString("wsdl");
+ concreteWsdl = docInfo;
+ docs.put(docInfo.getUrl().toString(), docInfo);
+ StreamResult result = new StreamResult();
+ result.setOutputStream(bout);
+ result.setSystemId(docInfo.getUrl().toString());
+ return result;
+ }
+
+ /*
+ * Updates filename if the suggested filename need to be changed in
+ * wsdl:import
+ *
+ * return null if abstract WSDL need not be generated
+ */
+ public Result getAbstractWSDLOutput(Holder<String> filename) {
+ if (abstractWsdl != null) {
+ filename.value = abstractWsdl.getUrl().toString();
+ return null; // Don't generate abstract WSDL
+ }
+ ByteArrayBuffer bout = new ByteArrayBuffer();
+ StreamDocInfo abstractWsdl = new StreamDocInfo(filename.value, bout);
+ abstractWsdl.setDocType(DOC_TYPE.WSDL);
+ //abstractWsdl.setQueryString("wsdl="+filename.value);
+ docs.put(abstractWsdl.getUrl().toString(), abstractWsdl);
+ StreamResult result = new StreamResult();
+ result.setOutputStream(bout);
+ result.setSystemId(abstractWsdl.getUrl().toString());
+ return result;
+ }
+
+ /*
+ * Updates filename if the suggested filename need to be changed in
+ * xsd:import
+ *
+ * return null if schema need not be generated
+ */
+ public Result getSchemaOutput(String namespace, Holder<String> filename) {
+ List<String> schemas = nsMapping.get(namespace);
+ if (schemas != null) {
+ if (schemas.size() > 1) {
+ throw new ServerRtException("server.rt.err",
+ "More than one schema for the target namespace
"+namespace);
+ }
+ filename.value = schemas.get(0);
+ return null; // Don't generate schema
+ }
+ ByteArrayBuffer bout = new ByteArrayBuffer();
+ StreamDocInfo docInfo = new StreamDocInfo(filename.value, bout);
+ docInfo.setDocType(DOC_TYPE.SCHEMA);
+ //docInfo.setQueryString("xsd="+filename.value);
+ docs.put(docInfo.getUrl().toString(), docInfo);
+ StreamResult result = new StreamResult();
+ result.setOutputStream(bout);
+ result.setSystemId(docInfo.getUrl().toString());
+ return result;
+ }
+
+ private static class StreamDocInfo implements DocInfo {
+ private ByteArrayBuffer bout;
+ private String resource;
+ private String queryString;
+ private DOC_TYPE docType;
+
+ public StreamDocInfo(String resource, ByteArrayBuffer bout) {
+ this.resource = resource;
+ this.bout = bout;
+ }
+
+ public InputStream getDoc() {
+ bout.close();
+ return bout.newInputStream();
+ }
+
+ public String getPath() {
+ return resource;
+ }
+
+ public URL getUrl() {
+ try {
+ return new URL("file:///"+resource);
+ } catch(Exception e) {
+
+ }
+ return null;
+ }
+
+ public String getQueryString() {
+ return queryString;
+ }
+
+ public void setQueryString(String queryString) {
+ this.queryString = queryString;
+ }
+
+ public void setDocType(DOC_TYPE docType) {
+ this.docType = docType;
+ }
+
+ public DOC_TYPE getDocType() {
+ return docType;
+ }
+
+ public void setTargetNamespace(String ns) {
+
+ }
+
+ public String getTargetNamespace() {
+ return null;
+ }
+
+ public void setService(Service service) {
+
+ }
+
+ public Service getService() {
+ return null;
+ }
+
+ public void setHavingPortType(boolean portType) {
+
+ }
+
+ public boolean isHavingPortType() {
+ return false;
+ }
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/WSDLGenResolver.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/WSDLPatcher.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/WSDLPatcher.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/WSDLPatcher.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,303 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.server;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.logging.Logger;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLEventFactory;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLEventWriter;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.events.Attribute;
+import javax.xml.stream.events.StartElement;
+import javax.xml.stream.events.StartDocument;
+import javax.xml.stream.events.XMLEvent;
+
+import org.jboss.com.sun.xml.ws.wsdl.parser.WSDLConstants;
+public class WSDLPatcher {
+
+ private static final String NS_XSD = "http://www.w3.org/2001/XMLSchema";
+ private static final QName QNAME_SCHEMA = new QName(NS_XSD, "schema");
+ private static final QName SCHEMA_INCLUDE_QNAME = new QName(NS_XSD,
"include");
+ private static final QName SCHEMA_IMPORT_QNAME = new QName(NS_XSD,
"import");
+ private static final QName ATTR_NAME_QNAME = new QName("",
"name");
+ private static final QName ATTR_TARGETNS_QNAME =
+ new QName("", "targetNamespace");
+ private static final QName WSDL_LOCATION_QNAME = new QName("",
"location");
+ private static final QName SCHEMA_LOCATION_QNAME =
+ new QName("", "schemaLocation");
+
+ private static final XMLEventFactory eventFactory =
+ XMLEventFactory.newInstance();
+ private static final XMLOutputFactory outputFactory =
+ XMLOutputFactory.newInstance();
+ private static final XMLInputFactory inputFactory =
+ XMLInputFactory.newInstance();
+
+ private static final Logger logger =
+ Logger.getLogger(
+ org.jboss.com.sun.xml.ws.util.Constants.LoggingDomain +
".wsdl.patcher");
+
+ private DocInfo docInfo;
+ private String baseAddress;
+ private RuntimeEndpointInfo targetEndpoint;
+ private List<RuntimeEndpointInfo> endpoints;
+
+ /*
+ * inPath - /WEB-INF/wsdl/xxx.wsdl
+ * baseAddress -
http://host:port/context/
+ */
+ public WSDLPatcher(DocInfo docInfo, String baseAddress,
+ RuntimeEndpointInfo targetEndpoint,
+ List<RuntimeEndpointInfo> endpoints) {
+ this.docInfo = docInfo;
+ this.baseAddress = baseAddress;
+ this.targetEndpoint = targetEndpoint;
+ this.endpoints = endpoints;
+ }
+
+ /*
+ * import, include, soap:address locations are patched
+ * caller needs to take care of closing of the streams
+ */
+ public void patchDoc(InputStream in, OutputStream out) {
+ XMLEventReader reader = null;
+ XMLEventWriter writer = null;
+ try {
+ reader = inputFactory.createXMLEventReader(in);
+ StartElement start = null;
+ QName serviceName = null;
+ QName portName = null;
+ String targetNamespace = null;
+ while(reader.hasNext()) {
+ XMLEvent event = reader.nextEvent();
+ if (event.isStartDocument()) {
+ StartDocument sd = (StartDocument)event;
+ String encoding = sd.encodingSet()
+ ? sd.getCharacterEncodingScheme()
+ : null;
+ writer = (encoding != null)
+ ? outputFactory.createXMLEventWriter(out, encoding)
+ : outputFactory.createXMLEventWriter(out);
+ } else if (event.isStartElement()) {
+ start = event.asStartElement();
+ QName name = start.getName();
+ if (name.equals(SCHEMA_INCLUDE_QNAME)) {
+ event = handleSchemaInclude(start);
+ } else if (name.equals(SCHEMA_IMPORT_QNAME)) {
+ event = handleSchemaImport(start);
+ } else if (name.equals(WSDLConstants.QNAME_IMPORT)) {
+ event = handleWSDLImport(start);
+ } else if (name.equals(WSDLConstants.NS_SOAP_BINDING_ADDRESS) ||
+ name.equals(WSDLConstants.NS_SOAP12_BINDING_ADDRESS)) {
+ event = handleSoapAddress(serviceName, portName, start);
+ } else if (name.equals(WSDLConstants.QNAME_DEFINITIONS)) {
+ Attribute attr = start.getAttributeByName(ATTR_TARGETNS_QNAME);
+ if (attr != null) {
+ targetNamespace = attr.getValue();
+ }
+ } else if (name.equals(WSDLConstants.QNAME_SERVICE)) {
+ Attribute attr = start.getAttributeByName(ATTR_NAME_QNAME);
+ if (attr != null) {
+ serviceName = new QName(targetNamespace, attr.getValue());
+ }
+ } else if (name.equals(WSDLConstants.QNAME_PORT)) {
+ Attribute attr = start.getAttributeByName(ATTR_NAME_QNAME);
+ if (attr != null) {
+ portName = new QName(targetNamespace, attr.getValue());
+ }
+ }
+ } else if (event.isEndElement()) {
+ start = null;
+ }
+ writer.add(event);
+ }
+ } catch (XMLStreamException e) {
+ throw new ServerRtException("runtime.wsdl.patcher",e);
+ } finally {
+ if (reader != null) {
+ try {
+ reader.close();
+ } catch(XMLStreamException e) {
+ e.printStackTrace();
+ }
+ }
+ if (writer != null) {
+ try {
+ writer.close();
+ } catch(XMLStreamException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+ /*
+ * return patchedlocation null if we don't how to patch this location
+ */
+ private String getPatchedImportLocation(String relPath) {
+ try {
+ URL relUrl = new URL(docInfo.getUrl(), relPath);
+ String query = targetEndpoint.getQueryString(relUrl);
+ if (query == null) {
+ return null;
+ }
+ String abs =
baseAddress+targetEndpoint.getUrlPatternWithoutStar()+"?"+query;
+ return abs;
+ } catch(MalformedURLException mue) {
+ return null;
+ }
+ }
+
+ private XMLEvent patchImport(StartElement startElement, QName location)
+ throws XMLStreamException {
+ Attribute locationAttr = startElement.getAttributeByName(location);
+ if (locationAttr == null) {
+ return startElement;
+ }
+
+ List<Attribute> newAttrs = new ArrayList<Attribute>();
+ Iterator i = startElement.getAttributes();
+ while(i.hasNext()) {
+ Attribute attr = (Attribute)i.next();
+ String file = attr.getValue();
+ if (attr.getName().equals(location)) {
+ String relPath = attr.getValue();
+ //if (isPatchable(relPath)) {
+ String absPath = getPatchedImportLocation(relPath);
+ if (absPath == null) {
+ //logger.warning("Couldn't fix the relative
location:"+relPath);
+ return startElement; // Not patching
+ }
+ logger.fine("Fixing the relative location:"+relPath
+ +" with absolute location:"+absPath);
+ Attribute newAttr = eventFactory.createAttribute(
+ location, absPath);
+ newAttrs.add(newAttr);
+ continue;
+ //}
+ }
+ newAttrs.add(attr);
+ }
+ XMLEvent event = eventFactory.createStartElement(
+ startElement.getName().getPrefix(),
+ startElement.getName().getNamespaceURI(),
+ startElement.getName().getLocalPart(),
+ newAttrs.iterator(),
+ startElement.getNamespaces(),
+ startElement.getNamespaceContext());
+ return event;
+ }
+
+ /*
+ * <schema:import> element is patched with correct uri and
+ * returns a new element
+ */
+ private XMLEvent handleSchemaImport(StartElement startElement)
+ throws XMLStreamException {
+ return patchImport(startElement, SCHEMA_LOCATION_QNAME);
+ }
+
+ /*
+ * <schema:include> element is patched with correct uri and
+ * returns a new element
+ */
+ private XMLEvent handleSchemaInclude(StartElement startElement)
+ throws XMLStreamException {
+ return patchImport(startElement, SCHEMA_LOCATION_QNAME);
+ }
+
+ /*
+ * <wsdl:import> element is patched with correct uri and
+ * returns a new element
+ */
+ private XMLEvent handleWSDLImport(StartElement startElement)
+ throws XMLStreamException {
+ return patchImport(startElement, WSDL_LOCATION_QNAME);
+ }
+
+ /*
+ * <soap:address> element is patched with correct endpoint address and
+ * returns a new element
+ */
+ private XMLEvent handleSoapAddress(QName service, QName port,
+ StartElement startElement) throws XMLStreamException {
+
+ List<Attribute> newAttrs = new ArrayList<Attribute>();
+ Iterator i = startElement.getAttributes();
+ while(i.hasNext()) {
+ Attribute attr = (Attribute)i.next();
+ String file = attr.getValue();
+ if (attr.getName().equals(WSDL_LOCATION_QNAME)) {
+ String value = getAddressLocation(service, port);
+ if (value == null) {
+ return startElement; // Not patching
+ }
+ logger.fine("Fixing service:"+service+ " port:"+port
+ + " address with "+value);
+ Attribute newAttr = eventFactory.createAttribute(
+ WSDL_LOCATION_QNAME, value);
+ newAttrs.add(newAttr);
+ continue;
+ }
+ newAttrs.add(attr);
+ }
+ XMLEvent event = eventFactory.createStartElement(
+ startElement.getName().getPrefix(),
+ startElement.getName().getNamespaceURI(),
+ startElement.getName().getLocalPart(),
+ newAttrs.iterator(),
+ startElement.getNamespaces(),
+ startElement.getNamespaceContext());
+ return event;
+ }
+
+ /*
+ * For the given service, port names it matches the correct endpoint and
+ * reutrns its endpoint address
+ */
+ private String getAddressLocation(QName docServiceName, QName docPortName) {
+ for(RuntimeEndpointInfo endpointInfo : endpoints) {
+ QName serviceName = endpointInfo.getServiceName();
+ QName portName = endpointInfo.getPortName();
+ if (serviceName != null && portName != null
+ && docServiceName != null && docPortName != null
+ && serviceName.equals(docServiceName)
+ && docPortName.equals(portName)) {
+ return baseAddress+endpointInfo.getUrlPatternWithoutStar();
+ }
+ }
+ return null;
+ }
+
+}
+
+
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/WSDLPatcher.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/WSDLPublisher.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/WSDLPublisher.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/WSDLPublisher.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,155 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.server;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.logging.Logger;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.com.sun.xml.ws.util.localization.LocalizableMessageFactory;
+import org.jboss.com.sun.xml.ws.util.localization.Localizer;
+
+import java.io.InputStream;
+import java.io.PrintWriter;
+import java.util.List;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class WSDLPublisher {
+
+ public WSDLPublisher(ServletContext context,
+ List<RuntimeEndpointInfo> endpoints) {
+ this.endpoints = endpoints;
+ localizer = new Localizer();
+ messageFactory =
+ new
LocalizableMessageFactory("org.jboss.com.sun.xml.ws.resources.wsservlet");
+ }
+
+ public void handle(
+ RuntimeEndpointInfo targetEndpoint,
+ Map fixedUrlPatternEndpoints,
+ HttpServletRequest request,
+ HttpServletResponse response)
+ throws IOException, ServletException {
+
+ Iterator urlPatterns = fixedUrlPatternEndpoints.entrySet().iterator();
+ String urlPattern = null;
+
+ // need to find correct url pattern in map to create baseAddress
+ /*
+ * (this could still use testing. may be an issue when there
+ * are >2 url patterns for the same endpoint.)
+ */
+ while (urlPatterns.hasNext()) { // could be empty
+ Map.Entry entry = (Map.Entry) urlPatterns.next();
+ String testPattern = (String)entry.getKey();
+ if (targetEndpoint == (RuntimeEndpointInfo)entry.getValue()) {
+ urlPattern = testPattern;
+ break;
+ }
+ }
+
+ // have to assume that only 1 path url was used for this endpoint
+ if (urlPattern == null) {
+ urlPattern = targetEndpoint.getUrlPattern();
+ if (urlPattern.endsWith("/*")) { // should always be true at this
point
+ urlPattern = urlPattern.substring(0, urlPattern.length() - 2);
+ }
+
+ // add new pattern and endpoint to map for stylesheet
+ fixedUrlPatternEndpoints.put(urlPattern, targetEndpoint);
+ }
+
+ StringBuffer addrBuf = new StringBuffer();
+ addrBuf.append(request.getScheme());
+ addrBuf.append("://");
+ addrBuf.append(request.getServerName());
+ addrBuf.append(":");
+ addrBuf.append(request.getServerPort());
+ addrBuf.append(request.getRequestURI());
+
+ String actualAddress = addrBuf.toString();
+ String baseAddress =
+ actualAddress.substring(0, actualAddress.lastIndexOf(urlPattern));
+
+ String inPath = targetEndpoint.getPath(request.getQueryString());
+ if (inPath == null) {
+ writeNotFoundErrorPage(response, "Invalid Request");
+ return;
+ }
+ DocInfo in = targetEndpoint.getDocMetadata().get(inPath);
+ if (in == null) {
+ writeNotFoundErrorPage(response, "Invalid Request");
+ return;
+ }
+ response.setContentType("text/xml");
+ response.setStatus(HttpServletResponse.SC_OK);
+ OutputStream outputStream = response.getOutputStream();
+ WSDLPatcher patcher = new WSDLPatcher(in, baseAddress,
+ targetEndpoint, endpoints);
+ InputStream is = in.getDoc();
+ try {
+ patcher.patchDoc(is, outputStream);
+ } finally {
+ is.close();
+ }
+ return;
+ }
+
+ protected void writeNotFoundErrorPage(
+ HttpServletResponse response,
+ String message)
+ throws IOException {
+ response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ response.setContentType("text/html");
+ PrintWriter out = response.getWriter();
+ out.println("<html>");
+ out.println("<head><title>");
+ out.println(
+ localizer.localize(
+ messageFactory.getMessage("servlet.html.title")));
+ out.println("</title></head>");
+ out.println("<body>");
+ out.println(
+ localizer.localize(
+ messageFactory.getMessage("servlet.html.notFound", message)));
+ out.println("</body>");
+ out.println("</html>");
+ }
+
+ private List<RuntimeEndpointInfo> endpoints;
+ private Localizer localizer;
+ private LocalizableMessageFactory messageFactory;
+ private static final Logger logger =
+ Logger.getLogger(
+ org.jboss.com.sun.xml.ws.util.Constants.LoggingDomain +
".server.http");
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/WSDLPublisher.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/XMLEPTFactoryImpl.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/XMLEPTFactoryImpl.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/XMLEPTFactoryImpl.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,112 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.server;
+
+import org.jboss.com.sun.xml.ws.encoding.internal.InternalEncoder;
+import org.jboss.com.sun.xml.ws.encoding.xml.XMLDecoder;
+import org.jboss.com.sun.xml.ws.encoding.xml.XMLEPTFactory;
+import org.jboss.com.sun.xml.ws.encoding.xml.XMLEncoder;
+import org.jboss.com.sun.xml.ws.pept.encoding.Decoder;
+import org.jboss.com.sun.xml.ws.pept.encoding.Encoder;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.pept.presentation.TargetFinder;
+import org.jboss.com.sun.xml.ws.pept.protocol.Interceptors;
+import org.jboss.com.sun.xml.ws.pept.protocol.MessageDispatcher;
+
+/**
+ * @author WS Development Team
+ */
+public class XMLEPTFactoryImpl implements XMLEPTFactory {
+ private Encoder encoder;
+ private Decoder decoder;
+ private XMLEncoder xmlEncoder;
+ private XMLDecoder xmlDecoder;
+ private InternalEncoder internalEncoder;
+ private TargetFinder targetFinder;
+ private MessageDispatcher messageDispatcher;
+
+ public XMLEPTFactoryImpl(Encoder encoder, Decoder decoder,
+ TargetFinder targetFinder, MessageDispatcher messageDispatcher) {
+ this.encoder = encoder;
+ this.decoder = decoder;
+ this.targetFinder = targetFinder;
+ this.messageDispatcher = messageDispatcher;
+ }
+
+ public XMLEPTFactoryImpl(XMLEncoder xmlEncoder, XMLDecoder xmlDecoder,
+ InternalEncoder internalEncoder,
+ TargetFinder targetFinder, MessageDispatcher
messageDispatcher) {
+ this.xmlEncoder = xmlEncoder;
+ this.xmlDecoder = xmlDecoder;
+ this.encoder = null;
+ this.decoder = null;
+ this.internalEncoder = internalEncoder;
+ this.targetFinder = targetFinder;
+ this.messageDispatcher = messageDispatcher;
+ }
+
+ public Encoder getEncoder(MessageInfo messageInfo) {
+ messageInfo.setEncoder(encoder);
+ return messageInfo.getEncoder();
+ }
+
+ public Decoder getDecoder(MessageInfo messageInfo) {
+ messageInfo.setDecoder(decoder);
+ return messageInfo.getDecoder();
+ }
+
+ public TargetFinder getTargetFinder(MessageInfo messageInfo) {
+ return targetFinder;
+ }
+
+ public MessageDispatcher getMessageDispatcher(MessageInfo messageInfo) {
+ messageInfo.setMessageDispatcher(messageDispatcher);
+ return messageDispatcher;
+ }
+
+ /*
+ * @see
com.sun.istack.pept.ept.EPTFactory#getInterceptors(com.sun.istack.pept.ept.MessageInfo)
+ */
+ public Interceptors getInterceptors(MessageInfo x) {
+ return null;
+ }
+
+ /*
+ * @see org.jboss.com.sun.xml.ws.encoding.jaxb.LogicalEPTFactory#getSoapEncoder()
+ */
+ public XMLEncoder getXMLEncoder() {
+ return xmlEncoder;
+ }
+
+ /*
+ * @see org.jboss.com.sun.xml.ws.encoding.jaxb.LogicalEPTFactory#getSoapDecoder()
+ */
+ public XMLDecoder getXMLDecoder() {
+ return xmlDecoder;
+ }
+
+ public InternalEncoder getInternalEncoder() {
+ return internalEncoder;
+ }
+
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/XMLEPTFactoryImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/package-info.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/package-info.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/package-info.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,243 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+/**
+ * <h1>JAX-WS 2.0 Server Runtime</h1>
+ * <P>This document describes the architecture of server side
+ * JAX-WS 2.0 runtime. </p>
+ *
+ * <h3>JAX-WS 2.0 Server Runtime Sequence Diagram</h3>
+ * {@SequenceDiagram
+ pobject(U,"user");
+ object(A,"WSConnection");
+ object(B,"Tie");
+ object(E,"MessageDispatcher");
+ object(F,"EPTFactoryFactoryBase");
+ object(G,"Endpoint");
+ step();
+
+ message(U,A,"invoke Web Service");
+ active(A);
+ message(A,A,"getRuntimeEndpointInfo");
+ active(A);
+ step();
+ inactive(A);
+
+ message(A,B,"handle");
+ active(B);
+# inactive(A);
+
+ message(B,B,"createMessageInfo");
+ active(B);
+ step();
+ inactive(B);
+
+ message(B,B,"createRuntimeContext");
+ active(B);
+ step();
+ inactive(B);
+
+ message(B,F,"getEPTFactory");
+ active(F);
+ step();
+ inactive(F);
+
+ message(B,B,"getMessageDispatcher");
+ active(B);
+ step();
+ inactive(B);
+
+ message(B,E,"receive");
+ active(E);
+ inactive(B);
+# complete(B);
+
+ message(E,E,"mustUnderstand");
+ active(E);
+ step();
+ inactive(E);
+
+ message(E,E,"createSOAPMessage");
+ active(E);
+ step();
+ inactive(E);
+
+ message(E,E,"invokeHandlers");
+ active(E);
+ step();
+ inactive(E);
+
+ message(E,E,"createInternalMessage");
+ active(E);
+ step();
+ inactive(E);
+
+ message(E,G,"invoke endpoint");
+ active(G);
+# step();
+ rmessage(G,E,"response");
+# complete(G);
+ inactive(G);
+
+ message(E,E,"createInternalMessage");
+ active(E);
+ step();
+ inactive(E);
+
+ message(E,E,"createSOAPMessage");
+ active(E);
+ step();
+ inactive(E);
+
+ message(E,E,"invokeHandlers");
+ active(E);
+ step();
+ inactive(E);
+
+# active(A);
+ rmessage(E,A,"response");
+# complete(E);
+#inactive(E);
+
+ active(A);
+# complete(E);
+inactive(E);
+# rmessage(A,U,"response");
+# complete(E);
+# complete(A);
+ complete(A);
+ * }
+ *
+ *
+ *
+ * <H3>Message Flow</H3>
+ * <P>A Web Service invocation starts with either the
+ * {@link org.jboss.com.sun.xml.ws.transport.http.servlet.WSServletDelegate
WSServletDelegate}
+ * or the {@link org.jboss.com.sun.xml.ws.transport.http.server.ServerConnectionImpl
ServerConnectionImpl}.
+ * Both of these classes find the appropriate {@link
org.jboss.com.sun.xml.ws.server.RuntimeEndpointInfo RuntimeEndpointInfo}
+ * and invokes the {@link
org.jboss.com.sun.xml.ws.server.Tie#handle(org.jboss.com.sun.xml.ws.spi.runtime.WSConnection,
+ * org.jboss.com.sun.xml.ws.spi.runtime.RuntimeEndpointInfo) Tie.handle}
+ * method. This method first creates a {@link com.sun.pept.ept.MessageInfo MessageInfo}
+ * used to gather inforrmation about the message to be received. A
+ * {@link org.jboss.com.sun.xml.ws.server.RuntimeContext RuntimeContext}
+ * is then created with the MessageInfo and the {@link
org.jboss.com.sun.xml.ws.model.RuntimeModel RuntimeModel}
+ * retrieved from the RuntimeEndpointInfo. The RuntimeContext is then
+ * stored in the MessageInfo. The {@link com.sun.pept.ept.EPTFactory EPTFactory}
+ * is retrieved from the {@link org.jboss.com.sun.xml.ws.server.EPTFactoryFactoryBase
EPTFactoryFactoryBase}
+ * and also placed in the MessagInfo. A {@link com.sun.pept.protocol.MessageDispatcher
MessageDispatcher}
+ * is then created and the receive method is invoked. There will be two
+ * types of MessageDispatchers for JAX-WS 2.0 FCS, SOAPMessageDispatcher
+ * (one for client and one for the server) and an XMLMessageDispatcher
+ * (one for the client and one for the server).</P>
+ * <P>The MessageDispatcher.receive method orchestrates the receiving of
+ * a Message. The SOAPMessageDispatcher first converts the MessageInfo
+ * to a SOAPMessage. The SOAPMessageDispatcher then does mustUnderstand
+ * processing followed by an invocation of any handlers. The SOAPMessage
+ * is then converted to an InternalMessage and stored in the
+ * MessageInfo. The converting of the SOAPMessage to an InternalMessage
+ * is done using the decoder retrieved from the EPTFactory that is
+ * contained in the MessageInfo. Once the SOAPMessage has been converted
+ * to an InternalMessage the endpoint implementation is invoked via
+ * reflection from the Method stored in the MessageInfo. The return
+ * value of the method call is then stored in the InternalMessage. An
+ * internalMessage is then created from the MessageInfo. The SOAPEncoder
+ * is retrieved from the EPTFactory stored in the MessageInfo. The
+ * SOAPEncoder.toSOAPMessage is then invoked to create a SOAPMessage
+ * from the InternalMessage. A WSConnection is then retrieved from the
+ * MessageInfo and the SOAPMessage is returned over that WSConnection.</P>
+ * <P><BR>
+ * </P>
+ * <H3>External Interactions</H3>
+ * <H4>SAAJ API</H4>
+ * <UL>
+ * <LI><P>JAX-WS creates SAAJ javax.xml.soap.SOAPMessage
+ * from the HttpServletRequest.
+ * At present, JAX-WS reads all the bytes from the request stream and
+ * then creates SOAPMessage along with the HTTP headers.</P>
+ * </UL>
+ * <P>javax.xml.soap.MessageFactory(binding).createMessage(MimeHeaders,
InputStream)</P>
+ * <UL>
+ * <LI><P>SOAPMessage parses the content from the stream including MIME
+ * data</P>
+ *
<LI><P>org.jboss.com.sun.xml.ws.server.SOAPMessageDispatcher::checkHeadersPeekBody()</P>
+ * <P>SOAPMessage.getSOAPHeader() is used for mustUnderstand processing
+ * of headers. It further uses
+ * javax.xml.soap.SOAPHeader.examineMustUnderstandHeaderElements(role)</P>
+ * <P>SOAPMessage.getSOAPBody().getFistChild() is used for guessing the
+ * MEP of the request</P>
+ *
<LI><P>org.jboss.com.sun.xml.ws.handler.HandlerChainCaller:insertFaultMessage()</P>
+ * <P>SOAPMessage.getSOAPPart().getEnvelope() and some other SAAJ calls
+ * are made to create a fault in the SOAPMessage</P>
+ * <LI><P>org.jboss.com.sun.xml.ws.handler.LogicalMessageImpl::getPayload()
+ * interacts with SAAJ to get body from SOAPMessage</P>
+ *
<LI><P>org.jboss.com.sun.xml.ws.encoding.soap.SOAPEncoder.toSOAPMessage(org.jboss.com.sun.xml.ws.encoding.soap.internal.InternalMessage,
+ * SOAPMessage). There is a scenario where there is SOAPMessage and a
+ * logical handler sets payload as Source. To write to the stream,
+ * SOAPMessage.writeTo() is used but before that the body needs to be
+ * updated with logical handler' Source. Need to verify if this
+ * scenario is still happening since Handler.close() is changed to take
+ * MessageContext.</P>
+ *
<LI><P>org.jboss.com.sun.xml.ws.handlerSOAPMessageContextImpl.getHeaders()
+ * uses SAAJ API to get headers.</P>
+ * <LI><P>SOAPMessage.writeTo() is used to write response. At present,
+ * it writes into byte[] and this byte[] is written to
+ * HttpServletResponse.</P>
+ * </UL>
+ * <H4>JAXB API</H4>
+ * <P>JAX-WS RI uses the JAXB API to marshall/unmarshall user created
+ * JAXB objects with user created {@link javax.xml.bind.JAXBContext JAXBContext}.
+ * Handler, Dispatch in JAX-WS API provide ways for the user to specify his/her own
+ * JAXBContext. {@link org.jboss.com.sun.xml.ws.encoding.jaxb.JAXBTypeSerializer
JAXBTypeSerializer} class uses all these methods.</P>
+ * <UL>
+ * <LI><p>{@link javax.xml.bind.Marshaller#marshal(Object,XMLStreamWriter)
Marshaller.marshal(Object,XMLStreamWriter)}</p>
+ * <LI><P>{@link javax.xml.bind.Marshaller#marshal(Object,Result)
Marshaller.marshal(Object, DomResult)}</P>
+ * <LI><P>{@link javax.xml.bind.Unmarshaller#unmarshal(XMLStreamReader)
Object Unmarshaller.unmarshal(XMLStreamReader)}</P>
+ * <LI><P>{@link javax.xml.bind.Unmarshaller#unmarshal(Source) Object
Unmarshaller.unmarshal(Source)}</P>
+ * </UL>
+ * The following two JAXB classes are implemented by JAX-WS to enable/implement MTOM and
XOP
+ * <UL>
+ * <LI><P>{@link javax.xml.bind.attachment.AttachmentMarshaller
AttachmentMarshaller}</P>
+ * <LI><P>{@link javax.xml.bind.attachment.AttachmentUnmarshaller
AttachmentUnmarshaller}</P>
+ * </UL>
+ * <H4>JAXB Runtime-API (private contract)</H4>
+ * <P>JAX-WS RI uses these private API for serialization/deserialization
+ * purposes. This private API is used to serialize/deserialize method
+ * parameters at the time of JAXBTypeSerializer class uses all
+ * these methods.</P>
+ * <UL>
+ * <LI><P>{@link com.sun.xml.bind.api.Bridge#marshal(BridgeContext, Object,
XMLStreamWriter) Bridge.marshal(BridgeContext, Object, XMLStreamWriter)}</P>
+ * <LI><P>{@link com.sun.xml.bind.api.Bridge#marshal(BridgeContext, Object,
Node) Bridge.marshal(BridgeContext, Object, Node)}</P>
+ * <LI><P>{@link com.sun.xml.bind.api.Bridge#unmarshal(BridgeContext,
XMLStreamReader) Object Bridge.unmarshal(BridgeContext, XMLStreamReader)}</P>
+ * </UL>
+ *
+ * @ArchitectureDocument
+ **/
+package org.jboss.com.sun.xml.ws.server;
+
+import com.sun.xml.bind.api.BridgeContext;
+
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.Source;
+import javax.xml.transform.Result;
+
+import org.w3c.dom.Node;
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/package-info.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/provider/ProviderModel.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/provider/ProviderModel.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/provider/ProviderModel.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,117 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.server.provider;
+
+import com.sun.xml.bind.api.JAXBRIContext;
+import java.lang.reflect.ParameterizedType;
+import javax.activation.DataSource;
+import javax.xml.ws.Binding;
+import javax.xml.ws.Provider;
+import java.lang.reflect.Type;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.transform.Source;
+import javax.xml.ws.Service;
+import javax.xml.ws.ServiceMode;
+import javax.xml.ws.soap.SOAPBinding;
+
+import org.jboss.com.sun.xml.ws.server.PeptTie;
+
+
+/**
+ * Keeps the runtime information like Service.Mode and erasure of Provider class
+ * about Provider endpoint. It proccess annotations to find about Service.Mode
+ * It also finds about parameterized type(e.g. Source, SOAPMessage, DataSource)
+ * of endpoint class.
+ *
+ */
+public class ProviderModel {
+
+ private final boolean isSource;
+ private final Service.Mode mode;
+
+ public ProviderModel(Class implementorClass, Binding binding) {
+ assert implementorClass != null;
+ assert binding != null;
+
+ mode = getServiceMode(implementorClass);
+ Class otherClass = (binding instanceof SOAPBinding)
+ ? SOAPMessage.class : DataSource.class;
+ isSource = isSource(implementorClass, otherClass);
+ if (mode == Service.Mode.PAYLOAD && !isSource) {
+ // Illegal to have PAYLOAD && SOAPMessage
+ // Illegal to have PAYLOAD && DataSource
+ throw new IllegalArgumentException(
+ "Illeagal combination - Mode.PAYLOAD and
Provider<"+otherClass.getName()+">");
+ }
+ }
+
+ public boolean isSource() {
+ return isSource;
+ }
+
+ public Service.Mode getServiceMode() {
+ return mode;
+ }
+
+ /**
+ * Is it PAYLOAD or MESSAGE ??
+ */
+ private static Service.Mode getServiceMode(Class c) {
+ ServiceMode mode = (ServiceMode)c.getAnnotation(ServiceMode.class);
+ if (mode == null) {
+ return Service.Mode.PAYLOAD;
+ }
+ return mode.value();
+ }
+
+ /**
+ * Is it Provider<Source> ? Finds whether the parameterized type is
+ * Source.class or not.
+ *
+ * @param c provider endpoint class
+ * @param otherClass Typically SOAPMessage.class or DataSource.class
+ * @return true if c's parameterized type is Source
+ * false otherwise
+ * @throws IllegalArgumentException if it is not
+ * Provider<Source> or Provider<otherClass>
+ *
+ */
+ private static boolean isSource(Class c, Class otherClass) {
+ Type base = JAXBRIContext.getBaseType(c, Provider.class);
+ assert base != null;
+ if (base instanceof ParameterizedType) {
+ ParameterizedType pt = (ParameterizedType)base;
+ Type[] types = pt.getActualTypeArguments();
+ if (types[0] instanceof Class &&
Source.class.isAssignableFrom((Class)types[0])) {
+ return true;
+ }
+ if (types[0] instanceof Class &&
otherClass.isAssignableFrom((Class)types[0])) {
+ return false;
+ }
+ }
+ throw new IllegalArgumentException(
+ "Endpoint should implement Provider<"+Source.class.getName()+
+ "> or Provider<"+otherClass.getName()+">");
+ }
+
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/provider/ProviderModel.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/provider/ProviderPeptTie.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/provider/ProviderPeptTie.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/provider/ProviderPeptTie.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,84 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.server.provider;
+
+import java.lang.reflect.Method;
+import javax.xml.ws.Provider;
+import javax.xml.ws.WebServiceException;
+
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.pept.presentation.MessageStruct;
+import org.jboss.com.sun.xml.ws.server.PeptTie;
+import org.jboss.com.sun.xml.ws.server.RuntimeContext;
+import org.jboss.com.sun.xml.ws.server.RuntimeEndpointInfo;
+import org.jboss.com.sun.xml.ws.util.MessageInfoUtil;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+
+/**
+ * Creates a Stateless Tie object so that it is created only once and reused.
+ */
+public class ProviderPeptTie extends PeptTie {
+
+ private static final Logger logger = Logger.getLogger(
+ org.jboss.com.sun.xml.ws.util.Constants.LoggingDomain +
".server.ProviderPeptTie");
+
+ public static final Method invoke_Method;
+ static {
+ try {
+ Class[] methodParams = { Object.class };
+ invoke_Method = (Provider.class).getMethod("invoke",
methodParams);
+ } catch (NoSuchMethodException e) {
+ throw new WebServiceException(e.getMessage(), e);
+ }
+ };
+
+ /*
+ * @see Tie#_invoke(MessageInfo)
+ */
+ public void _invoke(MessageInfo messageInfo) {
+ Object[] oa = messageInfo.getData();
+ RuntimeContext rtCtxt = MessageInfoUtil.getRuntimeContext(messageInfo);
+ RuntimeEndpointInfo endpointInfo = rtCtxt.getRuntimeEndpointInfo();
+ Provider servant = (Provider)endpointInfo.getImplementor();
+ try {
+ Object response = servant.invoke(oa[0]);
+ messageInfo.setResponse(response);
+ messageInfo.setResponseType(MessageStruct.NORMAL_RESPONSE);
+ if (response == null) {
+ messageInfo.setMEP(MessageStruct.ONE_WAY_MEP);
+ } else {
+ messageInfo.setMEP(MessageStruct.REQUEST_RESPONSE_MEP);
+ }
+ } catch (RuntimeException e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ messageInfo.setResponseType(MessageStruct.UNCHECKED_EXCEPTION_RESPONSE);
+ messageInfo.setResponse(e);
+ } catch (Exception e) {
+ messageInfo.setResponseType(MessageStruct.CHECKED_EXCEPTION_RESPONSE);
+ messageInfo.setResponse(e);
+ }
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/server/provider/ProviderPeptTie.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/Binding.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/Binding.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/Binding.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,34 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.spi.runtime;
+
+/** The <code>Binding</code> is the spi interface that extends the base
interface
+ * for JAX-WS protocol bindings.
+ * This interface is implemented by org.jboss.com.sun.xml.ws.client.Binding.
+**/
+public interface Binding extends javax.xml.ws.Binding {
+
+ public SystemHandlerDelegate getSystemHandlerDelegate();
+
+ public void setSystemHandlerDelegate(SystemHandlerDelegate delegate);
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/Binding.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/ClientTransportFactory.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/ClientTransportFactory.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/ClientTransportFactory.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,32 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.spi.runtime;
+
+import java.util.Map;
+
+/**
+ * This class is implemented by
+ * org.jboss.com.sun.xml.ws.client.ClientTransportFactory
+ */
+public interface ClientTransportFactory {
+ public WSConnection create(Map<String, Object> context);
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/ClientTransportFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/ClientTransportFactoryTypes.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/ClientTransportFactoryTypes.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/ClientTransportFactoryTypes.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,30 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.spi.runtime;
+
+/**
+ * This defines the types of ClientTransportFactory
+ */
+public interface ClientTransportFactoryTypes {
+ public static final int HTTP = 0;
+ public static final int LOCAL = 1;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/ClientTransportFactoryTypes.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/InternalSoapEncoder.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/InternalSoapEncoder.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/InternalSoapEncoder.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,54 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.spi.runtime;
+
+import javax.xml.stream.XMLStreamWriter;
+import java.io.OutputStream;
+
+/**
+ * SOAPEncoder to encode JAXWS runtime objects. Using this caller could optimize
+ * SOAPMessage creation and not use JAXWS default encoding of SOAPMessage
+ */
+public interface InternalSoapEncoder {
+ /**
+ * Writes an object to output stream
+ * @param obj payload to be written
+ * @param messageInfo object containing informations to help JAXWS write the objects.
Get
+ * this object from SOAPMessageContext.getMessageInfo()
+ * @param out stream to write to
+ * @param mtomCallback callback is called if there any attachments while
+ * encoding the object
+ */
+ public void write(Object obj, Object messageInfo, OutputStream out, MtomCallback
mtomCallback);
+
+ /**
+ * Writes an object to output stream
+ * @param obj payload to be written
+ * @param messageInfo object containing informations to help JAXWS write the objects.
Get
+ * this object from SOAPMessageContext.getMessageInfo()
+ * @param out stream writer to write to
+ * @param mtomCallback callback is called if there any attachments while
+ * encoding the object
+ */
+ public void write(Object obj, Object messageInfo, XMLStreamWriter out, MtomCallback
mtomCallback);
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/InternalSoapEncoder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/Invoker.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/Invoker.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/Invoker.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,46 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.spi.runtime;
+
+import java.lang.reflect.Method;
+import javax.xml.namespace.QName;
+
+/**
+ * Complete invocation of webservice can be done using this object. So this
+ * object can be wrapped in other blocks to provide certain context(for e.g.
+ * can be wrapped in doAsPrivileged())
+ *
+ * @author WS Development Team
+ */
+public interface Invoker {
+ /**
+ * Invokes request handler chain, endpoint, response handler chain
+ */
+ public void invoke() throws Exception;
+
+ /**
+ * It gives java methods for a give operation name
+ *
+ * @return corresponding java method for operation name, otherwise null
+ */
+ public Method getMethod(QName name);
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/Invoker.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/MessageContext.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/MessageContext.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/MessageContext.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,64 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.spi.runtime;
+
+import java.lang.reflect.Method;
+
+/**
+ * Enhanced API' MessageContext with some extra properties
+ */
+public interface MessageContext extends javax.xml.ws.handler.MessageContext {
+ /**
+ * Returns binding id defined in API
+ * @return bindingId is one of these values:
+ * javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING,
+ * javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING,
+ * javax.xml.ws.http.HTTPBinding.HTTP_BINDING
+ */
+ public String getBindingId();
+
+ /**
+ * Returns the invocation method.
+ *
+ * @return invocation method, null if the model doesn't know
+ */
+ public Method getMethod();
+
+ /**
+ * Sets cannonicalization algorithm that is used while writing JAXB objects
+ *
+ */
+ public void setCanonicalization(String algorithm);
+
+ /**
+ * Returns the Invoker
+ *
+ * @return Invoker
+ */
+ public Invoker getInvoker();
+
+ /**
+ * Returns if MTOM is anbled
+ * @return true if MTOM is enabled otherwise returns false;
+ */
+ public boolean isMtomEnabled();
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/MessageContext.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/MtomCallback.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/MtomCallback.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/MtomCallback.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,41 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.spi.runtime;
+
+import javax.activation.DataHandler;
+
+/**
+ * MTOM callback class that is passed to InternalSoapEncoder.write() to get notification
when
+ * mtom attachment is added or the message is xopped.
+ */
+public interface MtomCallback {
+ /**
+ * This method provides the content-id that will be set to Content-ID MIME header,
the
+ * element which will be xop encoded by JAXB.
+ *
+ * @param contentId
+ * @param attachment
+ * @param elementTargetNamespace
+ * @param elementLocalName
+ */
+ public void addedMtomAttachment(String contentId, DataHandler attachment, String
elementTargetNamespace, String elementLocalName);
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/MtomCallback.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/RuntimeEndpointInfo.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/RuntimeEndpointInfo.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/RuntimeEndpointInfo.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,128 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.spi.runtime;
+
+import java.net.URL;
+import javax.xml.namespace.QName;
+import org.xml.sax.EntityResolver;
+
+/**
+ * This captures all the required information (e.g: handlers, binding, endpoint
+ * object, proxy for endpoint object etc.) about the endpoint.
+ */
+public interface RuntimeEndpointInfo {
+
+ /**
+ * Returns the name of the endpoint
+ * @return name of the endpoint
+ */
+ public String getName();
+
+ /**
+ * sets the name of the endpoint
+ */
+ public void setName(String name);
+
+ /**
+ * Builds runtime model from implementor object.
+ */
+ public void init();
+
+ /**
+ * Destroys any state in this object
+ */
+ public void destroy();
+
+ /**
+ * This object is used for method invocations. It could be actual
+ * implementor or a proxy object. This must be set before calling deploy().
+ */
+ public void setImplementor(Object implementor);
+
+ /**
+ * implementorClass should have <code>@WebService</code> or
+ * <code>@WebServiceProvider</code> annotation.
+ * Dynamic model is created using this object. If this is not set, implementor's
+ * class is used to create the model.
+ */
+ public void setImplementorClass(Class implementorClass);
+
+ /**
+ * Returns actual Endpoint Object where method invocation is done
+ *
+ * @return Object Gets the endpoint implementation object or a proxy
+ */
+ public Object getImplementor();
+
+ /**
+ * Returns the set implementorClass
+ *
+ * @return implementor's class that has the annotations
+ */
+ public Class getImplementorClass();
+
+ /**
+ * Returns the binding for this endpoint
+ *
+ * @return Binding Returns the binding for this endpoint.
+ */
+ public Binding getBinding();
+
+ /**
+ * sets the binding for this endpoint. If there are handlers, set them on
+ * the binding object.
+ */
+ public void setBinding(Binding binding);
+
+ /**
+ * Returns the WebServiceContext of this endpoint
+ *
+ * @return WebServiceContext Returns the WebServiceContext of this endpoint.
+ */
+ public WebServiceContext getWebServiceContext();
+
+ /**
+ * sets the WebServiceContext for this endpoint.
+ */
+ public void setWebServiceContext(WebServiceContext wsContext);
+
+ /**
+ * set the URL for primary WSDL, and a resolver to resolve entities like
+ * WSDL, imports/references. A resolver for XML catalog can be created using
+ * WSRtObjectFactory.createResolver(URL catalogURL).
+ */
+ public void setWsdlInfo(URL wsdlUrl, EntityResolver resolver);
+
+ /**
+ * Set service name from DD. If it is null, @WebService, @WebServiceProvider
+ * annotations are used to get service name
+ */
+ public void setServiceName(QName name);
+
+ /**
+ * Set port name from DD. If it is null, @WebService, @WebServiceProvider
+ * annotations are used to get port name
+ */
+ public void setPortName(QName name);
+
+}
+
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/RuntimeEndpointInfo.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/SOAPMessageContext.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/SOAPMessageContext.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/SOAPMessageContext.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,63 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.spi.runtime;
+import java.util.List;
+
+/**
+ * This enhances API's SOAPMessageContext and provides internal representation
+ * of SOAPMessage so that it can be encoded optimally
+ */
+public interface SOAPMessageContext
+ extends javax.xml.ws.handler.soap.SOAPMessageContext, MessageContext {
+
+ /**
+ * If there is a SOAPMessage already, use getSOAPMessage(). Ignore all other methods
+ * @return
+ */
+ public boolean isAlreadySoap();
+
+ /**
+ * Returns InternalMessage's BodyBlock value
+ * @return
+ */
+ public Object getBody();
+
+ /**
+ * Returns InternalMessage's HeaderBlock values
+ * @return
+ */
+ public List getHeaders();
+
+ /**
+ * Use this object to pass to InternalSoapEncoder write methods
+ * @return object containg information thats used by InternalEncoderDecoder write
methods.
+ *
+ */
+ public Object getMessageInfo();
+
+ /**
+ * Returns to marshall all JAXWS objects: RpcLitPayload, JAXBBridgeInfo etc
+ * @return
+ */
+ public InternalSoapEncoder getEncoder();
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/SOAPMessageContext.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/StubBase.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/StubBase.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/StubBase.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,31 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.spi.runtime;
+
+
+/**
+ * This class is implemented by
+ * org.jboss.com.sun.xml.ws.client.StubBase
+ */
+public interface StubBase {
+ public void _setTransportFactory(ClientTransportFactory f);
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/StubBase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/SystemHandlerDelegate.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/SystemHandlerDelegate.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/SystemHandlerDelegate.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,111 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.spi.runtime;
+
+
+/**
+ * A SystemHandlerDelegate is used to inject system level functionality into a
+ * message processing runtime. The methods of this interface are invoked by
+ * the client and enpoint message dispatchers of the message processing
+ * runtime.
+ *
+ * @author WS Development Team
+ */
+
+public interface SystemHandlerDelegate {
+
+ /**
+ * Called by both client and endpoint message dispatchers to activate
+ * injected request message processing.
+ * When called by a client side message dispatcher, this method must be
+ * called just before the message (associated with the MessageContext)
+ * is sent. When called by the message dispatcher at an endpoint, this
+ * method must be called before MustUnderstand processing on the
+ * associated message.
+ *
+ * @param messageContext when called by a SOAPBinding the argument
+ * must be an instanceof org.jboss.com.sun.xml.ws.spi.runtime.SOAPMessageContext, and
+ * when called by a SOAPBinding at an endpoint, the argument must
+ * be an instanceof org.jboss.com.sun.xml.ws.spi.runtime.SOAPMessageContext and the
+ * Invoker (on the context) must be available for use on the server by the
+ * delegate. An argument SOAPMessageContext passed to this method by an endpoint
+ * dispatcher, must have values assigned for the following MessageContext
+ * properties.
+ * <ul>
+ * <li>MessageContext.SERVLET_REQUEST
+ * <li>MessageContext.SERVLET_RESPONSE
+ * <li>MessageContext.SERVLET_SESSION
+ * <li>MessageContext.SERVLET_CONTEXT
+ * </ul>
+ * @return true if processing by the delegate was such that the caller
+ * should continue with its normal message processing. Returns false when
+ * the delegate has established, in the MessageContext,
+ * the response message to be sent. When this method returns
+ * false, the calling message dispatcher must return the response message
+ * without performing MustUnderstand processing and without invoking the
+ * endpoint. Only delegates called by endpoint side message dispatchers
+ * may return false
+ *
+ * @throws java.lang.Exception when the processing by the delegate failed
+ * without yielding a response message; in which case, the caller shall
+ * determine how to process the error.
+ *
+ */
+ public boolean processRequest(MessageContext messageContext) throws Exception;
+
+ /**
+ * Called by both client and endpoint message dispatchers to activate
+ * injected response message processing.
+ * When called by the message dispatcher at the client, this method must be
+ * called before MustUnderstand processing on the received message
+ * (associated with the MessageContext). When called by the message
+ * dispatcher at an endpoint, this method must be called after the
+ * endpoint has been invoked, and just before the associated response
+ * message is sent. In the special case where invocation of the endpoint
+ * caused an Exception to be thrown, this method must not be called.
+ *
+ * @param messageContext when called by a SOAPBinding the argument
+ * must be an instanceof org.jboss.com.sun.xml.ws.spi.runtime.SOAPMessageContext.
+ *
+ * @throws java.lang.Exception when the processing by the delegate failed.
+ * In this case, the caller must not send the response message but shall
+ * otherwise determine how to process the error.
+ */
+ public void processResponse(MessageContext messageContext) throws Exception;
+
+ /**
+ * This method must be called by an endpoint message dispatcher after
+ * MustUnderstand processing and before endpoint invocation.
+ *
+ * @param messageContext when called by a SOAPBinding the argument
+ * must be an instanceof org.jboss.com.sun.xml.ws.spi.runtime.SOAPMessageContext, and
+ * must have values assigned for the following MessageContext
+ * properties.
+ * <ul>
+ * <li>MessageContext.SERVLET_REQUEST
+ * <li>MessageContext.SERVLET_RESPONSE
+ * <li>MessageContext.SERVLET_SESSION
+ * <li>MessageContext.SERVLET_CONTEXT
+ * </ul>
+ */
+ public void preInvokeEndpointHook(MessageContext messageContext);
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/SystemHandlerDelegate.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/SystemHandlerDelegateFactory.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/SystemHandlerDelegateFactory.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/SystemHandlerDelegateFactory.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,143 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.spi.runtime;
+
+import javax.xml.ws.WebServiceException;
+import javax.xml.namespace.QName;
+import static java.lang.Class.forName;
+import static java.lang.Thread.currentThread;
+import java.util.HashMap;
+
+public abstract class SystemHandlerDelegateFactory {
+
+ private final static String DEFAULT_FACTORY_NAME =
+ "com.sun.xml.xwss.SystemHandlerDelegateFactory";
+
+ private static String factoryName;
+
+ private static HashMap factoryMap;
+
+ static {
+ init();
+ }
+
+ private static synchronized void init() {
+ factoryName = DEFAULT_FACTORY_NAME;
+ factoryMap = new HashMap();
+ };
+
+ // foctory implementations that maintain a map of serviceName to
+ // would override this method
+ /**
+ * Used by the Appserver on client and server sides
+ * factory implementations that maintain a map of serviceName to
+ * factory
+ * @param serviceName when called by the SOAPBindingImpl to
+ * create the SystemHandlerDelegate. serviceName must be
+ * a QName
+ * @return org.jboss.com.sun.xml.ws.spi.runtime.SystemHandlerDelegate
+ * @throws java.lang.Exception when the create failed.
+ */
+ public SystemHandlerDelegate getDelegate(QName serviceName) {
+ return create();
+ }
+
+ /**
+ * Used by the Appserver and xws-security on client and server sides
+ * factory implementations that maintain a map of serviceName to
+ * factory
+ * @return org.jboss.com.sun.xml.ws.spi.runtime.SystemHandlerDelegate
+ * @throws java.lang.Exception when the create failed.
+ */
+ public abstract SystemHandlerDelegate create();
+
+ //currently not used
+ public abstract boolean isEnabled(MessageContext messageContext);
+
+ // factory name can be set to null, in which case,
+ // the default factory will be disabled.
+ /**
+ * Used by the Appserver on client and server sides
+ * factoryName can be set to null, in which case the defaultFactory will be
+ * disabled
+ * @param name when called by the SOAPBindingImpl to
+ * create the SystemHandlerDelegate. serviceName must be
+ * a String
+ */
+ public static synchronized void setFactoryName(String name) {
+ factoryName = name;
+ }
+
+ /**
+ * Used by the Appserver on client and server sides
+ * factoryName can be set to null, in which case the defaultFactory will be
+ * disabled and will be null on return
+ * @return java.lang.String - name of factory
+ */
+ public static synchronized String getFactoryName() {
+ return factoryName;
+ }
+ /**
+ * Used by the JAX-WS implementation on client and server sides
+ * to load the SystemHandlerDelegateFactory
+ * @return org.jboss.com.sun.xml.ws.spi.runtime.SystemHandlerDelegateFactory
+ * @throws javax.xml.ws.WebServiceException when the load fails.
+ */
+ public static synchronized SystemHandlerDelegateFactory getFactory() {
+
+ SystemHandlerDelegateFactory factory =
+ (SystemHandlerDelegateFactory) factoryMap.get(factoryName);
+
+ if (factory != null || factoryMap.containsKey(factoryName)) {
+ return factory;
+ } else {
+
+ Class clazz = null;
+ try {
+ ClassLoader loader = currentThread().getContextClassLoader();
+
+ if (loader == null) {
+ clazz = forName(factoryName);
+ } else {
+ clazz = loader.loadClass(factoryName);
+ }
+
+ if (clazz != null) {
+ factory = (SystemHandlerDelegateFactory) clazz.newInstance();
+ }
+ } catch (ClassNotFoundException e) {
+ factory = null;
+ // e.printStackTrace(); //todo:need to add log
+ } catch (Exception x) {
+ throw new WebServiceException(x);
+ } finally {
+ // stores null factory values in map to prevent
+ // repeated class loading and instantiation errors.
+ factoryMap.put(factoryName, factory);
+ }
+ }
+ return factory;
+ }
+}
+
+
+
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/SystemHandlerDelegateFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/Tie.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/Tie.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/Tie.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,38 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.spi.runtime;
+
+/**
+ * Entry point to JAXWS server side runtime
+ */
+public interface Tie {
+
+ /**
+ * Reads a Web Service request for RuntimeEndpointInfo from WSConnection
+ * and sends a response. Set <code>WebServiceContext</code> with a
filled-in
+ * </code>MessageContext</code> on
<code>RuntimeEndpointInfo</code> before
+ * calling this.
+ */
+ public void handle(WSConnection con, RuntimeEndpointInfo endpoint)
+ throws Exception;
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/Tie.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/WSConnection.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/WSConnection.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/WSConnection.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,104 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.spi.runtime;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * Captures many transports that are used to talk with WS endpoints.
+ *
+ * For endpoints deployed in light weight http server in J2SE, the implemenation
+ * of this class uses HttpTransaction to read from or write to stream.
+ *
+ * For endpoints deployed in servlet container, the implementation of this
+ * class uses HttpServletRequest to read a request, and uses HttpServletResponse
+ * to write response.
+ *
+ * This also works for local transport, JMS transport.
+ *
+ * Runtime can access to the implementation of this interface using
+ * messageInfo.getConnection()
+ *
+ */
+
+public interface WSConnection {
+
+ public static final int OK=200;
+ public static final int ONEWAY=202;
+ public static final int UNSUPPORTED_MEDIA=415;
+ public static final int MALFORMED_XML=400;
+ public static final int INTERNAL_ERR=500;
+
+ /**
+ * returns transport headers
+ * @return transport headers
+ */
+ public Map<String,List<String>> getHeaders();
+
+ /**
+ * sets transport headers
+ */
+ public void setHeaders(Map<String,List<String>> headers);
+
+ /**
+ * sets the transport status code like <code>OK</code>
+ */
+ public void setStatus(int status);
+
+ /**
+ * @return return the status code
+ */
+ public int getStatus();
+
+ /**
+ * Transport's underlying input stream
+ * @return Transport's underlying input stream
+ */
+ public InputStream getInput();
+
+ /**
+ * Closes transport's input stream
+ */
+ public void closeInput();
+
+ /**
+ * Transport's underlying output stream
+ * @return Transport's underlying output stream
+ */
+ public OutputStream getOutput();
+
+ /**
+ * Closes transport's output stream
+ */
+ public void closeOutput();
+
+ public OutputStream getDebug();
+
+ /**
+ * Closes transport connection
+ */
+ public void close();
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/WSConnection.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/WSRtObjectFactory.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/WSRtObjectFactory.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/WSRtObjectFactory.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,99 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.spi.runtime;
+
+import java.io.OutputStream;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.net.URL;
+import java.util.List;
+import javax.servlet.ServletContext;
+
+import org.jboss.com.sun.xml.ws.util.WSRtObjectFactoryImpl;
+import org.xml.sax.EntityResolver;
+import javax.xml.ws.handler.MessageContext;
+
+/**
+ * Singleton abstract factory used to produce JAX-WS runtime related objects.
+ */
+public abstract class WSRtObjectFactory {
+
+ private static final WSRtObjectFactory factory = new WSRtObjectFactoryImpl();
+
+ /**
+ * Obtain an instance of a factory. Don't worry about synchronization(at
+ * the most, one more factory object is created).
+ *
+ */
+ public static WSRtObjectFactory newInstance() {
+ return factory;
+ }
+
+ /**
+ * Creates SOAPMessageContext
+ */
+ public abstract SOAPMessageContext createSOAPMessageContext();
+
+
+ /**
+ * Creates an object with all endpoint info
+ */
+ public abstract RuntimeEndpointInfo createRuntimeEndpointInfo();
+
+ /**
+ * Creates a connection for servlet transport
+ */
+ public abstract WSConnection createWSConnection(
+ HttpServletRequest req, HttpServletResponse res);
+
+ /**
+ * @return List of endpoints
+ */
+ public abstract List<RuntimeEndpointInfo> getRuntimeEndpointInfos(
+ ServletContext ctxt);
+
+ /**
+ * creates a Tie object, entry point to JAXWS runtime.
+ */
+ public abstract Tie createTie();
+
+ /**
+ * creates a MesageContext object. Create it for each MEP.
+ */
+ public abstract MessageContext createMessageContext();
+
+ /**
+ * creates the Binding object implementation. Set the object on
+ * RuntimeEndpointInfo.
+ * bindingId should be one of these values:
+ * javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING,
+ * javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING,
+ * javax.xml.ws.http.HTTPBinding.HTTP_BINDING
+ */
+ public abstract Binding createBinding(String bindingId);
+
+ /**
+ * creates an EntityResolver for the XML Catalog URL
+ */
+ public abstract EntityResolver createEntityResolver(URL catalogUrl);
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/WSRtObjectFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/WebServiceContext.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/WebServiceContext.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/WebServiceContext.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,36 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.spi.runtime;
+
+import javax.xml.ws.handler.MessageContext;
+
+/**
+ * Enhanced API WebServiceContext that contains a method to set MessageContext
+ */
+public interface WebServiceContext extends javax.xml.ws.WebServiceContext {
+
+ /**
+ * Sets SPI's MessageContext
+ */
+ public void setMessageContext(MessageContext ctxt);
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/WebServiceContext.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/package-info.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/package-info.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/package-info.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,30 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+/**
+ *
+ * <P>This document describes the SPI for the JAX-WS 2.0 runtime.
+ * Applications can use this SPI to interact with the runtime at
+ * various points to get access to information and to perform
+ * various operations such as security etc.
+*/
+package org.jboss.com.sun.xml.ws.spi.runtime;
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/spi/runtime/package-info.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/Attributes.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/Attributes.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/Attributes.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,128 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.streaming;
+
+import javax.xml.namespace.QName;
+
+/**
+ * <p> The Attributes interface is essentially a version of the
+ * org.xml.sax.Attributes interface modified to use the JAX-WS QName class.</p>
+ *
+ * <p> Although namespace declarations can appear in the attribute list, the
+ * actual values of the local name and URI properties are
+ * implementation-specific. </p>
+ *
+ * <p> Applications that need to iterate through all the attributes can use the
+ * {@link #isNamespaceDeclaration} method to identify namespace declarations
+ * and skip them. </p>
+ *
+ * <p> Also, the URI property of an attribute will never be null. The value
+ * "" (empty string) is used for the URI of non-qualified attributes.
</p>
+ *
+ * @author WS Development Team
+ */
+public interface Attributes {
+
+ /**
+ * Return the number of attributes in the list.
+ *
+ */
+ public int getLength();
+
+ /**
+ * Return true if the attribute at the given index is a namespace
+ * declaration.
+ *
+ * <p> Implementations are encouraged to optimize this method by taking into
+ * account their internal representations of attributes. </p>
+ *
+ */
+ public boolean isNamespaceDeclaration(int index);
+
+ /**
+ * Look up an attribute's QName by index.
+ *
+ */
+ public QName getName(int index);
+
+ /**
+ * Look up an attribute's URI by index.
+ *
+ */
+ public String getURI(int index);
+
+ /**
+ * Look up an attribute's local name by index.
+ * If attribute is a namespace declaration, result
+ * is expected including "xmlns:".
+ */
+ public String getLocalName(int index);
+
+ /**
+ * Look up an attribute's prefix by index.
+ *
+ */
+ public String getPrefix(int index);
+
+ /**
+ * Look up an attribute's value by index.
+ *
+ */
+ public String getValue(int index);
+
+ /**
+ * Look up the index of an attribute by QName.
+ *
+ */
+ public int getIndex(QName name);
+
+ /**
+ * Look up the index of an attribute by URI and local name.
+ *
+ */
+ public int getIndex(String uri, String localName);
+
+ /**
+ * Look up the index of an attribute by local name.
+ *
+ */
+ public int getIndex(String localName);
+
+ /**
+ * Look up the value of an attribute by QName.
+ *
+ */
+ public String getValue(QName name);
+
+ /**
+ * Look up the value of an attribute by URI and local name.
+ *
+ */
+ public String getValue(String uri, String localName);
+
+ /**
+ * Look up the value of an attribute by local name.
+ *
+ */
+ public String getValue(String localName);
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/Attributes.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/DOMStreamReader.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/DOMStreamReader.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/DOMStreamReader.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,723 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.streaming;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Collections;
+
+import org.w3c.dom.*;
+import static org.w3c.dom.Node.*;
+import javax.xml.namespace.QName;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.stream.Location;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamException;
+
+/**
+ *
+ * Create an XMLStreamReader on top of a DOM level 2 tree. It a DOM level
+ * 1 tree is passed, each method will attempt to return the correct value
+ * by using <code>getNodeName()</code>.
+ *
+ * @author Santiago.PericasGeertsen(a)sun.com
+ */
+public class DOMStreamReader implements XMLStreamReader, NamespaceContext {
+
+ /**
+ * Current DOM node being traversed.
+ */
+ Node _current;
+
+ /**
+ * Starting node of the subtree being traversed.
+ */
+ Node _start;
+
+ /**
+ * Named mapping for attributes and NS decls for the current node.
+ */
+ NamedNodeMap _namedNodeMap;
+
+ /**
+ * List of attributes extracted from <code>_namedNodeMap</code>.
+ */
+ List<Attr> _currentAttributes = new ArrayList<Attr>();
+
+ /**
+ * List of namespace declarations extracted from
<code>_namedNodeMap</code>
+ */
+ List<Attr> _currentNamespaces = new ArrayList<Attr>();
+
+ /**
+ * Flag indicating if <code>_namedNodeMap</code> is already split into
+ * <code>_currentAttributes</code> and
<code>_currentNamespaces</code>
+ */
+ boolean _needAttributesSplit;
+
+ /**
+ * State of this reader. Any of the valid states defined in StAX'
+ * XMLStreamConstants class.
+ */
+ int _state;
+
+ /**
+ * Dummy Location instance returned in <code>getLocation</code>.
+ */
+ private static Location dummyLocation = new Location() {
+ public int getCharacterOffset() {
+ return -1;
+ }
+ public int getColumnNumber() {
+ return -1;
+ }
+ public int getLineNumber() {
+ return -1;
+ }
+ public String getPublicId() {
+ return null;
+ }
+ public String getSystemId() {
+ return null;
+ }
+ };
+
+ public DOMStreamReader() {
+ }
+
+ public DOMStreamReader(Node node) {
+ setCurrentNode(node);
+ }
+
+ public void setCurrentNode(Node node) {
+ _start = _current = node;
+ _state = START_DOCUMENT;
+ // verifyDOMIntegrity(node);
+ // displayDOM(node, System.out);
+ }
+
+ public void close() throws javax.xml.stream.XMLStreamException {
+ }
+
+
+ private void splitAttributes() {
+ if (!_needAttributesSplit) return;
+
+ // Clear attribute and namespace lists
+ _currentAttributes.clear();
+ _currentNamespaces.clear();
+
+ _namedNodeMap = _current.getAttributes();
+ if (_namedNodeMap != null) {
+ final int n = _namedNodeMap.getLength();
+ for (int i = 0; i < n; i++) {
+ final Attr attr = (Attr) _namedNodeMap.item(i);
+ final String attrName = attr.getNodeName();
+ if (attrName.startsWith("xmlns:") ||
attrName.equals("xmlns")) { // NS decl?
+ _currentNamespaces.add(attr);
+ }
+ else {
+ _currentAttributes.add(attr);
+ }
+ }
+ }
+ _needAttributesSplit = false;
+ }
+
+ public int getAttributeCount() {
+ if (_state == START_ELEMENT) {
+ splitAttributes();
+ return _currentAttributes.size();
+ }
+ throw new IllegalStateException("DOMStreamReader: getAttributeCount() called
in illegal state");
+ }
+
+ /**
+ * Return an attribute's local name. Handle the case of DOM level 1 nodes.
+ */
+ public String getAttributeLocalName(int index) {
+ if (_state == START_ELEMENT) {
+ splitAttributes();
+
+ String localName = _currentAttributes.get(index).getLocalName();
+ return (localName != null) ? localName :
+
QName.valueOf(_currentAttributes.get(index).getNodeName()).getLocalPart();
+ }
+ throw new IllegalStateException("DOMStreamReader: getAttributeLocalName()
called in illegal state");
+ }
+
+ /**
+ * Return an attribute's qname. Handle the case of DOM level 1 nodes.
+ */
+ public QName getAttributeName(int index) {
+ if (_state == START_ELEMENT) {
+ splitAttributes();
+
+ Node attr = _currentAttributes.get(index);
+ String localName = attr.getLocalName();
+ if (localName != null) {
+ String prefix = attr.getPrefix();
+ String uri = attr.getNamespaceURI();
+ return new QName(uri != null ? uri : "", localName,
+ prefix != null ? prefix : "");
+ }
+ else {
+ return QName.valueOf(attr.getNodeName());
+ }
+ }
+ throw new IllegalStateException("DOMStreamReader: getAttributeName() called
in illegal state");
+ }
+
+ public String getAttributeNamespace(int index) {
+ if (_state == START_ELEMENT) {
+ splitAttributes();
+ String uri = _currentAttributes.get(index).getNamespaceURI();
+ return uri != null ? uri : "";
+ }
+ throw new IllegalStateException("DOMStreamReader: getAttributeNamespace()
called in illegal state");
+ }
+
+ public String getAttributePrefix(int index) {
+ if (_state == START_ELEMENT) {
+ splitAttributes();
+ String prefix = _currentAttributes.get(index).getPrefix();
+ return prefix != null ? prefix : "";
+ }
+ throw new IllegalStateException("DOMStreamReader: getAttributePrefix()
called in illegal state");
+ }
+
+ public String getAttributeType(int index) {
+ if (_state == START_ELEMENT) {
+ return "CDATA";
+ }
+ throw new IllegalStateException("DOMStreamReader: getAttributeType() called
in illegal state");
+ }
+
+ public String getAttributeValue(int index) {
+ if (_state == START_ELEMENT) {
+ splitAttributes();
+ return _currentAttributes.get(index).getNodeValue();
+ }
+ throw new IllegalStateException("DOMStreamReader: getAttributeValue() called
in illegal state");
+ }
+
+ public String getAttributeValue(String namespaceURI, String localName) {
+ if (_state == START_ELEMENT) {
+ splitAttributes();
+ if (_namedNodeMap != null) {
+ Node attr = _namedNodeMap.getNamedItemNS(namespaceURI, localName);
+ return attr != null ? attr.getNodeValue() : null;
+ }
+ return null;
+ }
+ throw new IllegalStateException("DOMStreamReader: getAttributeValue() called
in illegal state");
+ }
+
+ public String getCharacterEncodingScheme() {
+ return null;
+ }
+
+ public String getElementText() throws javax.xml.stream.XMLStreamException {
+ throw new RuntimeException("DOMStreamReader: getElementText() not
implemented");
+ }
+
+ public String getEncoding() {
+ return null;
+ }
+
+ public int getEventType() {
+ return _state;
+ }
+
+ /**
+ * Return an element's local name. Handle the case of DOM level 1 nodes.
+ */
+ public String getLocalName() {
+ if (_state == START_ELEMENT || _state == END_ELEMENT) {
+ String localName = _current.getLocalName();
+ return localName != null ? localName :
+ QName.valueOf(_current.getNodeName()).getLocalPart();
+ }
+ else if (_state == ENTITY_REFERENCE) {
+ return _current.getNodeName();
+ }
+ throw new IllegalStateException("DOMStreamReader: getAttributeValue() called
in illegal state");
+ }
+
+ public javax.xml.stream.Location getLocation() {
+ return dummyLocation;
+ }
+
+ /**
+ * Return an element's qname. Handle the case of DOM level 1 nodes.
+ */
+ public javax.xml.namespace.QName getName() {
+ if (_state == START_ELEMENT || _state == END_ELEMENT) {
+ String localName = _current.getLocalName();
+ if (localName != null) {
+ String prefix = _current.getPrefix();
+ String uri = _current.getNamespaceURI();
+ return new QName(uri != null ? uri : "", localName,
+ prefix != null ? prefix : "");
+ }
+ else {
+ return QName.valueOf(_current.getNodeName());
+ }
+ }
+ throw new IllegalStateException("DOMStreamReader: getName() called in
illegal state");
+ }
+
+ public NamespaceContext getNamespaceContext() {
+ return this;
+ }
+
+ public int getNamespaceCount() {
+ if (_state == START_ELEMENT || _state == END_ELEMENT) {
+ splitAttributes();
+ return _currentNamespaces.size();
+ }
+ throw new IllegalStateException("DOMStreamReader: getNamespaceCount() called
in illegal state");
+ }
+
+ public String getNamespacePrefix(int index) {
+ if (_state == START_ELEMENT || _state == END_ELEMENT) {
+ splitAttributes();
+
+ Attr attr = _currentNamespaces.get(index);
+ String result = attr.getLocalName();
+ if (result == null) {
+ result = QName.valueOf(attr.getNodeName()).getLocalPart();
+ }
+ return result.equals("xmlns") ? null : result;
+ }
+ throw new IllegalStateException("DOMStreamReader: getNamespacePrefix()
called in illegal state");
+ }
+
+ public String getNamespaceURI() {
+ if (_state == START_ELEMENT || _state == END_ELEMENT) {
+ String uri = _current.getNamespaceURI();
+ return uri != null ? uri : "";
+ }
+ return null;
+ }
+
+ public String getNamespaceURI(int index) {
+ if (_state == START_ELEMENT || _state == END_ELEMENT) {
+ splitAttributes();
+ return _currentNamespaces.get(index).getValue();
+ }
+ throw new IllegalStateException("DOMStreamReader: getNamespaceURI(int)
called in illegal state");
+ }
+
+ /**
+ * This method is not particularly fast, but shouldn't be called very
+ * often. If we start to use it more, we should keep track of the
+ * NS declarations using a NamespaceContext implementation instead.
+ */
+ public String getNamespaceURI(String prefix) {
+ if (prefix == null) {
+ throw new IllegalArgumentException("DOMStreamReader:
getNamespaceURI(String) call with a null prefix");
+ }
+ else if (prefix.equals("xml")) {
+ return "http://www.w3.org/XML/1998/namespace";
+ }
+ else if (prefix.equals("xmlns")) {
+ return "http://www.w3.org/2000/xmlns/";
+ }
+ else {
+ int type;
+
+ // Find nearest element node
+ Node node = _current;
+ while ((type = node.getNodeType()) != DOCUMENT_NODE
+ && type != ELEMENT_NODE) {
+ node = node.getParentNode();
+ }
+
+ boolean isDefault = (prefix.length() == 0);
+
+ while (node.getNodeType() != DOCUMENT_NODE) {
+ // Is ns declaration on this element?
+ NamedNodeMap namedNodeMap = node.getAttributes();
+ Attr attr = isDefault ? (Attr)
namedNodeMap.getNamedItem("xmlns") :
+ (Attr)
namedNodeMap.getNamedItem("xmlns:" + prefix);
+ if (attr != null) {
+ return attr.getValue();
+ }
+ node = node.getParentNode();
+ }
+ return null;
+ }
+ }
+
+ public String getPrefix(String nsUri) {
+ if (nsUri == null) {
+ throw new IllegalArgumentException("DOMStreamReader: getPrefix(String)
call with a null namespace URI");
+ }
+ else if (
nsUri.equals("http://www.w3.org/XML/1998/namespace")) {
+ return "xml";
+ }
+ else if (
nsUri.equals("http://www.w3.org/2000/xmlns/")) {
+ return "xmlns";
+ }
+ else {
+ int type;
+
+ // Find nearest element node
+ Node node = _current;
+ while ((type = node.getNodeType()) != DOCUMENT_NODE
+ && type != ELEMENT_NODE) {
+ node = node.getParentNode();
+ }
+
+ while (node.getNodeType() != DOCUMENT_NODE) {
+ // Is ns declaration on this element?
+ NamedNodeMap namedNodeMap = node.getAttributes();
+ for( int i=namedNodeMap.getLength()-1; i>=0; i-- ) {
+ Attr attr = (Attr)namedNodeMap.item(i);
+
+ String attrName = attr.getNodeName();
+ if (attrName.startsWith("xmlns:") ||
attrName.equals("xmlns")) { // NS decl?
+ if(attr.getValue().equals(nsUri)) {
+ if(attrName.equals("xmlns"))
+ return "";
+ String localName = attr.getLocalName();
+ return (localName != null) ? localName :
+ QName.valueOf(attrName).getLocalPart();
+ }
+ }
+ }
+ node = node.getParentNode();
+ }
+ return null;
+ }
+ }
+
+ public Iterator getPrefixes(String nsUri) {
+ // This is an incorrect implementation,
+ // but AFAIK it's not used in the JAX-WS runtime
+ String prefix = getPrefix(nsUri);
+ if(prefix==null) return Collections.emptyList().iterator();
+ else return Collections.singletonList(prefix).iterator();
+ }
+
+ public String getPIData() {
+ if (_state == PROCESSING_INSTRUCTION) {
+ return ((ProcessingInstruction) _current).getData();
+ }
+ return null;
+ }
+
+ public String getPITarget() {
+ if (_state == PROCESSING_INSTRUCTION) {
+ return ((ProcessingInstruction) _current).getTarget();
+ }
+ return null;
+ }
+
+ public String getPrefix() {
+ if (_state == START_ELEMENT || _state == END_ELEMENT) {
+ String prefix = _current.getPrefix();
+ return prefix != null ? prefix : "";
+ }
+ return null;
+ }
+
+ public Object getProperty(String str) throws IllegalArgumentException {
+ return null;
+ }
+
+ public String getText() {
+ if (_state == CHARACTERS || _state == CDATA || _state == COMMENT ||
+ _state == ENTITY_REFERENCE) {
+ return _current.getNodeValue();
+ }
+ throw new IllegalStateException("DOMStreamReader: getTextLength() called in
illegal state");
+ }
+
+ public char[] getTextCharacters() {
+ return getText().toCharArray();
+ }
+
+ public int getTextCharacters(int sourceStart, char[] target, int targetStart,
+ int targetLength) throws
javax.xml.stream.XMLStreamException
+ {
+ char[] text = getTextCharacters();
+ System.arraycopy(text, sourceStart, target, targetStart, targetLength);
+ return Math.min(targetLength, text.length - sourceStart);
+ }
+
+ public int getTextLength() {
+ if (_state == CHARACTERS || _state == CDATA || _state == COMMENT ||
+ _state == ENTITY_REFERENCE) {
+ return _current.getNodeValue().length();
+ }
+ throw new IllegalStateException("DOMStreamReader: getTextLength() called in
illegal state");
+ }
+
+ public int getTextStart() {
+ if (_state == CHARACTERS || _state == CDATA || _state == COMMENT ||
+ _state == ENTITY_REFERENCE) {
+ return 0;
+ }
+ throw new IllegalStateException("DOMStreamReader: getTextStart() called in
illegal state");
+ }
+
+ public String getVersion() {
+ return null;
+ }
+
+ public boolean hasName() {
+ return (_state == START_ELEMENT || _state == END_ELEMENT);
+ }
+
+ public boolean hasNext() throws javax.xml.stream.XMLStreamException {
+ return (_state != END_DOCUMENT);
+ }
+
+ public boolean hasText() {
+ if (_state == CHARACTERS || _state == CDATA || _state == COMMENT ||
+ _state == ENTITY_REFERENCE) {
+ return (_current.getNodeValue().trim().length() > 0);
+ }
+ return false;
+ }
+
+ public boolean isAttributeSpecified(int param) {
+ return false;
+ }
+
+ public boolean isCharacters() {
+ return (_state == CHARACTERS);
+ }
+
+ public boolean isEndElement() {
+ return (_state == END_ELEMENT);
+ }
+
+ public boolean isStandalone() {
+ return true;
+ }
+
+ public boolean isStartElement() {
+ return (_state == START_ELEMENT);
+ }
+
+ public boolean isWhiteSpace() {
+ final int nodeType = _current.getNodeType();
+ if (nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE) {
+ return (_current.getNodeValue().trim().length() == 0);
+ }
+ return false;
+ }
+
+ private static int mapNodeTypeToState(int nodetype) {
+ switch (nodetype) {
+ case CDATA_SECTION_NODE:
+ return CDATA;
+ case COMMENT_NODE:
+ return COMMENT;
+ case ELEMENT_NODE:
+ return START_ELEMENT;
+ case ENTITY_NODE:
+ return ENTITY_DECLARATION;
+ case ENTITY_REFERENCE_NODE:
+ return ENTITY_REFERENCE;
+ case NOTATION_NODE:
+ return NOTATION_DECLARATION;
+ case PROCESSING_INSTRUCTION_NODE:
+ return PROCESSING_INSTRUCTION;
+ case TEXT_NODE:
+ return CHARACTERS;
+ default:
+ throw new RuntimeException("DOMStreamReader: Unexpected node
type");
+ }
+ }
+
+ public int next() throws javax.xml.stream.XMLStreamException {
+ Node child;
+
+ // Indicate that attributes still need processing
+ _needAttributesSplit = true;
+
+ switch (_state) {
+ case END_DOCUMENT:
+ throw new IllegalStateException("DOMStreamReader: Calling next() at
END_DOCUMENT");
+ case START_DOCUMENT:
+ // Don't skip document element if this is a fragment
+ if (_current.getNodeType() == ELEMENT_NODE) {
+ return (_state = START_ELEMENT);
+ }
+
+ child = _current.getFirstChild();
+ if (child == null) {
+ return (_state = END_DOCUMENT);
+ }
+ else {
+ _current = child;
+ return (_state = mapNodeTypeToState(_current.getNodeType()));
+ }
+ case START_ELEMENT:
+ /*
+ * SAAJ tree may contain multiple adjacent text nodes. Normalization
+ * is very expensive, so we should think about changing SAAJ instead!
+ */
+ _current.normalize();
+
+ child = _current.getFirstChild();
+ if (child == null) {
+ return (_state = END_ELEMENT);
+ }
+ else {
+ _current = child;
+ return (_state = mapNodeTypeToState(_current.getNodeType()));
+ }
+ case CHARACTERS:
+ case COMMENT:
+ case CDATA:
+ case ENTITY_REFERENCE:
+ case PROCESSING_INSTRUCTION:
+ case END_ELEMENT:
+ // If at the end of this fragment, then terminate traversal
+ if (_current == _start) {
+ return (_state = END_DOCUMENT);
+ }
+
+ Node sibling = _current.getNextSibling();
+ if (sibling == null) {
+ _current = _current.getParentNode();
+ // getParentNode() returns null for fragments
+ _state = (_current == null || _current.getNodeType() ==
DOCUMENT_NODE) ?
+ END_DOCUMENT : END_ELEMENT;
+ return _state;
+ }
+ else {
+ _current = sibling;
+ return (_state = mapNodeTypeToState(_current.getNodeType()));
+ }
+ case DTD:
+ case ATTRIBUTE:
+ case NAMESPACE:
+ default:
+ throw new RuntimeException("DOMStreamReader: Unexpected internal
state");
+ }
+ }
+
+ public int nextTag() throws javax.xml.stream.XMLStreamException {
+ int eventType = next();
+ while (eventType == CHARACTERS && isWhiteSpace()
+ || eventType == CDATA && isWhiteSpace()
+ || eventType == SPACE
+ || eventType == PROCESSING_INSTRUCTION
+ || eventType == COMMENT)
+ {
+ eventType = next();
+ }
+ if (eventType != START_ELEMENT && eventType != END_ELEMENT) {
+ throw new XMLStreamException("DOMStreamReader: Expected start or end
tag");
+ }
+ return eventType;
+ }
+
+ public void require(int type, String namespaceURI, String localName)
+ throws javax.xml.stream.XMLStreamException
+ {
+ if (type != _state) {
+ throw new XMLStreamException("DOMStreamReader: Required event type not
found");
+ }
+ if (namespaceURI != null && !namespaceURI.equals(getNamespaceURI())) {
+ throw new XMLStreamException("DOMStreamReader: Required namespaceURI not
found");
+ }
+ if (localName != null && !localName.equals(getLocalName())) {
+ throw new XMLStreamException("DOMStreamReader: Required localName not
found");
+ }
+ }
+
+ public boolean standaloneSet() {
+ return true;
+ }
+
+
+
+ // -- Debugging ------------------------------------------------------
+
+ private static void displayDOM(Node node, java.io.OutputStream ostream) {
+ try {
+ System.out.println("\n====\n");
+
javax.xml.transform.TransformerFactory.newInstance().newTransformer().transform(
+ new javax.xml.transform.dom.DOMSource(node),
+ new javax.xml.transform.stream.StreamResult(ostream));
+ System.out.println("\n====\n");
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ private static void verifyDOMIntegrity(Node node) {
+ switch (node.getNodeType()) {
+ case ELEMENT_NODE:
+ case ATTRIBUTE_NODE:
+
+ // DOM level 1?
+ if (node.getLocalName() == null) {
+ System.out.println("WARNING: DOM level 1 node found");
+ System.out.println(" -> node.getNodeName() = " +
node.getNodeName());
+ System.out.println(" -> node.getNamespaceURI() = " +
node.getNamespaceURI());
+ System.out.println(" -> node.getLocalName() = " +
node.getLocalName());
+ System.out.println(" -> node.getPrefix() = " +
node.getPrefix());
+ }
+
+ if (node.getNodeType() == ATTRIBUTE_NODE) return;
+
+ NamedNodeMap attrs = ((Element) node).getAttributes();
+ for (int i = 0; i < attrs.getLength(); i++) {
+ verifyDOMIntegrity(attrs.item(i));
+ }
+ case DOCUMENT_NODE:
+ NodeList children = node.getChildNodes();
+ for (int i = 0; i < children.getLength(); i++) {
+ verifyDOMIntegrity(children.item(i));
+ }
+ }
+ }
+
+ static public void main(String[] args) throws Exception {
+ String sample = "<?xml version='1.0'
encoding='UTF-8'?><env:Envelope
xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'><env:...
server
error</faultstring></env:Fault></env:Body></env:Envelope>";
+ javax.xml.parsers.DocumentBuilderFactory dbf =
javax.xml.parsers.DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ javax.xml.parsers.DocumentBuilder db = dbf.newDocumentBuilder();
+ Document dd = db.parse(new
java.io.ByteArrayInputStream(sample.getBytes("UTF-8")));
+
+ DOMStreamReader dsr = new DOMStreamReader(dd);
+ while (dsr.hasNext()) {
+ System.out.println("dsr.next() = " + dsr.next());
+ if (dsr.getEventType() == START_ELEMENT || dsr.getEventType() == END_ELEMENT)
{
+ System.out.println("dsr.getName = " + dsr.getName());
+ if (dsr.getEventType() == START_ELEMENT)
+ System.out.println("dsr.getAttributeCount() = " +
dsr.getAttributeCount());
+ }
+ }
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/DOMStreamReader.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/PrefixFactory.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/PrefixFactory.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/PrefixFactory.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,39 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.streaming;
+
+/**
+ * <p> Interface for prefix factories. </p>
+ *
+ * <p> A prefix factory is able to create a new prefix for a URI that
+ * was encountered for the first time when writing a document
+ * using an XMLWriter. </p>
+ *
+ * @author WS Development Team
+ */
+public interface PrefixFactory {
+ /**
+ * Return a brand new prefix for the given URI.
+ */
+ public String getPrefix(String uri);
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/PrefixFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/PrefixFactoryImpl.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/PrefixFactoryImpl.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/PrefixFactoryImpl.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,60 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.streaming;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * <p> A prefix factory that caches the prefixes it creates. </p>
+ *
+ * @author WS Development Team
+ */
+public class PrefixFactoryImpl implements PrefixFactory {
+
+ public PrefixFactoryImpl(String base) {
+ _base = base;
+ _next = 1;
+ }
+
+ public String getPrefix(String uri) {
+ String prefix = null;
+
+ if (_cachedUriToPrefixMap == null) {
+ _cachedUriToPrefixMap = new HashMap();
+ } else {
+ prefix = (String) _cachedUriToPrefixMap.get(uri);
+ }
+
+ if (prefix == null) {
+ prefix = _base + Integer.toString(_next++);
+ _cachedUriToPrefixMap.put(uri, prefix);
+ }
+
+ return prefix;
+ }
+
+ private String _base;
+ private int _next;
+ private Map _cachedUriToPrefixMap;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/PrefixFactoryImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/SourceReaderFactory.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/SourceReaderFactory.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/SourceReaderFactory.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,120 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.streaming;
+
+
+import java.io.Reader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.stream.XMLStreamReader;
+
+import org.jboss.com.sun.xml.ws.util.FastInfosetReflection;
+import org.jboss.com.sun.xml.ws.util.xml.XmlUtil;
+
+/**
+ * @author Santiago.PericasGeertsen(a)sun.com
+ */
+public class SourceReaderFactory {
+
+ /**
+ * Thread variable used to store DOMStreamReader for current thread.
+ */
+ static ThreadLocal<DOMStreamReader> domStreamReader =
+ new ThreadLocal<DOMStreamReader>();
+
+ public static XMLStreamReader createSourceReader(Source source,
+ boolean rejectDTDs)
+ {
+ return createSourceReader(source, rejectDTDs, null);
+ }
+
+ public static XMLStreamReader createSourceReader(Source source,
+ boolean rejectDTDs, String charsetName)
+ {
+ try {
+ if (source instanceof StreamSource) {
+ StreamSource streamSource = (StreamSource) source;
+ InputStream is = streamSource.getInputStream();
+
+ if (is != null) {
+ // Wrap input stream in Reader if charset is specified
+ if (charsetName != null) {
+ return XMLStreamReaderFactory.createXMLStreamReader(
+ new InputStreamReader(is, charsetName), rejectDTDs);
+ }
+ else {
+ return XMLStreamReaderFactory.createXMLStreamReader(is,
+ rejectDTDs);
+ }
+ }
+ else {
+ Reader reader = streamSource.getReader();
+ if (reader != null) {
+ return XMLStreamReaderFactory.createXMLStreamReader(reader,
+ rejectDTDs);
+ }
+ else {
+ throw new
XMLReaderException("sourceReader.invalidSource",
+ new Object[] { source.getClass().getName() });
+ }
+ }
+ }
+ else if (FastInfosetReflection.isFastInfosetSource(source)) {
+ return XMLStreamReaderFactory.createFIStreamReader((InputStream)
+ FastInfosetReflection.FastInfosetSource_getInputStream(source));
+ }
+ else if (source instanceof DOMSource) {
+ DOMStreamReader dsr = domStreamReader.get();
+ if (dsr == null) {
+ domStreamReader.set(dsr = new DOMStreamReader());
+ }
+ dsr.setCurrentNode(((DOMSource) source).getNode());
+ return dsr;
+ }
+ else if (source instanceof SAXSource) {
+ // TODO: need SAX to StAX adapter here -- Use transformer for now
+ Transformer tx = XmlUtil.newTransformer();
+ DOMResult domResult = new DOMResult();
+ tx.transform(source, domResult);
+ return createSourceReader(
+ new DOMSource(domResult.getNode()),
+ rejectDTDs);
+ }
+ else {
+ throw new XMLReaderException("sourceReader.invalidSource",
+ new Object[] { source.getClass().getName() });
+ }
+ }
+ catch (Exception e) {
+ throw new XMLReaderException(e);
+ }
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/SourceReaderFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/TidyXMLStreamReader.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/TidyXMLStreamReader.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/TidyXMLStreamReader.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,234 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.streaming;
+
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.Location;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.ws.WebServiceException;
+import java.io.Closeable;
+import java.io.IOException;
+
+/**
+ * Wrapper over XMLStreamReader. It will be used primarily to cleaup the resources such
as closure on InputStream/Reader.
+ *
+ * @author Vivek Pandey
+ */
+public class TidyXMLStreamReader implements XMLStreamReader{
+ private final XMLStreamReader reader;
+ private final Closeable closeableSource;
+
+ public TidyXMLStreamReader(XMLStreamReader reader, Closeable closeableSource) {
+ this.reader = reader;
+ this.closeableSource = closeableSource;
+ }
+
+ public int getAttributeCount() {
+ return reader.getAttributeCount();
+ }
+
+ public int getEventType() {
+ return reader.getEventType();
+ }
+
+ public int getNamespaceCount() {
+ return reader.getNamespaceCount();
+ }
+
+ public int getTextLength() {
+ return reader.getTextLength();
+ }
+
+ public int getTextStart() {
+ return reader.getTextStart();
+ }
+
+ public int next() throws XMLStreamException {
+ return reader.next();
+ }
+
+ public int nextTag() throws XMLStreamException {
+ return reader.nextTag();
+ }
+
+ public void close() throws XMLStreamException {
+ reader.close();
+ try {
+ closeableSource.close();
+ } catch (IOException e) {
+ throw new WebServiceException(e);
+ }
+ }
+
+ public boolean hasName() {
+ return reader.hasName();
+ }
+
+ public boolean hasNext() throws XMLStreamException {
+ return reader.hasNext();
+ }
+
+ public boolean hasText() {
+ return reader.hasText();
+ }
+
+ public boolean isCharacters() {
+ return reader.isCharacters();
+ }
+
+ public boolean isEndElement() {
+ return reader.isEndElement();
+ }
+
+ public boolean isStandalone() {
+ return reader.isStandalone();
+ }
+
+ public boolean isStartElement() {
+ return reader.isStartElement();
+ }
+
+ public boolean isWhiteSpace() {
+ return reader.isWhiteSpace();
+ }
+
+ public boolean standaloneSet() {
+ return reader.standaloneSet();
+ }
+
+ public char[] getTextCharacters() {
+ return reader.getTextCharacters();
+ }
+
+ public boolean isAttributeSpecified(int i) {
+ return reader.isAttributeSpecified(i);
+ }
+
+ public int getTextCharacters(int i, char[] chars, int i1, int i2) throws
XMLStreamException {
+ return reader.getTextCharacters(i, chars, i1, i2);
+ }
+
+ public String getCharacterEncodingScheme() {
+ return reader.getCharacterEncodingScheme();
+ }
+
+ public String getElementText() throws XMLStreamException {
+ return reader.getElementText();
+ }
+
+ public String getEncoding() {
+ return reader.getEncoding();
+ }
+
+ public String getLocalName() {
+ return reader.getLocalName();
+ }
+
+ public String getNamespaceURI() {
+ return reader.getNamespaceURI();
+ }
+
+ public String getPIData() {
+ return reader.getPIData();
+ }
+
+ public String getPITarget() {
+ return reader.getPITarget();
+ }
+
+ public String getPrefix() {
+ return reader.getPrefix();
+ }
+
+ public String getText() {
+ return reader.getText();
+ }
+
+ public String getVersion() {
+ return reader.getVersion();
+ }
+
+ public String getAttributeLocalName(int i) {
+ return reader.getAttributeLocalName(i);
+ }
+
+ public String getAttributeNamespace(int i) {
+ return reader.getAttributeNamespace(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 String getNamespacePrefix(int i) {
+ return reader.getNamespacePrefix(i);
+ }
+
+ public String getNamespaceURI(int i) {
+ return reader.getNamespaceURI(i);
+ }
+
+ public NamespaceContext getNamespaceContext() {
+ return reader.getNamespaceContext();
+ }
+
+ public QName getName() {
+ return reader.getName();
+ }
+
+ public QName getAttributeName(int i) {
+ return reader.getAttributeName(i);
+ }
+
+ public Location getLocation() {
+ return reader.getLocation();
+ }
+
+ public Object getProperty(String s) throws IllegalArgumentException {
+ return reader.getProperty(s);
+ }
+
+ public void require(int i, String s, String s1) throws XMLStreamException {
+ reader.require(i, s, s1);
+ }
+
+ public String getNamespaceURI(String s) {
+ return reader.getNamespaceURI(s);
+ }
+
+ public String getAttributeValue(String s, String s1) {
+ return reader.getAttributeValue(s, s1);
+ }
+
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/TidyXMLStreamReader.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/XMLReader.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/XMLReader.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/XMLReader.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,225 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.streaming;
+
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+/**
+ * <p> XMLReader provides a high-level streaming parser interface
+ * for reading XML documents. </p>
+ *
+ * <p> The {@link #next} method is used to read events from the XML document.
</p>
+ *
+ * <p> Each time it is called, {@link #next} returns the new state of the reader.
</p>
+ *
+ * <p> Possible states are: BOF, the initial state, START, denoting the start
+ * tag of an element, END, denoting the end tag of an element, CHARS, denoting
+ * the character content of an element, PI, denoting a processing instruction,
+ * EOF, denoting the end of the document. </p>
+ *
+ * <p> Depending on the state the reader is in, one or more of the following
+ * query methods will be meaningful: {@link #getName}, {@link #getURI},
+ * {@link #getLocalName}, {@link #getAttributes}, {@link #getValue}. </p>
+ *
+ * <p> Elements visited by a XMLReader are tagged with unique IDs. The ID of the
+ * current element can be found by calling {@link #getElementId}. </p>
+ *
+ * <p> A XMLReader is always namespace-aware, and keeps track of the namespace
+ * declarations which are in scope at any time during streaming. The
+ * {@link #getURI(java.lang.String)} method can be used to find the URI
+ * associated to a given prefix in the current scope. </p>
+ *
+ * <p> XMLReaders can be created using a {@link XMLReaderFactory}. </p>
+ *
+ * <p> Some utility methods, {@link #nextContent} and {@link #nextElementContent}
+ * make it possible to ignore whitespace and processing instructions with
+ * minimum impact on the client code. </p>
+ *
+ * <p> Similarly, the {@link #skipElement} and {@link #skipElement(int elementId)}
+ * methods allow to skip to the end tag of an element ignoring all its content.
</p>
+ *
+ * <p> Finally, the {@link #recordElement} method can be invoked when the
XMLReader
+ * is positioned on the start tag of an element to record the element's contents
+ * so that they can be played back later. </p>
+ *
+ * @see XMLReaderFactory
+ *
+ * @author WS Development Team
+ */
+public interface XMLReader {
+ /**
+ * The initial state of a XMLReader.
+ */
+ public static final int BOF = 0;
+
+ /**
+ * The state denoting the start tag of an element.
+ */
+ public static final int START = 1;
+
+ /**
+ * The state denoting the end tag of an element.
+ */
+ public static final int END = 2;
+
+ /**
+ * The state denoting the character content of an element.
+ */
+ public static final int CHARS = 3;
+
+ /**
+ * The state denoting a processing instruction.
+ */
+ public static final int PI = 4;
+
+ /**
+ * The state denoting that the end of the document has been reached.
+ */
+ public static final int EOF = 5;
+
+ /**
+ * Return the next state of the XMLReader.
+ *
+ * The return value is one of: START, END, CHARS, PI, EOF.
+ */
+ public int next();
+
+ /*
+ * Return the next state of the XMLReader.
+ *
+ * <p> Whitespace character content and processing instructions are ignored.
</p>
+ *
+ * <p> The return value is one of: START, END, CHARS, EOF. </p>
+ */
+ public int nextContent();
+
+ /**
+ * Return the next state of the XMLReader.
+ *
+ * <p> Whitespace character content, processing instructions are ignored.
+ * Non-whitespace character content triggers an exception. </p>
+ *
+ * <p> The return value is one of: START, END, EOF. </p>
+ */
+ public int nextElementContent();
+
+ /**
+ * Return the current state of the XMLReader.
+ *
+ */
+ public int getState();
+
+ /**
+ * Return the current qualified name.
+ *
+ * <p> Meaningful only when the state is one of: START, END. </p>
+ */
+ public QName getName();
+
+ /**
+ * Return the current URI.
+ *
+ * <p> Meaningful only when the state is one of: START, END. </p>
+ */
+ public String getURI();
+
+ /**
+ * Return the current local name.
+ *
+ * <p> Meaningful only when the state is one of: START, END, PI. </p>
+ */
+ public String getLocalName();
+
+ /**
+ * Return the current attribute list. In the jaxws implementation,
+ * this list also includes namespace declarations.
+ *
+ * <p> Meaningful only when the state is one of: START. </p>
+ *
+ * <p> The returned {@link Attributes} object belong to the XMLReader and is
+ * only guaranteed to be valid until the {@link #next} method is called,
+ * directly or indirectly.</p>
+ */
+ public Attributes getAttributes();
+
+ /**
+ * Return the current value.
+ *
+ * <p> Meaningful only when the state is one of: CHARS, PI. </p>
+ */
+ public String getValue();
+
+ /**
+ * Return the current element ID.
+ */
+ public int getElementId();
+
+ /**
+ * Return the current line number.
+ *
+ * <p> Due to aggressive parsing, this value may be off by a few lines.
</p>
+ */
+ public int getLineNumber();
+
+ /**
+ * Return the URI for the given prefix.
+ *
+ * <p> If there is no namespace declaration in scope for the given
+ * prefix, return null. </p>
+ */
+ public String getURI(String prefix);
+
+ /**
+ * Return an iterator on all prefixes in scope, except for the default prefix.
+ *
+ */
+ public Iterator getPrefixes();
+
+ /**
+ * Records the current element and leaves the reader positioned on its end tag.
+ *
+ * <p> The XMLReader must be positioned on the start tag of the element.
+ * The returned reader will play back all events starting with the
+ * start tag of the element and ending with its end tag. </p>
+ */
+ public XMLReader recordElement();
+
+ /**
+ * Skip all nodes up to the end tag of the element with the current element ID.
+ */
+ public void skipElement();
+
+ /**
+ * Skip all nodes up to the end tag of the element with the given element ID.
+ */
+ public void skipElement(int elementId);
+
+ /**
+ * Close the XMLReader.
+ *
+ * <p> All subsequent calls to {@link #next} will return EOF. </p>
+ */
+ public void close();
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/XMLReader.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/XMLReaderException.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/XMLReaderException.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/XMLReaderException.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,54 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.streaming;
+
+import org.jboss.com.sun.xml.ws.util.exception.JAXWSExceptionBase;
+import org.jboss.com.sun.xml.ws.util.localization.Localizable;
+
+/**
+ * <p> XMLReaderException represents an exception that occurred while reading an
+ * XML document. </p>
+ *
+ * @see XMLReader
+ * @see JAXWSExceptionBase
+ *
+ * @author WS Development Team
+ */
+public class XMLReaderException extends JAXWSExceptionBase {
+
+ public XMLReaderException(String key, Object... args) {
+ super(key, args);
+ }
+
+ public XMLReaderException(Throwable throwable) {
+ super(throwable);
+ }
+
+ public XMLReaderException(Localizable arg) {
+ super("xmlreader.nestedError", arg);
+ }
+
+ public String getResourceBundleName() {
+ return "org.jboss.com.sun.xml.ws.resources.streaming";
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/XMLReaderException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/XMLStreamReaderException.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/XMLStreamReaderException.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/XMLStreamReaderException.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,53 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.streaming;
+
+import org.jboss.com.sun.xml.ws.util.exception.JAXWSExceptionBase;
+import org.jboss.com.sun.xml.ws.util.localization.Localizable;
+
+/**
+ * <p> XMLStream ReaderException represents an exception that occurred while
reading an
+ * XML document. </p>
+ *
+ * @see JAXWSExceptionBase
+ *
+ * @author WS Development Team
+ */
+public class XMLStreamReaderException extends JAXWSExceptionBase {
+
+ public XMLStreamReaderException(String key, Object... args) {
+ super(key, args);
+ }
+
+ public XMLStreamReaderException(Throwable throwable) {
+ super(throwable);
+ }
+
+ public XMLStreamReaderException(Localizable arg) {
+ super("xmlreader.nestedError", arg);
+ }
+
+ public String getResourceBundleName() {
+ return "org.jboss.com.sun.xml.ws.resources.streaming";
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/XMLStreamReaderException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/XMLStreamReaderFactory.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/XMLStreamReaderFactory.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/XMLStreamReaderFactory.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,256 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.streaming;
+
+import org.jboss.com.sun.xml.ws.util.FastInfosetReflection;
+import org.jboss.com.sun.xml.ws.util.SunStAXReflection;
+import org.xml.sax.InputSource;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.net.MalformedURLException;
+
+
+/**
+ * <p>A factory to create XML and FI parsers.</p>
+ *
+ * @author Santiago.PericasGeertsen(a)sun.com
+ */
+public class XMLStreamReaderFactory {
+
+ /**
+ * StAX input factory shared by all threads.
+ */
+ static XMLInputFactory xmlInputFactory;
+
+ /**
+ * FI stream reader for each thread.
+ */
+ static ThreadLocal fiStreamReader = new ThreadLocal();
+
+ /**
+ * Zephyr's stream reader for each thread.
+ */
+ static ThreadLocal xmlStreamReader = new ThreadLocal();
+
+ static {
+ // Use StAX pluggability layer to get factory instance
+ xmlInputFactory = XMLInputFactory.newInstance();
+ xmlInputFactory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.TRUE);
+
+ try {
+ // Turn OFF internal factory caching in Zephyr -- not thread safe
+ xmlInputFactory.setProperty("reuse-instance", Boolean.FALSE);
+ }
+ catch (IllegalArgumentException e) {
+ // falls through
+ }
+ }
+
+ // -- XML ------------------------------------------------------------
+
+ /**
+ * Returns a fresh StAX parser created from an InputSource. Use this
+ * method when concurrent instances are needed within a single thread.
+ *
+ * TODO: Reject DTDs?
+ */
+ public static XMLStreamReader createFreshXMLStreamReader(InputSource source,
+ boolean rejectDTDs) {
+ try {
+ synchronized (xmlInputFactory) {
+ // Char stream available?
+ if (source.getCharacterStream() != null) {
+ return xmlInputFactory.createXMLStreamReader(
+ source.getSystemId(), source.getCharacterStream());
+ }
+
+ // Byte stream available?
+ if (source.getByteStream() != null) {
+ return xmlInputFactory.createXMLStreamReader(
+ source.getSystemId(), source.getByteStream());
+ }
+
+ // Otherwise, open URI
+ return xmlInputFactory.createXMLStreamReader(source.getSystemId(),
+ new URL(source.getSystemId()).openStream());
+ }
+ }
+ catch (Exception e) {
+ throw new XMLReaderException("stax.cantCreate",e);
+ }
+ }
+
+ /**
+ * This factory method would be used for example when caller wants to close the
stream.
+ */
+ public static XMLStreamReader createFreshXMLStreamReader(String systemId, InputStream
stream) {
+ try {
+ synchronized (xmlInputFactory) {
+ // Otherwise, open URI
+ return xmlInputFactory.createXMLStreamReader(systemId,
+ stream);
+ }
+ }
+ catch (Exception e) {
+ throw new XMLReaderException("stax.cantCreate",e);
+ }
+ }
+
+ /**
+ * This factory method would be used for example when caller wants to close the
stream.
+ */
+ public static XMLStreamReader createFreshXMLStreamReader(String systemId, Reader
reader) {
+ try {
+ synchronized (xmlInputFactory) {
+ // Otherwise, open URI
+ return xmlInputFactory.createXMLStreamReader(systemId,
+ reader);
+ }
+ }
+ catch (Exception e) {
+ throw new XMLReaderException("stax.cantCreate",e);
+ }
+ }
+
+
+
+ /**
+ * Returns a StAX parser from an InputStream.
+ *
+ * TODO: Reject DTDs?
+ */
+ public static XMLStreamReader createXMLStreamReader(InputStream in,
+ boolean rejectDTDs) {
+ return createXMLStreamReader(null, in, rejectDTDs);
+ }
+
+ /**
+ * Returns a StAX parser from an InputStream. Attemps to re-use parsers if
+ * underlying representation is Zephyr.
+ *
+ * TODO: Reject DTDs?
+ */
+ public static XMLStreamReader createXMLStreamReader(String systemId,
+ InputStream in, boolean rejectDTDs) {
+ try {
+ // If using Zephyr, try re-using the last instance
+ if (SunStAXReflection.XMLReaderImpl_setInputSource != null) {
+ Object xsr = xmlStreamReader.get();
+ if (xsr == null) {
+ synchronized (xmlInputFactory) {
+ xmlStreamReader.set(
+ xsr = xmlInputFactory.createXMLStreamReader(systemId, in));
+ }
+ }
+ else {
+ SunStAXReflection.XMLReaderImpl_reset.invoke(xsr);
+ InputSource inputSource = new InputSource(in);
+ inputSource.setSystemId(systemId);
+ SunStAXReflection.XMLReaderImpl_setInputSource.invoke(xsr,
inputSource);
+ }
+ return (XMLStreamReader) xsr;
+ }
+ else {
+ synchronized (xmlInputFactory) {
+ return xmlInputFactory.createXMLStreamReader(systemId, in);
+ }
+ }
+ } catch (Exception e) {
+ throw new XMLReaderException("stax.cantCreate",e);
+ }
+ }
+
+ /**
+ * Returns a StAX parser from a Reader. Attemps to re-use parsers if
+ * underlying representation is Zephyr.
+ *
+ * TODO: Reject DTDs?
+ */
+ public static XMLStreamReader createXMLStreamReader(Reader reader,
+ boolean rejectDTDs) {
+ try {
+ // If using Zephyr, try re-using the last instance
+ if (SunStAXReflection.XMLReaderImpl_setInputSource != null) {
+ Object xsr = xmlStreamReader.get();
+ if (xsr == null) {
+ synchronized (xmlInputFactory) {
+ xmlStreamReader.set(
+ xsr = xmlInputFactory.createXMLStreamReader(reader));
+ }
+ }
+ else {
+ SunStAXReflection.XMLReaderImpl_reset.invoke(xsr);
+ SunStAXReflection.XMLReaderImpl_setInputSource.invoke(xsr, new
InputSource(reader));
+ }
+ return (XMLStreamReader) xsr;
+ }
+ else {
+ synchronized (xmlInputFactory) {
+ return xmlInputFactory.createXMLStreamReader(reader);
+ }
+ }
+ }
+ catch (Exception e) {
+ throw new XMLReaderException("stax.cantCreate",e);
+ }
+ }
+
+ // -- Fast Infoset ---------------------------------------------------
+
+ public static XMLStreamReader createFIStreamReader(InputSource source) {
+ return createFIStreamReader(source.getByteStream());
+ }
+
+ /**
+ * Returns the FI parser allocated for this thread.
+ */
+ public static XMLStreamReader createFIStreamReader(InputStream in) {
+ // Check if compatible implementation of FI was found
+ if (FastInfosetReflection.fiStAXDocumentParser_new == null) {
+ throw new XMLReaderException("fastinfoset.noImplementation");
+ }
+
+ try {
+ Object sdp = fiStreamReader.get();
+ if (sdp == null) {
+ // Do not use StAX pluggable layer for FI
+ fiStreamReader.set(sdp =
FastInfosetReflection.fiStAXDocumentParser_new.newInstance());
+ FastInfosetReflection.fiStAXDocumentParser_setStringInterning.invoke(sdp,
Boolean.TRUE);
+ }
+ FastInfosetReflection.fiStAXDocumentParser_setInputStream.invoke(sdp, in);
+ return (XMLStreamReader) sdp;
+ }
+ catch (Exception e) {
+ throw new XMLStreamReaderException(e);
+ }
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/XMLStreamReaderFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/XMLStreamReaderUtil.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/XMLStreamReaderUtil.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/XMLStreamReaderUtil.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,447 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.streaming;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPConstants;
+import org.jboss.com.sun.xml.ws.encoding.soap.streaming.SOAPNamespaceConstants;
+import org.jboss.com.sun.xml.ws.util.xml.XmlUtil;
+
+
+
+import static javax.xml.stream.XMLStreamConstants.*;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * <p> XMLStreamReaderUtil provides some utility methods intended to be used
+ * in conjunction with a StAX XMLStreamReader. </p>
+ *
+ * @author WS Development Team
+ */
+public class XMLStreamReaderUtil {
+
+ private XMLStreamReaderUtil() {
+ }
+
+ public static void close(XMLStreamReader reader) {
+ try {
+ reader.close();
+ }
+ catch (XMLStreamException e) {
+ throw wrapException(e);
+ }
+ }
+
+ public static int next(XMLStreamReader reader) {
+ try {
+ int readerEvent = reader.next();
+
+ while (readerEvent != END_DOCUMENT) {
+ switch (readerEvent) {
+ case START_ELEMENT:
+ case END_ELEMENT:
+ case CDATA:
+ case CHARACTERS:
+ case PROCESSING_INSTRUCTION:
+ return readerEvent;
+ default:
+ // falls through ignoring event
+ }
+ readerEvent = reader.next();
+ }
+
+ return readerEvent;
+ }
+ catch (XMLStreamException e) {
+ throw wrapException(e);
+ }
+ }
+
+ public static int nextElementContent(XMLStreamReader reader) {
+ int state = nextContent(reader);
+ if (state == CHARACTERS) {
+ throw new XMLStreamReaderException(
+ "xmlreader.unexpectedCharacterContent", reader.getText());
+ }
+ return state;
+ }
+
+ public static int nextContent(XMLStreamReader reader) {
+ for (;;) {
+ int state = next(reader);
+ switch (state) {
+ case START_ELEMENT:
+ case END_ELEMENT:
+ case END_DOCUMENT:
+ return state;
+ case CHARACTERS:
+ if (!reader.isWhiteSpace()) {
+ return CHARACTERS;
+ }
+ }
+ }
+ }
+
+ /**
+ * Skip current element, leaving the cursor at END_ELEMENT of
+ * current element.
+ */
+ public static void skipElement(XMLStreamReader reader) {
+ assert reader.getEventType() == START_ELEMENT;
+ skipTags(reader, true);
+ assert reader.getEventType() == END_ELEMENT;
+ }
+
+ /**
+ * Skip following siblings, leaving cursor at END_ELEMENT of
+ * parent element.
+ */
+ public static void skipSiblings(XMLStreamReader reader, QName parent) {
+ skipTags(reader, reader.getName().equals(parent));
+ assert reader.getEventType() == END_ELEMENT;
+ }
+
+ private static void skipTags(XMLStreamReader reader, boolean exitCondition) {
+ try {
+ int state, tags = 0;
+ while ((state = reader.next()) != END_DOCUMENT) {
+ if (state == START_ELEMENT) {
+ tags++;
+ }
+ else if (state == END_ELEMENT) {
+ if (tags == 0 && exitCondition) return;
+ tags--;
+ }
+ }
+ }
+ catch (XMLStreamException e) {
+ throw wrapException(e);
+ }
+ }
+
+ /*
+ * Get the text of an element
+ */
+ public static String getElementText(XMLStreamReader reader) {
+ try {
+ return reader.getElementText();
+ } catch (XMLStreamException e) {
+ throw wrapException(e);
+ }
+ }
+
+ /*
+ * Get a QName with 'someUri' and 'localname' from an
+ * element of qname type:
+ * <xyz xmlns:ns1="someUri">ns1:localname</xyz>
+ */
+ public static QName getElementQName(XMLStreamReader reader) {
+ try {
+ String text = reader.getElementText();
+ String prefix = text.substring(0, text.indexOf(':'));
+ String namespaceURI = reader.getNamespaceURI(prefix);
+ if (namespaceURI == null) {
+ namespaceURI = "";
+ }
+ String localPart = text.substring(
+ text.indexOf(':') + 1, text.length());
+ return new QName(namespaceURI, localPart);
+ } catch (XMLStreamException e) {
+ throw wrapException(e);
+ }
+ }
+
+ /**
+ * Read all attributes into an data structure. Note that this method cannot
+ * be called multiple times to get the same list of attributes.
+ */
+ public static Attributes getAttributes(XMLStreamReader reader) {
+ return (reader.getEventType() == reader.START_ELEMENT ||
+ reader.getEventType() == reader.ATTRIBUTE) ?
+ new AttributesImpl(reader) : null;
+ }
+
+ public static void verifyReaderState(XMLStreamReader reader, int expectedState) {
+ int state = reader.getEventType();
+ if (state != expectedState) {
+ throw new XMLStreamReaderException(
+ "xmlreader.unexpectedState",
+ new Object[] {
+ getStateName(expectedState), getStateName(state) });
+ }
+ }
+
+ public static void verifyTag(XMLStreamReader reader, QName name) {
+ if (!name.equals(reader.getName())) {
+ throw new XMLStreamReaderException(
+ "xmlreader.unexpectedState.tag",
+ name,
+ reader.getName());
+ }
+ }
+
+ public static String getStateName(XMLStreamReader reader) {
+ return getStateName(reader.getEventType());
+ }
+
+ public static String getStateName(int state) {
+ switch (state) {
+ case ATTRIBUTE:
+ return "ATTRIBUTE";
+ case CDATA:
+ return "CDATA";
+ case CHARACTERS:
+ return "CHARACTERS";
+ case COMMENT:
+ return "COMMENT";
+ case DTD:
+ return "DTD";
+ case END_DOCUMENT:
+ return "END_DOCUMENT";
+ case END_ELEMENT:
+ return "END_ELEMENT";
+ case ENTITY_DECLARATION:
+ return "ENTITY_DECLARATION";
+ case ENTITY_REFERENCE:
+ return "ENTITY_REFERENCE";
+ case NAMESPACE:
+ return "NAMESPACE";
+ case NOTATION_DECLARATION:
+ return "NOTATION_DECLARATION";
+ case PROCESSING_INSTRUCTION:
+ return "PROCESSING_INSTRUCTION";
+ case SPACE:
+ return "SPACE";
+ case START_DOCUMENT:
+ return "START_DOCUMENT";
+ case START_ELEMENT:
+ return "START_ELEMENT";
+ default :
+ return "UNKNOWN";
+ }
+ }
+
+ private static XMLStreamReaderException wrapException(XMLStreamException e) {
+ return new XMLStreamReaderException("xmlreader.ioException",e);
+ }
+
+ // -- Auxiliary classes ----------------------------------------------
+
+ /**
+ * AttributesImpl class copied from old StAXReader. This class is used to implement
+ * getAttributes() on a StAX Reader.
+ */
+ public static class AttributesImpl implements Attributes {
+
+ static final String XMLNS_NAMESPACE_URI =
"http://www.w3.org/2000/xmlns/";
+
+ static class AttributeInfo {
+
+ private QName name;
+ private String value;
+
+ public AttributeInfo(QName name, String value) {
+ this.name = name;
+ if (value == null) {
+ // e.g., <return xmlns=""> -- stax returns null
+ this.value = "";
+ } else {
+ this.value = value;
+ }
+ }
+
+ QName getName() {
+ return name;
+ }
+
+ String getValue() {
+ return value;
+ }
+
+ /*
+ * Return "xmlns:" as part of name if namespace.
+ */
+ String getLocalName() {
+ if (isNamespaceDeclaration()) {
+ if (name.getLocalPart().equals("")) {
+ return "xmlns";
+ }
+ return "xmlns:" + name.getLocalPart();
+ }
+ return name.getLocalPart();
+ }
+
+ boolean isNamespaceDeclaration() {
+ return (name.getNamespaceURI() == XMLNS_NAMESPACE_URI);
+ }
+ }
+
+ // stores qname and value for each attribute
+ AttributeInfo [] atInfos;
+
+ /*
+ * Will create a list that contains the namespace declarations
+ * as well as the other attributes.
+ */
+ public AttributesImpl(XMLStreamReader reader) {
+ if (reader == null) {
+
+ // this is the case when we call getAttributes() on the
+ // reader when it is not on a start tag
+ atInfos = new AttributeInfo[0];
+ } else {
+
+ // this is the normal case
+ int index = 0;
+ String namespacePrefix = null;
+ int namespaceCount = reader.getNamespaceCount();
+ int attributeCount = reader.getAttributeCount();
+ atInfos = new AttributeInfo[namespaceCount + attributeCount];
+ for (int i=0; i<namespaceCount; i++) {
+ namespacePrefix = reader.getNamespacePrefix(i);
+
+ // will be null if default prefix. QName can't take null
+ if (namespacePrefix == null) {
+ namespacePrefix = "";
+ }
+ atInfos[index++] = new AttributeInfo(
+ new QName(XMLNS_NAMESPACE_URI,
+ namespacePrefix,
+ "xmlns"),
+ reader.getNamespaceURI(i));
+ }
+ for (int i=0; i<attributeCount; i++) {
+ atInfos[index++] = new AttributeInfo(
+ reader.getAttributeName(i),
+ reader.getAttributeValue(i));
+ }
+ }
+ }
+
+ public int getLength() {
+ return atInfos.length;
+ }
+
+ public String getLocalName(int index) {
+ if (index >= 0 && index < atInfos.length) {
+ return atInfos[index].getLocalName();
+ }
+ return null;
+ }
+
+ public QName getName(int index) {
+ if (index >= 0 && index < atInfos.length) {
+ return atInfos[index].getName();
+ }
+ return null;
+ }
+
+ public String getPrefix(int index) {
+ if (index >= 0 && index < atInfos.length) {
+ return atInfos[index].getName().getPrefix();
+ }
+ return null;
+ }
+
+ public String getURI(int index) {
+ if (index >= 0 && index < atInfos.length) {
+ return atInfos[index].getName().getNamespaceURI();
+ }
+ return null;
+ }
+
+ public String getValue(int index) {
+ if (index >= 0 && index < atInfos.length) {
+ return atInfos[index].getValue();
+ }
+ return null;
+ }
+
+ public String getValue(QName name) {
+ int index = getIndex(name);
+ if (index != -1) {
+ return atInfos[index].getValue();
+ }
+ return null;
+ }
+
+ public String getValue(String localName) {
+ int index = getIndex(localName);
+ if (index != -1) {
+ return atInfos[index].getValue();
+ }
+ return null;
+ }
+
+ public String getValue(String uri, String localName) {
+ int index = getIndex(uri, localName);
+ if (index != -1) {
+ return atInfos[index].getValue();
+ }
+ return null;
+ }
+
+ public boolean isNamespaceDeclaration(int index) {
+ if (index >= 0 && index < atInfos.length) {
+ return atInfos[index].isNamespaceDeclaration();
+ }
+ return false;
+ }
+
+ public int getIndex(QName name) {
+ for (int i=0; i<atInfos.length; i++) {
+ if (atInfos[i].getName().equals(name)) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ public int getIndex(String localName) {
+ for (int i=0; i<atInfos.length; i++) {
+ if (atInfos[i].getName().getLocalPart().equals(localName)) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ public int getIndex(String uri, String localName) {
+ QName qName;
+ for (int i=0; i<atInfos.length; i++) {
+ qName = atInfos[i].getName();
+ if (qName.getNamespaceURI().equals(uri) &&
+ qName.getLocalPart().equals(localName)) {
+
+ return i;
+ }
+ }
+ return -1;
+ }
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/XMLStreamReaderUtil.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/XMLStreamWriterException.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/XMLStreamWriterException.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/XMLStreamWriterException.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,53 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.streaming;
+
+import org.jboss.com.sun.xml.ws.util.exception.JAXWSExceptionBase;
+import org.jboss.com.sun.xml.ws.util.localization.Localizable;
+
+/**
+ * <p> XMLWriterException represents an exception that occurred while writing
+ * an XML document. </p>
+ *
+ * @see JAXWSExceptionBase
+ *
+ * @author WS Development Team
+ */
+public class XMLStreamWriterException extends JAXWSExceptionBase {
+
+ public XMLStreamWriterException(String key, Object... args) {
+ super(key, args);
+ }
+
+ public XMLStreamWriterException(Throwable throwable) {
+ super(throwable);
+ }
+
+ public XMLStreamWriterException(Localizable arg) {
+ super("xmlwriter.nestedError", arg);
+ }
+
+ public String getResourceBundleName() {
+ return "org.jboss.com.sun.xml.ws.resources.streaming";
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/XMLStreamWriterException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/XMLStreamWriterFactory.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/XMLStreamWriterFactory.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/XMLStreamWriterFactory.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,116 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.streaming;
+
+import java.io.OutputStream;
+import java.lang.reflect.Method;
+import java.lang.reflect.Constructor;
+
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.stream.XMLOutputFactory;
+
+import org.jboss.com.sun.xml.ws.util.FastInfosetReflection;
+
+/**
+ * <p>A factory to create XML and FI serializers.</p>
+ *
+ * @author Santiago.PericasGeertsen(a)sun.com
+ */
+public class XMLStreamWriterFactory {
+
+ /**
+ * StAX input factory shared by all threads.
+ */
+ static XMLOutputFactory xmlOutputFactory;
+
+ /**
+ * FI stream writer for each thread.
+ */
+ static ThreadLocal fiStreamWriter = new ThreadLocal();
+
+ static {
+ // Use StAX pluggability layer to get factory instance
+ xmlOutputFactory = XMLOutputFactory.newInstance();
+ }
+
+ // -- XML ------------------------------------------------------------
+
+ public static XMLStreamWriter createXMLStreamWriter(OutputStream out) {
+ return createXMLStreamWriter(out, "UTF-8");
+ }
+
+ public static XMLStreamWriter createXMLStreamWriter(OutputStream out, String
encoding) {
+ return createXMLStreamWriter(out, encoding, true);
+ }
+
+ /**
+ * TODO: declare?
+ * TODO: Use thread locals and reset() when using Zephyr
+ */
+ public static XMLStreamWriter createXMLStreamWriter(OutputStream out,
+ String encoding, boolean declare)
+ {
+ try {
+ // Assume StAX factory implementation is not thread-safe
+ synchronized (xmlOutputFactory) {
+ return xmlOutputFactory.createXMLStreamWriter(out, encoding);
+ }
+ }
+ catch (Exception e) {
+ throw new XMLReaderException("stax.cantCreate",e);
+ }
+ }
+
+ // -- Fast Infoset ---------------------------------------------------
+
+ public static XMLStreamWriter createFIStreamWriter(OutputStream out) {
+ return createFIStreamWriter(out, "UTF-8");
+ }
+
+ public static XMLStreamWriter createFIStreamWriter(OutputStream out, String encoding)
{
+ return createFIStreamWriter(out, encoding, true);
+ }
+
+ public static XMLStreamWriter createFIStreamWriter(OutputStream out,
+ String encoding, boolean declare)
+ {
+ // Check if compatible implementation of FI was found
+ if (FastInfosetReflection.fiStAXDocumentSerializer_new == null) {
+ throw new XMLReaderException("fastinfoset.noImplementation");
+ }
+
+ try {
+ Object sds = fiStreamWriter.get();
+ if (sds == null) {
+ // Do not use StAX pluggable layer for FI
+ fiStreamWriter.set(sds =
FastInfosetReflection.fiStAXDocumentSerializer_new.newInstance());
+ }
+ FastInfosetReflection.fiStAXDocumentSerializer_setOutputStream.invoke(sds,
out);
+ FastInfosetReflection.fiStAXDocumentSerializer_setEncoding.invoke(sds,
encoding);
+ return (XMLStreamWriter) sds;
+ } catch (Exception e) {
+ throw new XMLStreamWriterException(e);
+ }
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/XMLStreamWriterFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/XMLStreamWriterUtil.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/XMLStreamWriterUtil.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/XMLStreamWriterUtil.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,68 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.streaming;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.stream.XMLStreamException;
+
+/**
+ * <p>XMLStreamWriterUtil provides some utility methods intended to be used
+ * in conjunction with a StAX XMLStreamWriter. </p>
+ *
+ * @author Santiago.PericasGeertsen(a)sun.com
+ */
+public class XMLStreamWriterUtil {
+
+ private XMLStreamWriterUtil() {
+ }
+
+
+ public static String encodeQName(XMLStreamWriter writer, QName qname,
+ PrefixFactory prefixFactory)
+ {
+ // NOTE: Here it is assumed that we do not serialize using default
+ // namespace declarations and therefore that writer.getPrefix will
+ // never return ""
+
+ try {
+ String namespaceURI = qname.getNamespaceURI();
+ String localPart = qname.getLocalPart();
+
+ if (namespaceURI == null || namespaceURI.equals("")) {
+ return localPart;
+ }
+ else {
+ String prefix = writer.getPrefix(namespaceURI);
+ if (prefix == null) {
+ prefix = prefixFactory.getPrefix(namespaceURI);
+ writer.writeNamespace(prefix, namespaceURI);
+ }
+ return prefix + ":" + localPart;
+ }
+ }
+ catch (XMLStreamException e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/streaming/XMLStreamWriterUtil.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/Headers.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/Headers.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/Headers.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,210 @@
+
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.transport;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.io.*;
+
+/**
+ * HTTP request and response headers are represented by this class which implements
+ * the interface {@link java.util.Map}<
+ * {@link java.lang.String},{@link java.util.List}<{@link
java.lang.String}>>.
+ * The keys are case-insensitive Strings representing the header names and
+ * the value associated with each key is a {@link List}<{@link String}>
with one
+ * element for each occurence of the header name in the request or response.
+ * <p>
+ * For example, if a response header instance contains one key "HeaderName"
with two values "value1 and value2"
+ * then this object is output as two header lines:
+ * <blockquote><pre>
+ * HeaderName: value1
+ * HeaderName: value2
+ * </blockquote></pre>
+ * <p>
+ * All the normal {@link java.util.Map} methods are provided, but the following
+ * additional convenience methods are most likely to be used:
+ * <ul>
+ * <li>{@link #getFirst(String)} returns a single valued header or the first value
of
+ * a multi-valued header.</li>
+ * <li>{@link #add(String,String)} adds the given header value to the list for the
given key</li>
+ * <li>{@link #set(String,String)} sets the given header field to the single value
given
+ * overwriting any existing values in the value list.
+ * </ul><p>
+ * All methods in this class accept <code>null</code> values for keys and
values. However, null
+ * keys will never will be present in HTTP request headers, and will not be output/sent
in response headers.
+ * Null values can be represented as either a null entry for the key (i.e. the list is
null) or
+ * where the key has a list, but one (or more) of the list's values is null. Null
values are output
+ * as a header line containing the key but no associated value.
+ * @since 1.6
+ */
+public class Headers implements Map<String,List<String>> {
+
+ HashMap<String,List<String>> map;
+
+ public Headers () {
+ map = new HashMap<String,List<String>>(32);
+ }
+
+ /* Normalize the key by converting to following form.
+ * First char upper case, rest lower case.
+ * key is presumed to be ASCII
+ */
+ private String normalize (String key) {
+ if (key == null) {
+ return null;
+ }
+ int len = key.length();
+ if (len == 0) {
+ return key;
+ }
+ char[] b = new char [len];
+ String s = null;
+ b = key.toCharArray();
+ if (b[0] >= 'a' && b[0] <= 'z') {
+ b[0] = (char)(b[0] - ('a' - 'A'));
+ }
+ for (int i=1; i<len; i++) {
+ if (b[i] >= 'A' && b[i] <= 'Z') {
+ b[i] = (char) (b[i] + ('a' - 'A'));
+ }
+ }
+ s = new String (b);
+ return s;
+ }
+
+ public int size() {
+ return map.size();
+ }
+
+ public boolean isEmpty() {
+ return map.isEmpty();
+ }
+
+ public boolean containsKey(Object key) {
+ if (key == null) {
+ return false;
+ }
+ if (!(key instanceof String)) {
+ return false;
+ }
+ return map.containsKey (normalize((String)key));
+ }
+
+ public boolean containsValue(Object value) {
+ return map.containsValue(value);
+ }
+
+ public List<String> get(Object key) {
+ return map.get(normalize((String)key));
+ }
+
+ /**
+ * returns the first value from the List of String values
+ * for the given key (if at least one exists).
+ * @param key the key to search for
+ * @return the first string value associated with the key
+ */
+ public String getFirst (String key) {
+ List<String> l = map.get(normalize((String)key));
+ if (l == null) {
+ return null;
+ }
+ return l.get(0);
+ }
+
+ public List<String> put(String key, List<String> value) {
+ return map.put (normalize(key), value);
+ }
+
+ /**
+ * adds the given value to the list of headers
+ * for the given key. If the mapping does not
+ * already exist, then it is created
+ * @param key the header name
+ * @param value the header value to add to the header
+ */
+ public void add (String key, String value) {
+ String k = normalize(key);
+ List<String> l = map.get(k);
+ if (l == null) {
+ l = new LinkedList<String>();
+ map.put(k,l);
+ }
+ l.add (value);
+ }
+
+ /**
+ * sets the given value as the sole header value
+ * for the given key. If the mapping does not
+ * already exist, then it is created
+ * @param key the header name
+ * @param value the header value to set.
+ */
+ public void set (String key, String value) {
+ LinkedList<String> l = new LinkedList<String>();
+ l.add (value);
+ put (key, l);
+ }
+
+
+ public List<String> remove(Object key) {
+ return map.remove(normalize((String)key));
+ }
+
+ public void putAll(Map<? extends String,? extends List<String>> t) {
+ map.putAll (t);
+ }
+
+ public void clear() {
+ map.clear();
+ }
+
+ public Set<String> keySet() {
+ return map.keySet();
+ }
+
+ public Collection<List<String>> values() {
+ return map.values();
+ }
+
+ public Set<Map.Entry<String, List<String>>> entrySet() {
+ return map.entrySet();
+ }
+
+ public boolean equals(Object o) {
+ return map.equals(o);
+ }
+
+ public int hashCode() {
+ return map.hashCode();
+ }
+
+ public String toString() {
+ return map.toString();
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/Headers.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/WSConnectionImpl.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/WSConnectionImpl.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/WSConnectionImpl.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,187 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.transport;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+
+import org.jboss.com.sun.xml.ws.client.ClientTransportException;
+import org.jboss.com.sun.xml.ws.pept.ept.EPTFactory;
+import org.jboss.com.sun.xml.ws.spi.runtime.WSConnection;
+
+
+/**
+ * Abstract class for WSConnection. All client-side and server-side
+ * transports should extend this class and override appropriate methods.
+ *
+ * @author WS Development Team
+ */
+public abstract class WSConnectionImpl implements WSConnection {
+ Map<String, List<String>> headers = null;
+ public OutputStream debugStream = null;
+ public OutputStream outputStream = null;
+ public InputStream inputStream = null;
+ int statusCode;
+
+ /** Creates a new instance of WSConnectionImpl */
+ public WSConnectionImpl () {
+ }
+
+ public int getStatus () {
+ return statusCode;
+ }
+
+ public void setStatus (int statusCode) {
+ this.statusCode = statusCode;
+ }
+
+ public OutputStream getDebug () {
+ return debugStream;
+ }
+
+ /**
+ * @return outputStream
+ *
+ * Returns the OutputStream on which the outbound message is written.
+ * Any stream or connection initialization, pre-processing is done here.
+ */
+ public OutputStream getOutput() {
+ return outputStream;
+ }
+
+ /**
+ * @return inputStream
+ *
+ * Returns the InputStream on which the inbound message is received.
+ * Any post-processing of message is done here.
+ */
+ public InputStream getInput() {
+ return inputStream;
+ }
+
+ public Map<String, List<String>> getHeaders () {
+ return headers;
+ }
+
+ public void setHeaders (Map<String, List<String>> headers) {
+ this.headers = headers;
+ }
+
+ /**
+ * Write connection headers in HTTP syntax using \r\n as a
+ * separator.
+ */
+ public void writeHeaders(OutputStream os) {
+ try {
+ byte[] newLine = "\r\n".getBytes("us-ascii");
+
+ // Write all headers ala HTTP (only first list entry serialized)
+ Map<String, List<String>> headers = getHeaders();
+ for (String header : headers.keySet()) {
+ os.write((header + ":" +
+ headers.get(header).get(0)).getBytes("us-ascii"));
+ os.write(newLine);
+ }
+
+ // Write empty line as in HTTP
+ os.write(newLine);
+ }
+ catch (Exception ex) {
+ throw new ClientTransportException("local.client.failed",ex);
+ }
+ }
+
+ /**
+ * Read and consume connection headers in HTTP syntax using
+ * \r\n as a separator.
+ */
+ public void readHeaders(InputStream is) {
+ try {
+ int c1, c2;
+ StringBuffer line = new StringBuffer();
+
+ if (headers == null) {
+ headers = new HashMap<String, List<String>>();
+ }
+ else {
+ headers.clear();
+ }
+
+ // Read headers until finding a \r\n line
+ while ((c1 = is.read()) != -1) {
+ if (c1 == '\r') {
+ c2 = is.read();
+ assert c2 != -1;
+
+ if (c2 == '\n') {
+ String s = line.toString();
+ if (s.length() == 0) {
+ break; // found \r\n line
+ }
+ else {
+ int k = s.indexOf(':');
+ assert k > 0;
+ ArrayList<String> value = new
ArrayList<String>();
+ value.add(s.substring(k + 1));
+ headers.put(s.substring(0, k), value);
+ line.setLength(0); // clear line buffer
+ }
+ }
+ else {
+ line.append((char) c1).append((char) c2);
+ }
+ }
+ else {
+ line.append((char) c1);
+ }
+ }
+ }
+ catch (Exception ex) {
+ throw new ClientTransportException("local.client.failed",ex);
+ }
+ }
+
+ public void closeOutput() {
+ try {
+ if (outputStream != null) {
+ outputStream.flush();
+ outputStream.close();
+ }
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ public void closeInput() {
+ }
+
+ public void close() {
+
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/WSConnectionImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/client/CookieJar.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/client/CookieJar.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/client/CookieJar.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,413 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.transport.http.client;
+
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
+
+/**
+ * Generic class to hold onto HTTP cookies. Can record, retrieve, and
+ * persistently store cookies associated with particular URLs.
+ *
+ * @author WS Development Team
+ */
+public class CookieJar {
+
+ // The representation of cookies is relatively simple right now:
+ // a hash table with key being the domain and the value being
+ // a vector of cookies for that domain.
+ // REMIND: create this on demand in the future
+ private transient Hashtable<String,Vector<HttpCookie>> cookieJar = new
Hashtable<String, Vector<HttpCookie>>();
+
+ /**
+ * Create a new, empty cookie jar.
+ */
+ public CookieJar() {
+ }
+
+ /**
+ * Records any cookies which have been sent as part of an HTTP response.
+ * The connection parameter must be already have been opened, so that
+ * the response headers are available. It's ok to pass a non-HTTP
+ * URL connection, or one which does not have any set-cookie headers.
+ */
+
+
+ public synchronized void recordAnyCookies(URLConnection connection) {
+
+ HttpURLConnection httpConn = (HttpURLConnection) connection;
+ String headerKey;
+
+ for (int hi = 1;
+ (headerKey = httpConn.getHeaderFieldKey(hi)) != null;
+ hi++) {
+ if (headerKey.equalsIgnoreCase("set-cookie")) {
+ String cookieValue = httpConn.getHeaderField(hi);
+
+ recordCookie(httpConn, cookieValue);
+ }
+ }
+ }
+
+ /**
+ * Create a cookie from the cookie, and use the HttpURLConnection to
+ * fill in unspecified values in the cookie with defaults.
+ */
+ private void recordCookie(HttpURLConnection httpConn, String cookieValue) {
+
+ HttpCookie cookie = new HttpCookie(httpConn.getURL(), cookieValue);
+
+ // First, check to make sure the cookie's domain matches the
+ // server's, and has the required number of '.'s
+ String twodot[] = { "com", "edu", "net",
"org", "gov", "mil", "int" };
+ String domain = cookie.getDomain();
+
+ if (domain == null) {
+ return;
+ }
+
+ domain = domain.toLowerCase();
+
+ String host = httpConn.getURL().getHost();
+
+ host = host.toLowerCase();
+
+ boolean domainOK = host.equals(domain);
+
+ if (!domainOK && host.endsWith(domain)) {
+ int dotsNeeded = 2;
+
+ for (int i = 0; i < twodot.length; i++) {
+ if (domain.endsWith(twodot[i])) {
+ dotsNeeded = 1;
+ }
+ }
+
+ int lastChar = domain.length();
+
+ for (;(lastChar > 0) && (dotsNeeded > 0); dotsNeeded--) {
+ lastChar = domain.lastIndexOf('.', lastChar - 1);
+ }
+
+ if (lastChar > 0) {
+ domainOK = true;
+ }
+ }
+
+ if (domainOK) {
+ recordCookie(cookie);
+ }
+ }
+
+ /**
+ * Record the cookie in the in-memory container of cookies. If there
+ * is already a cookie which is in the exact same domain with the
+ * exact same
+ */
+ private void recordCookie(HttpCookie cookie) {
+ recordCookieToJar(cookie, cookieJar, true);
+ }
+
+
+ /**
+ * Adds a Cookie for a given URL to the Cookie Jar.
+ * <P>
+ * New connections to the given URL will include the Cookie.
+ * <P>
+ * It allows to add Cookie information, to the Cookie jar, received
+ * by other mean.
+ * <P>
+ *
+ * @param url the URL to bind the Cookie to.
+ *
+ * @param cookieHeader String defining the Cookie:
+ * <P>
+ * <name>=<value>[;expires=<WHEN>]
+ * [;path=<PATH>][;domain=<DOMAIN>][;secure]
+ * <P>
+ * Refer to <A HREF=
+ * "http://home.netscape.com/newsref/std/cookie_spec.htm">
+ * Netscape Cookie specification</A> for the complete documentation.
+ *
+ */
+ private void setCookie(URL url, String cookieHeader) {
+
+ HttpCookie cookie = new HttpCookie(url, cookieHeader);
+
+ this.recordCookie(cookie);
+ }
+
+ //
+ // Records the given cookie to the desired jar. If doNotify is true,
+ // tell globals to inform interested parties. It *only* makes since for
+ // doNotify to be true if jar is the static jar (i.e. Cookies.cookieJar).
+ //
+ //
+ private void recordCookieToJar(
+ HttpCookie cookie,
+ Hashtable<String,Vector<HttpCookie>> jar,
+ boolean doNotify) {
+
+ if (shouldRejectCookie(cookie)) {
+ return;
+ }
+
+ String domain = cookie.getDomain().toLowerCase();
+ Vector<HttpCookie> cookieList = jar.get(domain);
+
+ if (cookieList == null) {
+ cookieList = new Vector<HttpCookie>();
+ }
+
+ if (addOrReplaceCookie(cookieList, cookie, doNotify)) {
+ jar.put(domain, cookieList);
+ }
+ }
+
+ /**
+ * Scans the vector of cookies looking for an exact match with the
+ * given cookie. Replaces it if there is one, otherwise adds
+ * one at the end. The vector is presumed to have cookies which all
+ * have the same domain, so the domain of the cookie is not checked.
+ * <p>
+ * If doNotify is true, we'll do a vetoable notification of changing the
+ * cookie. This <b>only</b> makes since if the jar being operated on
+ * is Cookies.cookieJar.
+ * <p>
+ * If this is called, it is assumed that the cookie jar is exclusively
+ * held by the current thread.
+ *
+ * @return true if the cookie is actually set
+ */
+ private boolean addOrReplaceCookie(
+ Vector<HttpCookie> cookies,
+ final HttpCookie cookie,
+ boolean doNotify) {
+
+ int numCookies = cookies.size();
+ String path = cookie.getPath();
+ String name = cookie.getName();
+ HttpCookie replaced = null;
+ int replacedIndex = -1;
+
+ for (int i = 0; i < numCookies; i++) {
+ HttpCookie existingCookie = cookies.elementAt(i);
+ String existingPath = existingCookie.getPath();
+
+ if (path.equals(existingPath)) {
+ String existingName = existingCookie.getName();
+
+ if (name.equals(existingName)) {
+
+ // need to replace this one!
+ replaced = existingCookie;
+ replacedIndex = i;
+
+ break;
+ }
+ }
+ }
+
+ // Do the replace
+ if (replaced != null) {
+ cookies.setElementAt(cookie, replacedIndex);
+ } else {
+ cookies.addElement(cookie);
+ }
+
+ return true;
+ }
+
+ /**
+ * Predicate function which returns true if the cookie appears to be
+ * invalid somehow and should not be added to the cookie set.
+ */
+ private boolean shouldRejectCookie(HttpCookie cookie) {
+
+ // REMIND: implement per http-state-mgmt Internet Draft
+ return false;
+ }
+
+ // ab oct/17/01 - added synchronized
+ public synchronized void applyRelevantCookies(URLConnection connection) {
+ this.applyRelevantCookies(connection.getURL(), connection);
+ }
+
+ private void applyRelevantCookies(URL url, URLConnection connection) {
+
+ HttpURLConnection httpConn = (HttpURLConnection) connection;
+ String host = url.getHost();
+
+ applyCookiesForHost(host, url, httpConn);
+
+ // REMIND: should be careful about IP addresses here.
+ int index;
+
+ while ((index = host.indexOf('.', 1)) >= 0) {
+
+ // trim off everything up to, and including the dot.
+ host = host.substring(index + 1);
+
+ applyCookiesForHost(host, url, httpConn);
+ }
+ }
+
+ /**
+ * Host may be a FQDN, or a partial domain name starting with a dot.
+ * Adds any cookies which match the host and path to the
+ * cookie set on the URL connection.
+ */
+ private void applyCookiesForHost(
+ String host,
+ URL url,
+ HttpURLConnection httpConn) {
+
+ //System.out.println("X0"+cookieJar.size());
+ Vector<HttpCookie> cookieList = cookieJar.get(host);
+
+ if (cookieList == null) {
+
+ // Hax.debugln("no matching hosts" + host);
+ return;
+ }
+
+ //System.out.println("X1"+cookieList.size());
+ String path = url.getFile();
+ int queryInd = path.indexOf('?');
+
+ if (queryInd > 0) {
+
+ // strip off the part following the ?
+ path = path.substring(0, queryInd);
+ }
+
+ Enumeration<HttpCookie> cookies = cookieList.elements();
+ Vector<HttpCookie> cookiesToSend = new Vector<HttpCookie>(10);
+
+ while (cookies.hasMoreElements()) {
+ HttpCookie cookie = cookies.nextElement();
+ String cookiePath = cookie.getPath();
+
+ if (path.startsWith(cookiePath)) {
+
+ // larrylf: Actually, my documentation (from Netscape)
+ // says that /foo should
+ // match /foobar and /foo/bar. Yuck!!!
+ if (!cookie.hasExpired()) {
+ cookiesToSend.addElement(cookie);
+ }
+
+ /*
+ We're keeping this piece of commented out code around just in
+ case we decide to put it back. the spec does specify the above.
+
+
+ int cookiePathLen = cookiePath.length();
+
+ // verify that /foo does not match /foobar by mistake
+ if ((path.length() == cookiePathLen)
+ || (path.length() > cookiePathLen &&
+ path.charAt(cookiePathLen) == '/')) {
+
+ // We have a matching cookie!
+
+ if (!cookie.hasExpired()) {
+ cookiesToSend.addElement(cookie);
+ }
+ }
+ */
+ }
+ }
+
+ // Now, sort the cookies in most to least specific order
+ // Yes, its the deaded bubblesort!!
+ // (it should be a small vector, so perf is not an issue...)
+ if (cookiesToSend.size() > 1) {
+ for (int i = 0; i < cookiesToSend.size() - 1; i++) {
+ HttpCookie headC = cookiesToSend.elementAt(i);
+ String head = headC.getPath();
+
+ // This little excercise is a cheap way to get
+ // '/foo' to read more specfic then '/'
+ if (!head.endsWith("/")) {
+ head = head + "/";
+ }
+
+ for (int j = i + 1; j < cookiesToSend.size(); j++) {
+ HttpCookie scanC = cookiesToSend.elementAt(j);
+ String scan = scanC.getPath();
+
+ if (!scan.endsWith("/")) {
+ scan = scan + "/";
+ }
+
+ int headCount = 0;
+ int index = -1;
+
+ while ((index = head.indexOf('/', index + 1)) != -1) {
+ headCount++;
+ }
+
+ index = -1;
+
+ int scanCount = 0;
+
+ while ((index = scan.indexOf('/', index + 1)) != -1) {
+ scanCount++;
+ }
+
+ if (scanCount > headCount) {
+ cookiesToSend.setElementAt(headC, j);
+ cookiesToSend.setElementAt(scanC, i);
+
+ headC = scanC;
+ head = scan;
+ }
+ }
+ }
+ }
+
+ // And send the sorted cookies...
+ cookies = cookiesToSend.elements();
+
+ String cookieStr = null;
+
+ while (cookies.hasMoreElements()) {
+ HttpCookie cookie = cookies.nextElement();
+
+ if (cookieStr == null) {
+ cookieStr = cookie.getNameValue();
+ } else {
+ cookieStr = cookieStr + "; " + cookie.getNameValue();
+ }
+ }
+
+ if (cookieStr != null) {
+ httpConn.setRequestProperty("Cookie", cookieStr);
+ }
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/client/CookieJar.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/client/HttpClientTransport.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/client/HttpClientTransport.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/client/HttpClientTransport.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,483 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.transport.http.client;
+
+
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLSession;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.http.HTTPBinding;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.MimeHeader;
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPConstants;
+import static javax.xml.ws.BindingProvider.ENDPOINT_ADDRESS_PROPERTY;
+import static javax.xml.ws.BindingProvider.SESSION_MAINTAIN_PROPERTY;
+import static org.jboss.com.sun.xml.ws.client.BindingProviderProperties.*;
+
+import javax.xml.ws.soap.SOAPBinding;
+
+import org.jboss.com.sun.xml.ws.client.BindingProviderProperties;
+import org.jboss.com.sun.xml.ws.client.ClientTransportException;
+import org.jboss.com.sun.xml.ws.transport.WSConnectionImpl;
+import org.jboss.com.sun.xml.ws.util.ByteArrayBuffer;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author WS Development Team
+ */
+public class HttpClientTransport extends WSConnectionImpl {
+
+ private static String LAST_ENDPOINT = "";
+ private static boolean redirect = true;
+ private static final int START_REDIRECT_COUNT = 3;
+ private static int redirectCount = START_REDIRECT_COUNT;
+ int statusCode;
+ private Map<String, List<String>> respHeaders = null;
+
+ public HttpClientTransport() {
+ this(null, new HashMap<String, Object>());
+ }
+
+ public HttpClientTransport(OutputStream logStream, Map<String, Object> context)
{
+ this.context = context;
+ _logStream = logStream;
+
+ String bindingId = (String) context.get(BINDING_ID_PROPERTY);
+ try {
+ if (bindingId == null)
+ bindingId = SOAPBinding.SOAP11HTTP_BINDING;
+
+ if (bindingId.equals(SOAPBinding.SOAP12HTTP_BINDING))
+ _messageFactory =
MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
+ else
+ _messageFactory =
MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
+
+ endpoint = (String) context.get(ENDPOINT_ADDRESS_PROPERTY);
+ } catch (Exception e) {
+ throw new
ClientTransportException("http.client.cannotCreateMessageFactory");
+ }
+ }
+
+ /**
+ * Prepare the stream for HTTP request
+ */
+ @Override
+ public OutputStream getOutput() {
+ try {
+ httpConnection = createHttpConnection(endpoint, context);
+ cookieJar = sendCookieAsNeeded();
+
+ // how to incorporate redirect processing: message dispatcher does not seem
to tbe right place
+ String requestMethod = httpConnection.getRequestMethod();
+ boolean skipOut = ("GET".equalsIgnoreCase(requestMethod) ||
+ "HEAD".equalsIgnoreCase(requestMethod) ||
+ "DELETE".equalsIgnoreCase(requestMethod));
+ if (!skipOut)
+ outputStream = httpConnection.getOutputStream();
+ //if use getOutputStream method set as "POST"
+ //but for "Get" request no need to get outputStream
+ connectForResponse();
+
+ } catch (Exception ex) {
+ throw new ClientTransportException("http.client.failed", ex);
+ }
+
+ return outputStream;
+ }
+
+ /**
+ * Get the response from HTTP connection and prepare the input stream for response
+ */
+ @Override
+ public InputStream getInput() {
+ // response processing
+
+ InputStream in;
+ try {
+ in = readResponse();
+ } catch (IOException e) {
+ if (statusCode == HttpURLConnection.HTTP_NO_CONTENT
+ || (isFailure
+ && statusCode != HttpURLConnection.HTTP_INTERNAL_ERROR)) {
+ try {
+ throw new ClientTransportException("http.status.code",
+ statusCode, httpConnection.getResponseMessage());
+ } catch (IOException ex) {
+ throw new ClientTransportException("http.status.code",
+ statusCode, ex);
+ }
+ }
+ throw new ClientTransportException("http.client.failed",
+ e.getMessage());
+ }
+ httpConnection = null;
+
+ return in;
+ }
+
+ @Override
+ public OutputStream getDebug() {
+ return _logStream;
+ }
+
+ @Override
+ public Map<String, List<String>> getHeaders() {
+ if (respHeaders != null) {
+ return respHeaders;
+ }
+ try {
+ isFailure = checkResponseCode();
+
+ respHeaders = collectResponseMimeHeaders();
+
+ saveCookieAsNeeded(cookieJar);
+ setHeaders(respHeaders);
+
+ return respHeaders;
+ } catch (IOException e) {
+ if (statusCode == HttpURLConnection.HTTP_NO_CONTENT
+ || (isFailure
+ && statusCode != HttpURLConnection.HTTP_INTERNAL_ERROR)) {
+ try {
+ throw new ClientTransportException("http.status.code",
+ new Object[]{
+ statusCode,
+ httpConnection.getResponseMessage()});
+ } catch (IOException ex) {
+ throw new ClientTransportException("http.status.code",
+ new Object[]{
+ statusCode,
+ ex});
+ }
+ }
+ throw new ClientTransportException("http.client.failed",
+ e.getMessage());
+ }
+
+ }
+
+// public void invoke(String endpoint, SOAPMessageContext context)
+// throws ClientTransportException {
+
+// try {
+// int statusCode = httpConnection.getResponseCode();
+//
+// //http URL redirection does not redirect http requests
+// //to an https endpoint probably due to a bug in the jdk
+// //or by intent - to workaround this if an error code
+// //of HTTP_MOVED_TEMP or HTTP_MOVED_PERM is received then
+// //the jaxws client will reinvoke the original request
+// //to the new endpoint - kw bug 4890118
+// if (checkForRedirect(statusCode)) {
+// redirectRequest(httpConnection, context);
+// return;
+// }
+// }
+
+ protected InputStream readResponse()
+ throws IOException {
+ InputStream contentIn =
+ (isFailure
+ ? httpConnection.getErrorStream()
+ : httpConnection.getInputStream());
+
+ ByteArrayBuffer bab = new ByteArrayBuffer();
+ if (contentIn != null) { // is this really possible?
+ bab.write(contentIn);
+ bab.close();
+ }
+
+ int length =
+ httpConnection.getContentLength() == -1
+ ? bab.size()
+ : httpConnection.getContentLength();
+
+ return bab.newInputStream(0, length);
+ }
+
+ protected Map<String, List<String>> collectResponseMimeHeaders() {
+ /*
+ MimeHeaders mimeHeaders = new MimeHeaders();
+ for (int i = 1; ; ++i) {
+ String key = httpConnection.getHeaderFieldKey(i);
+ if (key == null) {
+ break;
+ }
+ String value = httpConnection.getHeaderField(i);
+ try {
+ mimeHeaders.addHeader(key, value);
+ } catch (IllegalArgumentException e) {
+ // ignore headers that are illegal in MIME
+ }
+ }
+
+ Map<String, List<String>> headers = new HashMap<String,
List<String>>();
+ for (Iterator iter = mimeHeaders.getAllHeaders(); iter.hasNext();) {
+ MimeHeader header = (MimeHeader)iter.next();
+ List<String> h = new ArrayList<String>();
+ h.add(header.getValue());
+ headers.put (header.getName (), h);
+ }
+ return headers;
+ */
+ return httpConnection.getHeaderFields();
+ }
+
+ protected void connectForResponse()
+ throws IOException {
+
+ httpConnection.connect();
+ }
+
+ /*
+ * Will throw an exception instead of returning 'false' if there is no
+ * return message to be processed (i.e., in the case of an UNAUTHORIZED
+ * response from the servlet or 404 not found)
+ */
+ protected boolean checkResponseCode()
+ throws IOException {
+ boolean isFailure = false;
+ try {
+
+ statusCode = httpConnection.getResponseCode();
+ setStatus(statusCode);
+
+ if ((httpConnection.getResponseCode()
+ == HttpURLConnection.HTTP_INTERNAL_ERROR)) {
+ isFailure = true;
+ //added HTTP_ACCEPT for 1-way operations
+ } else if (
+ httpConnection.getResponseCode()
+ == HttpURLConnection.HTTP_UNAUTHORIZED) {
+
+ // no soap message returned, so skip reading message and throw exception
+ throw new ClientTransportException("http.client.unauthorized",
+ httpConnection.getResponseMessage());
+ } else if (
+ httpConnection.getResponseCode()
+ == HttpURLConnection.HTTP_NOT_FOUND) {
+
+ // no message returned, so skip reading message and throw exception
+ throw new ClientTransportException("http.not.found",
+ httpConnection.getResponseMessage());
+ } else if (
+ (statusCode == HttpURLConnection.HTTP_MOVED_TEMP) ||
+ (statusCode == HttpURLConnection.HTTP_MOVED_PERM)) {
+ isFailure = true;
+
+ if (!redirect || (redirectCount <= 0)) {
+ throw new ClientTransportException("http.status.code",
+ new Object[]{
+ statusCode,
+ getStatusMessage(httpConnection)});
+ }
+ } else if (
+ statusCode < 200 || (statusCode >= 303 && statusCode <
500)) {
+ throw new ClientTransportException("http.status.code",
+ new Object[]{
+ statusCode,
+ getStatusMessage(httpConnection)});
+ } else if (statusCode >= 500) {
+ isFailure = true;
+ }
+ } catch (IOException e) {
+ throw new WebServiceException(e);
+ // on JDK1.3.1_01, we end up here, but then getResponseCode() succeeds!
+// if (httpConnection.getResponseCode()
+// == HttpURLConnection.HTTP_INTERNAL_ERROR) {
+// isFailure = true;
+// } else {
+// throw e;
+// }
+ }
+
+ return isFailure;
+ }
+
+ protected String getStatusMessage(HttpURLConnection httpConnection)
+ throws IOException {
+ int statusCode = httpConnection.getResponseCode();
+ String message = httpConnection.getResponseMessage();
+ if (statusCode == HttpURLConnection.HTTP_CREATED
+ || (statusCode >= HttpURLConnection.HTTP_MULT_CHOICE
+ && statusCode != HttpURLConnection.HTTP_NOT_MODIFIED
+ && statusCode < HttpURLConnection.HTTP_BAD_REQUEST)) {
+ String location = httpConnection.getHeaderField("Location");
+ if (location != null)
+ message += " - Location: " + location;
+ }
+ return message;
+ }
+
+ protected CookieJar sendCookieAsNeeded() {
+ Boolean shouldMaintainSessionProperty =
+ (Boolean) context.get(SESSION_MAINTAIN_PROPERTY);
+ if (shouldMaintainSessionProperty == null) {
+ return null;
+ }
+ if (shouldMaintainSessionProperty.booleanValue()) {
+ CookieJar cookieJar = (CookieJar) context.get(HTTP_COOKIE_JAR);
+ if (cookieJar == null) {
+ cookieJar = new CookieJar();
+
+ // need to store in binding's context so it is not lost
+ BindingProvider bp =
+ (BindingProvider) context.get(JAXWS_CLIENT_HANDLE_PROPERTY);
+ bp.getRequestContext().put(HTTP_COOKIE_JAR, cookieJar);
+ }
+ cookieJar.applyRelevantCookies(httpConnection);
+ return cookieJar;
+ } else {
+ return null;
+ }
+ }
+
+ protected void saveCookieAsNeeded(CookieJar cookieJar) {
+ if (cookieJar != null) {
+ cookieJar.recordAnyCookies(httpConnection);
+ }
+ }
+
+ protected HttpURLConnection createHttpConnection(String endpoint,
+ Map<String, Object> context)
+ throws IOException {
+
+ boolean verification = false;
+ // does the client want client hostname verification by the service
+ String verificationProperty =
+ (String) context.get(HOSTNAME_VERIFICATION_PROPERTY);
+ if (verificationProperty != null) {
+ if (verificationProperty.equalsIgnoreCase("true"))
+ verification = true;
+ }
+
+ // does the client want request redirection to occur
+ String redirectProperty =
+ (String) context.get(REDIRECT_REQUEST_PROPERTY);
+ if (redirectProperty != null) {
+ if (redirectProperty.equalsIgnoreCase("false"))
+ redirect = false;
+ }
+
+ checkEndpoints(endpoint);
+
+ HttpURLConnection httpConnection = createConnection(endpoint);
+
+ if (!verification) {
+ // for https hostname verification - turn off by default
+ if (httpConnection instanceof HttpsURLConnection) {
+ ((HttpsURLConnection) httpConnection).setHostnameVerifier(new
HttpClientVerifier());
+ }
+ }
+
+ // allow interaction with the web page - user may have to supply
+ // username, password id web page is accessed from web browser
+ httpConnection.setAllowUserInteraction(true);
+ // enable input, output streams
+ httpConnection.setDoOutput(true);
+ httpConnection.setDoInput(true);
+ // the soap message is always sent as a Http POST
+ // HTTP Get is disallowed by BP 1.0
+ // needed for XML/HTTPBinding and SOAP12Binding
+ // for xml/http binding other methods are allowed.
+ // for Soap 1.2 "GET" is allowed.
+ String method = "POST";
+ String requestMethod = (String) context.get(MessageContext.HTTP_REQUEST_METHOD);
+ if
(context.get(BindingProviderProperties.BINDING_ID_PROPERTY).equals(HTTPBinding.HTTP_BINDING)){
+ method = (requestMethod != null)?requestMethod:method;
+ } else if
+
(context.get(BindingProviderProperties.BINDING_ID_PROPERTY).equals(SOAPBinding.SOAP12HTTP_BINDING)
&&
+ "GET".equalsIgnoreCase(requestMethod)) {
+ method = (requestMethod != null)?requestMethod:method;
+ }
+ ((HttpURLConnection)httpConnection).setRequestMethod(method);
+
+ Integer reqTimeout =
(Integer)context.get(BindingProviderProperties.REQUEST_TIMEOUT);
+ if (reqTimeout != null) {
+ httpConnection.setReadTimeout(reqTimeout);
+ }
+
+ // set the properties on HttpURLConnection
+ for (Map.Entry entry : super.getHeaders().entrySet()) {
+ httpConnection.addRequestProperty((String) entry.getKey(),
((List<String>) entry.getValue()).get(0));
+ }
+
+ return httpConnection;
+ }
+
+ private java.net.HttpURLConnection createConnection(String endpoint)
+ throws IOException {
+ return (HttpURLConnection) new URL(endpoint).openConnection();
+ }
+
+// private void redirectRequest(HttpURLConnection httpConnection, SOAPMessageContext
context) {
+// String redirectEndpoint = httpConnection.getHeaderField("Location");
+// if (redirectEndpoint != null) {
+// httpConnection.disconnect();
+// invoke(redirectEndpoint, context);
+// } else
+// System.out.println("redirection Failed");
+// }
+
+ private boolean checkForRedirect(int statusCode) {
+ return (((statusCode == 301) || (statusCode == 302)) && redirect
&& (redirectCount-- > 0));
+ }
+
+ private void checkEndpoints(String currentEndpoint) {
+ if (!LAST_ENDPOINT.equalsIgnoreCase(currentEndpoint)) {
+ redirectCount = START_REDIRECT_COUNT;
+ LAST_ENDPOINT = currentEndpoint;
+ }
+ }
+
+ // overide default SSL HttpClientVerifier to always return true
+ // effectively overiding Hostname client verification when using SSL
+ static class HttpClientVerifier implements HostnameVerifier {
+ public boolean verify(String s, SSLSession sslSession) {
+ return true;
+ }
+ }
+
+ private MessageFactory _messageFactory;
+ HttpURLConnection httpConnection = null;
+ String endpoint = null;
+ Map<String, Object> context = null;
+ CookieJar cookieJar = null;
+ boolean isFailure = false;
+ OutputStream _logStream = null;
+}
+
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/client/HttpClientTransport.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/client/HttpClientTransportFactory.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/client/HttpClientTransportFactory.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/client/HttpClientTransportFactory.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,68 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.transport.http.client;
+
+import java.io.OutputStream;
+import java.util.Map;
+
+import javax.xml.ws.soap.SOAPBinding;
+
+import org.jboss.com.sun.xml.ws.spi.runtime.ClientTransportFactory;
+import org.jboss.com.sun.xml.ws.spi.runtime.WSConnection;
+
+import static
org.jboss.com.sun.xml.ws.client.BindingProviderProperties.BINDING_ID_PROPERTY;
+
+import java.util.HashMap;
+
+/**
+ * @author WS Development Team
+ */
+public class HttpClientTransportFactory implements ClientTransportFactory {
+
+
+ public HttpClientTransportFactory() {
+ this(null);
+ }
+
+ public HttpClientTransportFactory(OutputStream logStream) {
+ _logStream = logStream;
+ }
+
+ /*
+ public WSConnection create() {
+ Map<String, Object> context = new HashMap<String, Object>();
+ context.put(BINDING_ID_PROPERTY, SOAPBinding.SOAP11HTTP_BINDING);
+
+ return new HttpClientTransport(_logStream, context);
+ }
+ */
+
+ /**
+ * Binding Id, Endpoint address and other metadata is in the property bag
+ */
+ public WSConnection create(Map<String, Object> context) {
+ return new HttpClientTransport(_logStream, context);
+ }
+
+ private OutputStream _logStream;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/client/HttpClientTransportFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/client/HttpCookie.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/client/HttpCookie.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/client/HttpCookie.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,257 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.transport.http.client;
+
+import java.net.URL;
+import java.util.Date;
+import java.util.StringTokenizer;
+
+/**
+ * An object which represents an HTTP cookie. Can be constructed by
+ * parsing a string from the set-cookie: header.
+ *
+ * Syntax: Set-Cookie: NAME=VALUE; expires=DATE;
+ * path=PATH; domain=DOMAIN_NAME; secure
+ *
+ * All but the first field are optional.
+ *
+ * @author WS Development Team
+ */
+public class HttpCookie {
+
+ private Date expirationDate = null;
+ private String nameAndValue;
+ private String path;
+ private String domain;
+ private boolean isSecure = false;
+
+ public HttpCookie(String cookieString) {
+ parseCookieString(cookieString);
+ }
+
+ //
+ // Constructor for use by the bean
+ //
+ public HttpCookie(
+ Date expirationDate,
+ String nameAndValue,
+ String path,
+ String domain,
+ boolean isSecure) {
+
+ this.expirationDate = expirationDate;
+ this.nameAndValue = nameAndValue;
+ this.path = path;
+ this.domain = stripPort(domain);
+ this.isSecure = isSecure;
+ }
+
+ public HttpCookie(URL url, String cookieString) {
+ parseCookieString(cookieString);
+ applyDefaults(url);
+ }
+
+ /**
+ * Fills in default values for domain, path, etc. from the URL
+ * after creation of the cookie.
+ */
+ private void applyDefaults(URL url) {
+
+ if (domain == null) {
+ domain = url.getHost();
+
+ // REMIND: record the port
+ }
+
+ if (path == null) {
+ path = url.getFile();
+
+ // The documentation for cookies say that the path is
+ // by default, the path of the document, not the filename of the
+ // document. This could be read as not including that document
+ // name itself, just its path (this is how NetScape inteprets it)
+ // so amputate the document name!
+ int last = path.lastIndexOf("/");
+
+ if (last > -1) {
+ path = path.substring(0, last);
+ }
+ }
+ }
+
+ private String stripPort(String domainName) {
+
+ int index = domainName.indexOf(':');
+
+ if (index == -1) {
+ return domainName;
+ }
+
+ return domainName.substring(0, index);
+ }
+
+ /**
+ * Parse the given string into its individual components, recording them
+ * in the member variables of this object.
+ */
+ private void parseCookieString(String cookieString) {
+
+ StringTokenizer tokens = new StringTokenizer(cookieString, ";");
+
+ if (!tokens.hasMoreTokens()) {
+
+ // REMIND: make this robust against parse errors
+ }
+
+ nameAndValue = tokens.nextToken().trim();
+
+ while (tokens.hasMoreTokens()) {
+ String token = tokens.nextToken().trim();
+
+ if (token.equalsIgnoreCase("secure")) {
+ isSecure = true;
+ } else {
+ int equIndex = token.indexOf("=");
+
+ if (equIndex < 0) {
+ continue;
+
+ // REMIND: malformed cookie
+ }
+
+ String attr = token.substring(0, equIndex);
+ String val = token.substring(equIndex + 1);
+
+ if (attr.equalsIgnoreCase("path")) {
+ path = val;
+ } else if (attr.equalsIgnoreCase("domain")) {
+ if (val.indexOf(".") == 0) {
+
+ // spec seems to allow for setting the domain in
+ // the form 'domain=.eng.sun.com'. We want to
+ // trim off the leading '.' so we can allow for
+ // both leading dot and non leading dot forms
+ // without duplicate storage.
+ domain = stripPort(val.substring(1));
+ } else {
+ domain = stripPort(val);
+ }
+ } else if (attr.equalsIgnoreCase("expires")) {
+ expirationDate = parseExpireDate(val);
+ } else {
+
+ // unknown attribute -- do nothing
+ }
+ }
+ }
+ }
+
+ //======================================================================
+ //
+ // Accessor functions
+ //
+ public String getNameValue() {
+ return nameAndValue;
+ }
+
+ /**
+ * Returns just the name part of the cookie
+ */
+ public String getName() {
+
+ int index = nameAndValue.indexOf("=");
+
+ return nameAndValue.substring(0, index);
+ }
+
+ /**
+ * Returns the domain of the cookie as it was presented
+ */
+ public String getDomain() {
+
+ // REMIND: add port here if appropriate
+ return domain;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public Date getExpirationDate() {
+ return expirationDate;
+ }
+
+ boolean hasExpired() {
+
+ if (expirationDate == null) {
+ return false;
+ }
+
+ return (expirationDate.getTime() <= System.currentTimeMillis());
+ }
+
+ /**
+ * Returns true if the cookie has an expiration date (meaning it's
+ * persistent), and if the date nas not expired;
+ */
+ boolean isSaveable() {
+ return (expirationDate != null)
+ && (expirationDate.getTime() > System.currentTimeMillis());
+ }
+
+ public boolean isSecure() {
+ return isSecure;
+ }
+
+ private Date parseExpireDate(String dateString) {
+
+ // format is wdy, DD-Mon-yyyy HH:mm:ss GMT
+ RfcDateParser parser = new RfcDateParser(dateString);
+ Date theDate = parser.getDate();
+
+ return theDate;
+ }
+
+ public String toString() {
+
+ String result = nameAndValue;
+
+ if (expirationDate != null) {
+ result += "; expires=" + expirationDate;
+ }
+
+ if (path != null) {
+ result += "; path=" + path;
+ }
+
+ if (domain != null) {
+ result += "; domain=" + domain;
+ }
+
+ if (isSecure) {
+ result += "; secure";
+ }
+
+ return result;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/client/HttpCookie.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/client/RfcDateParser.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/client/RfcDateParser.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/client/RfcDateParser.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,112 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.transport.http.client;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
+import java.util.TimeZone;
+
+/**
+ * A parser for date strings commonly found in http and email headers that
+ * follow various RFC conventions. Given a date-string, the parser will
+ * attempt to parse it by trying matches with a set of patterns, returning
+ * null on failure, a Date object on success.
+ *
+ * @author WS Development Team
+ */
+public class RfcDateParser {
+
+ private static final String debugProp = "hotjava.debug.RfcDateParser";
+ private boolean isGMT = false;
+ static final String[] standardFormats =
+ { "EEEE', 'dd-MMM-yy HH:mm:ss z", // RFC 850 (obsoleted by
1036)
+ "EEEE', 'dd-MMM-yy HH:mm:ss", // ditto but no tz. Happens too
often
+ "EEE', 'dd-MMM-yyyy HH:mm:ss z", // RFC 822/1123
+ "EEE', 'dd MMM yyyy HH:mm:ss z", // REMIND what rfc?
Apache/1.1
+ "EEEE', 'dd MMM yyyy HH:mm:ss z", // REMIND what rfc?
Apache/1.1
+ "EEE', 'dd MMM yyyy hh:mm:ss z", // REMIND what rfc?
Apache/1.1
+ "EEEE', 'dd MMM yyyy hh:mm:ss z", // REMIND what rfc?
Apache/1.1
+ "EEE MMM dd HH:mm:ss z yyyy", // Date's string output format
+ "EEE MMM dd HH:mm:ss yyyy", // ANSI C asctime format()
+ "EEE', 'dd-MMM-yy HH:mm:ss", // No time zone 2 digit year RFC
1123
+ "EEE', 'dd-MMM-yyyy HH:mm:ss" // No time zone RFC 822/1123
+ };
+ static final String[] gmtStandardFormats =
+ { "EEEE',' dd-MMM-yy HH:mm:ss 'GMT'", // RFC 850
(obsoleted by 1036)
+ "EEE',' dd-MMM-yyyy HH:mm:ss 'GMT'", // RFC 822/1123
+ "EEE',' dd MMM yyyy HH:mm:ss 'GMT'", // REMIND what
rfc? Apache/1.1
+ "EEEE',' dd MMM yyyy HH:mm:ss 'GMT'", // REMIND what
rfc? Apache/1.1
+ "EEE',' dd MMM yyyy hh:mm:ss 'GMT'", // REMIND what
rfc? Apache/1.1
+ "EEEE',' dd MMM yyyy hh:mm:ss 'GMT'", // REMIND what
rfc? Apache/1.1
+ "EEE MMM dd HH:mm:ss 'GMT' yyyy" // Date's string output
format
+ };
+ String dateString;
+
+ public RfcDateParser(String dateString) {
+
+ this.dateString = dateString.trim();
+
+ if (this.dateString.indexOf("GMT") != -1) {
+ isGMT = true;
+ }
+ }
+
+ public Date getDate() {
+
+ // format is wdy, DD-Mon-yyyy HH:mm:ss GMT
+ int arrayLen =
+ isGMT ? gmtStandardFormats.length : standardFormats.length;
+
+ for (int i = 0; i < arrayLen; i++) {
+ Date d;
+
+ if (isGMT) {
+ d = tryParsing(gmtStandardFormats[i]);
+ } else {
+ d = tryParsing(standardFormats[i]);
+ }
+
+ if (d != null) {
+ return d;
+ }
+ }
+
+ return null;
+ }
+
+ private Date tryParsing(String format) {
+
+ SimpleDateFormat df = new SimpleDateFormat(format, Locale.US);
+
+ if (isGMT) {
+ df.setTimeZone(TimeZone.getTimeZone("GMT"));
+ }
+
+ try {
+ return df.parse(dateString);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/client/RfcDateParser.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/servlet/RuntimeEndpointInfoParser.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/servlet/RuntimeEndpointInfoParser.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/servlet/RuntimeEndpointInfoParser.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,352 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.transport.http.servlet;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Logger;
+import java.util.logging.Level;
+import javax.jws.WebService;
+
+import javax.xml.namespace.QName;
+
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.WebServiceProvider;
+import javax.xml.ws.http.HTTPBinding;
+import javax.xml.ws.soap.SOAPBinding;
+
+import org.jboss.com.sun.xml.ws.binding.BindingImpl;
+import org.jboss.com.sun.xml.ws.binding.soap.SOAPBindingImpl;
+import org.jboss.com.sun.xml.ws.handler.HandlerChainsModel;
+import org.jboss.com.sun.xml.ws.modeler.RuntimeModeler;
+import org.jboss.com.sun.xml.ws.server.RuntimeEndpointInfo;
+import org.jboss.com.sun.xml.ws.server.ServerRtException;
+import org.jboss.com.sun.xml.ws.spi.runtime.Binding;
+import org.jboss.com.sun.xml.ws.streaming.Attributes;
+import org.jboss.com.sun.xml.ws.streaming.XMLStreamReaderFactory;
+import org.jboss.com.sun.xml.ws.streaming.XMLStreamReaderUtil;
+import org.jboss.com.sun.xml.ws.util.HandlerAnnotationInfo;
+
+
+/**
+ * @author WS Development Team
+ */
+public class RuntimeEndpointInfoParser {
+
+ public RuntimeEndpointInfoParser(ClassLoader cl) {
+ classLoader = cl;
+ }
+
+ public List<RuntimeEndpointInfo> parse(InputStream is) {
+ XMLStreamReader reader = null;
+ try {
+ reader =
+ XMLStreamReaderFactory.createXMLStreamReader(is, true);
+ XMLStreamReaderUtil.nextElementContent(reader);
+ return parseEndpoints(reader);
+ } finally {
+ if (reader != null) {
+ try {
+ reader.close();
+ } catch (XMLStreamException e) {
+ throw new ServerRtException("runtime.parser.xmlReader",
e);
+ }
+ }
+ }
+ }
+
+ protected List<RuntimeEndpointInfo> parseEndpoints(XMLStreamReader reader) {
+ if (!reader.getName().equals(QNAME_ENDPOINTS)) {
+ failWithFullName("runtime.parser.invalidElement", reader);
+ }
+
+ List<RuntimeEndpointInfo> endpoints = new ArrayList();
+
+ Attributes attrs = XMLStreamReaderUtil.getAttributes(reader);
+ String version = getMandatoryNonEmptyAttribute(reader, attrs, ATTR_VERSION);
+ if (!version.equals(ATTRVALUE_VERSION_1_0)) {
+ failWithLocalName("runtime.parser.invalidVersionNumber",
+ reader, version);
+ }
+
+ while (XMLStreamReaderUtil.nextElementContent(reader) !=
+ XMLStreamConstants.END_ELEMENT) {
+ if (reader.getName().equals(QNAME_ENDPOINT)) {
+ RuntimeEndpointInfo rei = new RuntimeEndpointInfo();
+ attrs = XMLStreamReaderUtil.getAttributes(reader);
+ rei.setName(getMandatoryNonEmptyAttribute(reader, attrs, ATTR_NAME));
+ String implementationName =
+ getMandatoryNonEmptyAttribute(reader, attrs, ATTR_IMPLEMENTATION);
+ Class implementorClass = getImplementorClass(implementationName);
+ rei.setImplementorClass(implementorClass);
+ rei.setImplementor(getImplementor(implementorClass));
+ rei.verifyImplementorClass();
+
+ String wsdlFile = processWsdlLocation(attrs, rei);
+ rei.setWSDLFileName(wsdlFile);
+ rei.setServiceName(getQNameAttribute(attrs, ATTR_SERVICE));
+ rei.doServiceNameProcessing();
+ rei.setPortName(getQNameAttribute(attrs, ATTR_PORT));
+ rei.doPortNameProcessing();
+ //set Binding using DD, annotation, or default one(in that order)
+ String bindingId = getAttribute(attrs, ATTR_BINDING);
+ Binding binding = BindingImpl.getBinding(bindingId,
+ implementorClass, rei.getServiceName(), true);
+ rei.setBinding(binding);
+
+ //get enable-mtom attribute value
+ String mtom = getAttribute(attrs, ATTR_ENABLE_MTOM);
+
+ String mtomThreshold = getAttribute(attrs, ATTR_MTOM_THRESHOLD_VALUE);
+ if(mtomThreshold != null){
+ int mtomThresholdValue = Integer.valueOf(mtomThreshold);
+ rei.setMtomThreshold(mtomThresholdValue);
+ }
+
+ if(rei.getBinding() instanceof SOAPBindingImpl){
+ SOAPBinding sb = (SOAPBinding)rei.getBinding();
+ if (mtom != null) {
+ sb.setMTOMEnabled(Boolean.valueOf(mtom));
+ }
+ }
+
+ rei.setUrlPattern(
+ getMandatoryNonEmptyAttribute(reader, attrs, ATTR_URL_PATTERN));
+ setHandlersAndRoles(rei, reader);
+ ensureNoContent(reader);
+ endpoints.add(rei);
+ } else {
+ failWithLocalName("runtime.parser.invalidElement", reader);
+ }
+ }
+ return endpoints;
+ }
+
+ private String processWsdlLocation(Attributes attrs, RuntimeEndpointInfo rei) {
+ String wsdlFile = getAttribute(attrs, ATTR_WSDL);
+ if (wsdlFile == null) {
+ wsdlFile = rei.getWsdlLocation();
+ }
+ if (wsdlFile != null) {
+ if (!wsdlFile.startsWith(WSServletContextListener.JAXWS_WSDL_DD_DIR)) {
+ throw new
ServerRtException("runtime.parser.wrong.wsdl.location", wsdlFile);
+ }
+ }
+ if (wsdlFile == null) {
+ logger.info("wsdl cannot be found from DD or annotation. Will generate
and publish a new WSDL for SEI endpoints.");
+ }
+ return wsdlFile;
+ }
+
+ protected String getAttribute(Attributes attrs, String name) {
+ String value = attrs.getValue(name);
+ if (value != null) {
+ value = value.trim();
+ }
+ return value;
+ }
+
+ protected QName getQNameAttribute(Attributes attrs, String name) {
+ String value = getAttribute(attrs, name);
+ if (value == null || value.equals("")) {
+ return null;
+ } else {
+ return QName.valueOf(value);
+ }
+ }
+
+ protected String getNonEmptyAttribute(XMLStreamReader reader, Attributes attrs,
String name) {
+ String value = getAttribute(attrs, name);
+ if (value != null && value.equals("")) {
+ failWithLocalName(
+ "runtime.parser.invalidAttributeValue",
+ reader,
+ name);
+ }
+ return value;
+ }
+
+ protected String getMandatoryAttribute(XMLStreamReader reader, Attributes attrs,
String name) {
+ String value = getAttribute(attrs, name);
+ if (value == null) {
+ failWithLocalName("runtime.parser.missing.attribute", reader,
name);
+ }
+ return value;
+ }
+
+ protected String getMandatoryNonEmptyAttribute(XMLStreamReader reader, Attributes
attributes,
+ String name) {
+ String value = getAttribute(attributes, name);
+ if (value == null) {
+ failWithLocalName("runtime.parser.missing.attribute", reader,
name);
+ } else if (value.equals("")) {
+ failWithLocalName(
+ "runtime.parser.invalidAttributeValue",
+ reader,
+ name);
+ }
+ return value;
+ }
+
+ /*
+ * Parses the handler and role information and sets it
+ * on the RuntimeEndpointInfo.
+ */
+ protected void setHandlersAndRoles(RuntimeEndpointInfo rei,
+ XMLStreamReader reader) {
+
+ if (XMLStreamReaderUtil.nextElementContent(reader) ==
+ XMLStreamConstants.END_ELEMENT ||
+ !reader.getName().equals(
+ HandlerChainsModel.QNAME_HANDLER_CHAINS)) {
+
+ return;
+ }
+
+ QName serviceName = rei.getServiceName();
+ HandlerAnnotationInfo handlerInfo =
+ HandlerChainsModel.parseHandlerFile(reader, classLoader,
+ serviceName, rei.getPortName(),
+ ((BindingImpl) rei.getBinding()).getActualBindingId());
+
+ rei.getBinding().setHandlerChain(handlerInfo.getHandlers());
+ if (rei.getBinding() instanceof SOAPBinding) {
+ ((SOAPBinding) rei.getBinding()).setRoles(handlerInfo.getRoles());
+ }
+
+ // move past </handler-chains>
+ XMLStreamReaderUtil.nextContent(reader);
+ }
+
+ protected static void ensureNoContent(XMLStreamReader reader) {
+ if (reader.getEventType() != XMLStreamConstants.END_ELEMENT) {
+ fail("runtime.parser.unexpectedContent", reader);
+ }
+ }
+
+ protected static void fail(String key, XMLStreamReader reader) {
+ logger.log(Level.SEVERE, key + reader.getLocation().getLineNumber());
+ throw new ServerRtException(
+ key,
+ Integer.toString(reader.getLocation().getLineNumber()));
+ }
+
+ protected static void failWithFullName(String key, XMLStreamReader reader) {
+ throw new ServerRtException(
+ key,
+ new Object[] {
+ Integer.toString(reader.getLocation().getLineNumber()),
+ reader.getName().toString()});
+ }
+
+ protected static void failWithLocalName(String key, XMLStreamReader reader) {
+ throw new ServerRtException(
+ key,
+ new Object[] {
+ Integer.toString(reader.getLocation().getLineNumber()),
+ reader.getLocalName()});
+ }
+
+ protected static void failWithLocalName(
+ String key,
+ XMLStreamReader reader,
+ String arg) {
+ throw new ServerRtException(
+ key,
+ new Object[] {
+ Integer.toString(reader.getLocation().getLineNumber()),
+ reader.getLocalName(),
+ arg });
+ }
+
+ protected Class loadClass(String name) {
+ try {
+ return Class.forName(name, true, classLoader);
+ } catch (ClassNotFoundException e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ throw new ServerRtException(
+ "runtime.parser.classNotFound",
+ name);
+ }
+ }
+
+ /*
+ * Gets endpoint implementation class
+ */
+ protected Class getImplementorClass(String name) {
+ try {
+ return Class.forName(name, true, classLoader);
+ } catch (ClassNotFoundException e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ throw new ServerRtException(
+ "runtime.parser.classNotFound", name);
+ }
+ }
+
+ /*
+ * Instantiates endpoint implementation
+ */
+ protected Object getImplementor(Class cl) {
+ try {
+ return cl.newInstance();
+ } catch (InstantiationException e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ throw new ServerRtException(
+ "error.implementorFactory.newInstanceFailed", cl.getName());
+ } catch (IllegalAccessException e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ throw new ServerRtException(
+ "error.implementorFactory.newInstanceFailed", cl.getName());
+ }
+ }
+
+ protected ClassLoader classLoader;
+
+ public static final String NS_RUNTIME =
+ "http://java.sun.com/xml/ns/jax-ws/ri/runtime";
+
+ public static final QName QNAME_ENDPOINTS =
+ new QName(NS_RUNTIME, "endpoints");
+ public static final QName QNAME_ENDPOINT =
+ new QName(NS_RUNTIME, "endpoint");
+
+ public static final String ATTR_VERSION = "version";
+ public static final String ATTR_NAME = "name";
+ public static final String ATTR_IMPLEMENTATION = "implementation";
+ public static final String ATTR_WSDL = "wsdl";
+ public static final String ATTR_SERVICE = "service";
+ public static final String ATTR_PORT = "port";
+ public static final String ATTR_URL_PATTERN = "url-pattern";
+ public static final String ATTR_ENABLE_MTOM = "enable-mtom";
+ public static final String ATTR_MTOM_THRESHOLD_VALUE =
"mtom-threshold-value";
+ public static final String ATTR_BINDING = "binding";
+
+ public static final String ATTRVALUE_VERSION_1_0 = "2.0";
+ private static final Logger logger =
+ Logger.getLogger(
+ org.jboss.com.sun.xml.ws.util.Constants.LoggingDomain +
".server.http");
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/servlet/RuntimeEndpointInfoParser.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/servlet/ServletConnectionImpl.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/servlet/ServletConnectionImpl.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/servlet/ServletConnectionImpl.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,136 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.transport.http.servlet;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.com.sun.xml.ws.transport.Headers;
+import org.jboss.com.sun.xml.ws.transport.WSConnectionImpl;
+
+import java.net.HttpURLConnection;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <code>org.jboss.com.sun.xml.ws.spi.runtime.WSConnection</code> used by
+ * WSServletDelegate, uses
<code>javax.servlet.http.HttpServletRequest</code>
+ * and <code>javax.servlet.http.HttpServletResponse</code>
+ *
+ * @author WS Development Team
+ */
+public class ServletConnectionImpl extends WSConnectionImpl {
+
+ private HttpServletRequest request;
+ private HttpServletResponse response;
+ private int status;
+ private Map<String,List<String>> requestHeaders;
+ private Map<String,List<String>> responseHeaders;
+
+ public ServletConnectionImpl(HttpServletRequest request,
+ HttpServletResponse response) {
+ this.request = request;
+ this.response = response;
+ }
+
+ @Override
+ public Map<String,List<String>> getHeaders() {
+ if (requestHeaders == null) {
+ requestHeaders = new Headers();
+ Enumeration enums = request.getHeaderNames();
+ while (enums.hasMoreElements()) {
+ String headerName = (String) enums.nextElement();
+ String headerValue = request.getHeader(headerName);
+ List<String> values = requestHeaders.get(headerName);
+ if (values == null) {
+ values = new ArrayList<String>();
+ requestHeaders.put(headerName, values);
+ }
+ values.add(headerValue);
+ }
+ }
+ return requestHeaders;
+ }
+
+ /**
+ * sets response headers.
+ */
+ @Override
+ public void setHeaders(Map<String,List<String>> headers) {
+ responseHeaders = headers;
+ }
+
+ @Override
+ public void setStatus(int status) {
+ this.status = status;
+ }
+
+ /**
+ * sets HTTP status code
+ */
+ @Override
+ public int getStatus() {
+ if (status == 0) {
+ status = HttpURLConnection.HTTP_OK;
+ }
+ return status;
+ }
+
+ @Override
+ public InputStream getInput() {
+ try {
+ return request.getInputStream();
+ } catch(IOException ioe) {
+ ioe.printStackTrace();
+ }
+ return null;
+ }
+
+ @Override
+ public OutputStream getOutput() {
+ // write HTTP status code, and headers
+ response.setStatus(getStatus());
+ if (responseHeaders != null) {
+ for(Map.Entry <String, List<String>> entry :
responseHeaders.entrySet()) {
+ String name = entry.getKey();
+ List<String> values = entry.getValue();
+ for(String value : values) {
+ response.setHeader(name, value);
+ }
+ }
+ }
+ try {
+ outputStream = response.getOutputStream();
+ return outputStream;
+ } catch(IOException ioe) {
+ ioe.printStackTrace();
+ }
+ return null;
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/servlet/ServletConnectionImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/servlet/ServletDocInfo.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/servlet/ServletDocInfo.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/servlet/ServletDocInfo.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,101 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.transport.http.servlet;
+
+import java.io.InputStream;
+import java.net.URL;
+import javax.servlet.ServletContext;
+
+import org.jboss.com.sun.xml.ws.server.DocInfo;
+import org.jboss.com.sun.xml.ws.wsdl.parser.Service;
+
+public class ServletDocInfo implements DocInfo {
+ private ServletContext context;
+ private String resource;
+ private String queryString;
+ private DOC_TYPE docType;
+ private Service service;
+ private boolean hasPortType;
+ private String tns;
+
+ public ServletDocInfo(ServletContext context, String resource) {
+ this.context = context;
+ this.resource = resource;
+ }
+
+ public InputStream getDoc() {
+ return context.getResourceAsStream(resource);
+ }
+
+ public String getPath() {
+ return resource;
+ }
+
+ public URL getUrl() {
+ try {
+ return context.getResource(resource);
+ } catch(Exception e) {
+ return null;
+ }
+ }
+
+ public String getQueryString() {
+ return queryString;
+ }
+
+ public void setQueryString(String queryString) {
+ this.queryString = queryString;
+ }
+
+ public void setDocType(DOC_TYPE docType) {
+ this.docType = docType;
+ }
+
+ public DOC_TYPE getDocType() {
+ return docType;
+ }
+
+ public void setTargetNamespace(String ns) {
+ this.tns = ns;
+ }
+
+ public String getTargetNamespace() {
+ return tns;
+ }
+
+ public void setService(Service service) {
+ this.service = service;
+ }
+
+ public Service getService() {
+ return service;
+ }
+
+ public void setHavingPortType(boolean portType) {
+ this.hasPortType = portType;
+ }
+
+ public boolean isHavingPortType() {
+ return hasPortType;
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/servlet/ServletDocInfo.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/servlet/WSServlet.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/servlet/WSServlet.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/servlet/WSServlet.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,127 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.transport.http.servlet;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.com.sun.xml.ws.util.localization.LocalizableMessageFactory;
+import org.jboss.com.sun.xml.ws.util.localization.Localizer;
+
+
+/**
+ * The JAX-WS dispatcher servlet.
+ *
+ * @author WS Development Team
+ */
+public class WSServlet extends HttpServlet {
+
+ public void init(ServletConfig servletConfig) throws ServletException {
+ super.init(servletConfig);
+
+ localizer = new Localizer();
+ messageFactory =
+ new
LocalizableMessageFactory("org.jboss.com.sun.xml.ws.resources.wsservlet");
+
+ try {
+ delegate = new WSServletDelegate();
+ delegate.init(servletConfig);
+ } catch (ServletException e) {
+ logger.log(Level.SEVERE,e.getMessage(), e);
+ throw e;
+ } catch (Throwable e) {
+ String message =
+ localizer.localize(
+ messageFactory.getMessage(
+ "error.servlet.caughtThrowableInInit",
+ new Object[] { e }));
+ logger.log(Level.SEVERE, message, e);
+ throw new ServletException(message);
+ }
+ }
+
+ public void destroy() {
+ if (delegate != null) {
+ delegate.destroy();
+ }
+ }
+
+ protected void doPost(
+ HttpServletRequest request,
+ HttpServletResponse response)
+ throws ServletException {
+ if (delegate != null) {
+ delegate.doPost(request, response);
+ }
+ }
+
+ protected void doGet(
+ HttpServletRequest request,
+ HttpServletResponse response)
+ throws ServletException {
+ if (delegate != null) {
+ delegate.doGet(request, response);
+ }
+ }
+
+ protected void doPut(
+ HttpServletRequest request,
+ HttpServletResponse response)
+ throws ServletException {
+ if (delegate != null) {
+ delegate.doPut(request, response);
+ }
+ }
+
+ protected void doDelete(
+ HttpServletRequest request,
+ HttpServletResponse response)
+ throws ServletException {
+ if (delegate != null) {
+ delegate.doDelete(request, response);
+ }
+ }
+
+
+
+ protected WSServletDelegate delegate = null;
+ private LocalizableMessageFactory messageFactory;
+ private Localizer localizer;
+
+ public static final String JAXWS_RI_RUNTIME_INFO =
+ "org.jboss.com.sun.xml.ws.server.http.info";
+ public static final String JAXWS_RI_PROPERTY_PUBLISH_WSDL =
+ "org.jboss.com.sun.xml.ws.server.http.publishWSDL";
+ public static final String JAXWS_RI_PROPERTY_PUBLISH_STATUS_PAGE =
+ "org.jboss.com.sun.xml.ws.server.http.publishStatusPage";
+
+ private static final Logger logger =
+ Logger.getLogger(
+ org.jboss.com.sun.xml.ws.util.Constants.LoggingDomain +
".server.http");
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/servlet/WSServlet.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/servlet/WSServletContextListener.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/servlet/WSServletContextListener.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/servlet/WSServletContextListener.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,231 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.transport.http.servlet;
+import java.io.InputStream;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextAttributeEvent;
+import javax.servlet.ServletContextAttributeListener;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLEncoder;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import org.jboss.com.sun.xml.ws.server.DocInfo;
+import org.jboss.com.sun.xml.ws.server.RuntimeEndpointInfo;
+import org.jboss.com.sun.xml.ws.server.ServerRtException;
+import org.jboss.com.sun.xml.ws.server.WSDLPatcher;
+import org.jboss.com.sun.xml.ws.server.DocInfo.DOC_TYPE;
+import org.jboss.com.sun.xml.ws.spi.runtime.WebServiceContext;
+import org.jboss.com.sun.xml.ws.util.localization.LocalizableMessageFactory;
+import org.jboss.com.sun.xml.ws.util.localization.Localizer;
+import org.jboss.com.sun.xml.ws.util.xml.XmlUtil;
+import org.xml.sax.EntityResolver;
+
+
+/**
+ * Parses sun-jaxws.xml and creates a <code>java.util.List</code> of
+ * RuntimeEndpointInfos. It also calls deploy() on each RuntimeEndpointInfo.
+ *
+ * @author WS Development Team
+ */
+public class WSServletContextListener
+ implements ServletContextAttributeListener, ServletContextListener {
+
+ /**
+ * default contructor
+ */
+ public WSServletContextListener() {
+ localizer = new Localizer();
+ messageFactory =
+ new
LocalizableMessageFactory("org.jboss.com.sun.xml.ws.resources.wsservlet");
+ }
+
+ public void attributeAdded(ServletContextAttributeEvent event) {
+ }
+
+ public void attributeRemoved(ServletContextAttributeEvent event) {
+ }
+
+ public void attributeReplaced(ServletContextAttributeEvent event) {
+ }
+
+ public void contextDestroyed(ServletContextEvent event) {
+ context = null;
+ if (logger.isLoggable(Level.INFO)) {
+ logger.info(
+ localizer.localize(
+ messageFactory.getMessage("listener.info.destroy")));
+ }
+ }
+
+ public void contextInitialized(ServletContextEvent event) {
+ if (logger.isLoggable(Level.INFO)) {
+ logger.info(
+ localizer.localize(
+ messageFactory.getMessage("listener.info.initialize")));
+ }
+ context = event.getServletContext();
+ classLoader = Thread.currentThread().getContextClassLoader();
+ if (classLoader == null) {
+ classLoader = getClass().getClassLoader();
+ }
+ try {
+
+
+ // Parse the descriptor file and build endpoint infos
+ RuntimeEndpointInfoParser parser =
+ new RuntimeEndpointInfoParser(classLoader);
+ InputStream is = context.getResourceAsStream(JAXWS_RI_RUNTIME);
+ List<RuntimeEndpointInfo> endpoints = parser.parse(is);
+ is.close();
+ context.setAttribute(WSServlet.JAXWS_RI_RUNTIME_INFO, endpoints);
+
+ // Create WebServiceContext
+ createWebServiceContext(endpoints);
+
+ // Creates WSDL & schema metadata and runtime model
+ createModelAndMetadata(endpoints);
+
+ } catch (Exception e) {
+ logger.log(
+ Level.SEVERE,
+ localizer.localize(
+ messageFactory.getMessage(
+ "listener.parsingFailed",
+ e.toString())),
+ e);
+ context.removeAttribute(WSServlet.JAXWS_RI_RUNTIME_INFO);
+ throw new WSServletException("listener.parsingFailed", new Object[]
{e});
+ }
+ }
+
+ /*
+ * Get all the WSDL & schema documents under WEB-INF/wsdl directory
+ */
+ private static void collectDocs(ServletContext context, String dirPath,
+ Map<String, DocInfo> docs) throws MalformedURLException {
+ Set paths = context.getResourcePaths(dirPath);
+ if (paths != null) {
+ Iterator i = paths.iterator();
+ while(i.hasNext()) {
+ String docPath = (String)i.next();
+ if (docPath.endsWith("/")) {
+ collectDocs(context, docPath, docs);
+ } else {
+ docs.put(context.getResource(docPath).toString(), new
ServletDocInfo(context, docPath));
+ }
+ }
+ }
+ }
+
+ /*
+ * Setting the WebServiceContext for each endpoint. WebServiceContextImpl
+ * contains servlet specific code, hence the initialization is done here
+ * (instead of doing in RuntimeEndpointInfoParser)
+ */
+ private void createWebServiceContext(List<RuntimeEndpointInfo> endpoints) {
+
+ for(RuntimeEndpointInfo endpoint : endpoints) {
+ WebServiceContext wsContext = new WebServiceContextImpl();
+ endpoint.setWebServiceContext(wsContext);
+ }
+ }
+
+ /*
+ * updates metadata with query string and builds runtime model for each
+ * endpoint
+ */
+ private void createModelAndMetadata(List<RuntimeEndpointInfo> endpoints)
throws Exception {
+ URL catalogUrl = null;
+ try {
+ catalogUrl = context.getResource("/WEB-INF/jax-ws-catalog.xml");
+ } catch(java.net.MalformedURLException e) {
+ e.printStackTrace();
+ }
+ EntityResolver entityResolver = XmlUtil.createEntityResolver(catalogUrl);
+
+ for(RuntimeEndpointInfo endpoint : endpoints) {
+ // Get all the WSDL & schema documents under WEB-INF/wsdl directory
+ Map<String, DocInfo> docs = new HashMap<String, DocInfo>();
+ collectDocs(context, JAXWS_WSDL_DIR, docs);
+ logger.fine("Endpoint metadata="+docs);
+
+ String wsdlFile = endpoint.getWSDLFileName();
+ if (wsdlFile != null) {
+ try {
+ wsdlFile = "/"+wsdlFile;
+ URL wsdlUrl = context.getResource(wsdlFile);
+ if (wsdlUrl == null) {
+ throw new ServerRtException("cannot.load.wsdl",
wsdlFile);
+ }
+ endpoint.setWsdlInfo(wsdlUrl, entityResolver);
+ } catch(java.net.MalformedURLException e) {
+ throw new ServerRtException("cannot.load.wsdl", wsdlFile);
+ }
+ }
+
+ endpoint.init();
+ if (endpoint.needWSDLGeneration()) {
+ endpoint.generateWSDL();
+ } else {
+ endpoint.setMetadata(docs);
+ if (endpoint.getWsdlUrl() != null) {
+ docs = endpoint.getDocMetadata();
+ DocInfo wsdlDoc = docs.get(endpoint.getWsdlUrl().toString());
+ if (wsdlDoc != null) {
+ wsdlDoc.setQueryString("wsdl");
+ }
+ }
+ RuntimeEndpointInfo.fillDocInfo(endpoint);
+ }
+ RuntimeEndpointInfo.publishWSDLDocs(endpoint);
+ }
+ }
+
+ private Localizer localizer;
+ private LocalizableMessageFactory messageFactory;
+ private ServletContext context;
+ private ClassLoader classLoader;
+
+ private static final String JAXWS_RI_RUNTIME = "/WEB-INF/sun-jaxws.xml";
+ public static final String JAXWS_WSDL_DIR = "/WEB-INF/wsdl";
+ public static final String JAXWS_WSDL_DD_DIR = "WEB-INF/wsdl";
+
+ private static final Logger logger =
+ Logger.getLogger(
+ org.jboss.com.sun.xml.ws.util.Constants.LoggingDomain +
".server.http");
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/servlet/WSServletContextListener.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/servlet/WSServletDelegate.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/servlet/WSServletDelegate.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/servlet/WSServletDelegate.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,645 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.transport.http.servlet;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.namespace.QName;
+import javax.xml.soap.MimeHeaders;
+
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.MessageContext.Scope;
+import javax.xml.ws.http.HTTPBinding;
+
+import org.jboss.com.sun.xml.ws.binding.BindingImpl;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPConstants;
+import org.jboss.com.sun.xml.ws.handler.MessageContextImpl;
+import org.jboss.com.sun.xml.ws.handler.MessageContextUtil;
+import org.jboss.com.sun.xml.ws.server.RuntimeEndpointInfo;
+import org.jboss.com.sun.xml.ws.server.WSDLPublisher;
+import org.jboss.com.sun.xml.ws.spi.runtime.WSConnection;
+import org.jboss.com.sun.xml.ws.spi.runtime.WebServiceContext;
+import org.jboss.com.sun.xml.ws.util.exception.JAXWSExceptionBase;
+import org.jboss.com.sun.xml.ws.util.localization.Localizable;
+import org.jboss.com.sun.xml.ws.util.localization.LocalizableMessageFactory;
+import org.jboss.com.sun.xml.ws.util.localization.Localizer;
+
+/**
+ * Servlet for WS invocations
+ *
+ * @author WS Development Team
+ */
+public class WSServletDelegate {
+
+ private org.jboss.com.sun.xml.ws.server.Tie tie =
+ new org.jboss.com.sun.xml.ws.server.Tie();
+
+ public void init(ServletConfig servletConfig)
+ throws ServletException {
+
+ defaultLocalizer = new Localizer();
+ localizerMap = new HashMap();
+ localizerMap.put(defaultLocalizer.getLocale(), defaultLocalizer);
+ messageFactory =
+ new
LocalizableMessageFactory("org.jboss.com.sun.xml.ws.resources.wsservlet");
+
+ this.servletContext = servletConfig.getServletContext();
+
+ if (logger.isLoggable(Level.INFO)) {
+ logger.info(
+ defaultLocalizer.localize(
+ messageFactory.getMessage("servlet.info.initialize")));
+ }
+
+ fixedUrlPatternEndpoints = new HashMap();
+ pathUrlPatternEndpoints = new ArrayList();
+
+ jaxwsInfo =
+ (List<RuntimeEndpointInfo>) servletContext.getAttribute(
+ WSServlet.JAXWS_RI_RUNTIME_INFO);
+ if (jaxwsInfo == null) {
+ warnMissingContextInformation();
+ } else {
+ Map endpointsByName = new HashMap();
+ for(RuntimeEndpointInfo info : jaxwsInfo) {
+ if (endpointsByName.containsKey(info.getName())) {
+ logger.warning(
+ defaultLocalizer.localize(
+ messageFactory.getMessage(
+ "servlet.warning.duplicateEndpointName",
+ info.getName())));
+ } else {
+ endpointsByName.put(info.getName(), info);
+ registerEndpointUrlPattern(info);
+
+ try {
+ info.injectContext();
+ info.beginService();
+ } catch(Exception e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ throw new ServletException(e.getMessage());
+ }
+ }
+ }
+ }
+
+ String publishWSDLParam =
+ servletContext.getInitParameter(
+ WSServlet.JAXWS_RI_PROPERTY_PUBLISH_WSDL);
+ publishWSDL =
+ (publishWSDLParam == null
+ ? true
+ : Boolean.valueOf(publishWSDLParam).booleanValue());
+
+ String publishStatusPageParam =
+ servletContext.getInitParameter(
+ WSServlet.JAXWS_RI_PROPERTY_PUBLISH_STATUS_PAGE);
+ publishStatusPage =
+ (publishStatusPageParam == null
+ ? true
+ : Boolean.valueOf(publishStatusPageParam).booleanValue());
+
+ publisher = new WSDLPublisher(servletContext, jaxwsInfo);
+
+ }
+
+ public void destroy() {
+ if (logger.isLoggable(Level.INFO)) {
+ logger.info(
+ defaultLocalizer.localize(
+ messageFactory.getMessage("servlet.info.destroy")));
+ }
+ if (jaxwsInfo != null) {
+ for(RuntimeEndpointInfo info : jaxwsInfo) {
+ try {
+ info.endService();
+ } catch(Exception e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ }
+ }
+ }
+ }
+
+ public void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException {
+
+ try {
+ /*
+ Localizer localizer = getLocalizerFor(request);
+
+ MimeHeaders headers = getHeaders(request);
+
+ if (checkForContent(headers)) {
+ writeInvalidMethodType(
+ localizer,
+ response,
+ "Invalid Method Type");
+ if (logger.isLoggable(Level.INFO)) {
+ logger.severe(
+ defaultLocalizer.localize(
+
messageFactory.getMessage("servlet.html.method")));
+ logger.severe("Must use Http POST for the service
request");
+ }
+ return;
+ }
+ */
+ RuntimeEndpointInfo targetEndpoint = getEndpointFor(request);
+ if (targetEndpoint != null) {
+ String query = request.getQueryString();
+ if (query != null && (query.equals("WSDL") ||
query.startsWith("wsdl")
+ || query.startsWith("xsd="))) {
+ // Sends published WSDL and schema documents
+ publisher.handle(targetEndpoint, fixedUrlPatternEndpoints,
+ request, response);
+ return;
+ }
+ BindingImpl binding = (BindingImpl)targetEndpoint.getBinding();
+ if (binding.getBindingId().equals(HTTPBinding.HTTP_BINDING)) {
+ // The request is handled by endpoint or runtime
+ handle(request, response, targetEndpoint);
+ } else {
+ // Writes HTML page with all the endpoint descriptions
+ writeWebServicesHtmlPage(request, response);
+ }
+ } else {
+ Localizer localizer = getLocalizerFor(request);
+ writeNotFoundErrorPage(localizer, response, "Invalid
Request");
+ }
+ } catch (Exception e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ throw new ServletException(e.getMessage());
+ }
+ }
+
+
+ /**
+ * Handles HTTP PUT for XML/HTTP binding based endpoints
+ */
+ public void doPut(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException {
+
+ try {
+ RuntimeEndpointInfo targetEndpoint = getEndpointFor(request);
+ if (targetEndpoint != null) {
+ if (logger.isLoggable(Level.FINEST)) {
+ logger.finest(defaultLocalizer.localize(
+ messageFactory.getMessage(
+ "servlet.trace.gotRequestForEndpoint",
+ targetEndpoint.getName())));
+ }
+ } else {
+ Localizer localizer = getLocalizerFor(request);
+ writeNotFoundErrorPage(localizer, response, "Invalid
request");
+ return;
+ }
+ BindingImpl binding = (BindingImpl)targetEndpoint.getBinding();
+ if (binding.getBindingId().equals(HTTPBinding.HTTP_BINDING)) {
+ handle(request, response, targetEndpoint);
+ } else {
+ response.setStatus(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
+ }
+ } catch (JAXWSExceptionBase e) {
+ logger.log(Level.SEVERE, defaultLocalizer.localize(e), e);
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ } catch (Throwable e) {
+ if (e instanceof Localizable) {
+ logger.log(
+ Level.SEVERE,
+ defaultLocalizer.localize((Localizable) e),
+ e);
+ } else {
+ logger.log(Level.SEVERE, "caught throwable", e);
+ }
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ }
+
+ }
+
+ /**
+ * Handles HTTP DELETE for XML/HTTP binding based endpoints
+ */
+ public void doDelete(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException {
+
+ // At preseent, there is no difference for between PUT and DELETE processing
+ doPut(request, response);
+ }
+
+
+ /**
+ * processes web service requests by finding the
<code>RuntimeEndpointInfo</code>
+ * created by the <code>WSContextListener</code> and creating a
+ * <code>ServletConnectionImpl</code> and passing it to
<code>Tie.handle</code>
+ * @param request the HTTP request object
+ * @param response the HTTP response object
+ * @throws javax.servlet.ServletException
+ */
+ public void doPost(
+ HttpServletRequest request,
+ HttpServletResponse response)
+ throws ServletException {
+
+ try {
+ RuntimeEndpointInfo targetEndpoint = getEndpointFor(request);
+ if (targetEndpoint != null) {
+ if (logger.isLoggable(Level.FINEST)) {
+ logger.finest(defaultLocalizer.localize(
+ messageFactory.getMessage(
+ "servlet.trace.gotRequestForEndpoint",
+ targetEndpoint.getName())));
+ }
+ } else {
+ Localizer localizer = getLocalizerFor(request);
+ writeNotFoundErrorPage(localizer, response, "Invalid
request");
+ return;
+ }
+ handle(request, response, targetEndpoint);
+ } catch (JAXWSExceptionBase e) {
+ logger.log(Level.SEVERE, defaultLocalizer.localize(e), e);
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ } catch (Throwable e) {
+ if (e instanceof Localizable) {
+ logger.log(
+ Level.SEVERE,
+ defaultLocalizer.localize((Localizable) e),
+ e);
+ } else {
+ logger.log(Level.SEVERE, "caught throwable", e);
+ }
+
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ }
+ }
+
+ /**
+ * Invokes JAXWS runtime with the correct MessageContext
+ */
+ private void handle(HttpServletRequest request, HttpServletResponse response,
+ RuntimeEndpointInfo targetEndpoint) throws Exception {
+
+ WebServiceContext wsCtxt = targetEndpoint.getWebServiceContext();
+ MessageContext msgCtxt = new MessageContextImpl();
+ wsCtxt.setMessageContext(msgCtxt);
+ msgCtxt.put(MessageContext.SERVLET_CONTEXT, servletContext);
+ msgCtxt.setScope(MessageContext.SERVLET_CONTEXT, Scope.APPLICATION);
+ msgCtxt.put(MessageContext.SERVLET_REQUEST, request);
+ msgCtxt.setScope(MessageContext.SERVLET_REQUEST, Scope.APPLICATION);
+ msgCtxt.put(MessageContext.SERVLET_RESPONSE, response);
+ msgCtxt.setScope(MessageContext.SERVLET_RESPONSE, Scope.APPLICATION);
+
+ MessageContextUtil.setHttpRequestMethod(msgCtxt, request.getMethod());
+ if (request.getQueryString() != null) {
+ MessageContextUtil.setQueryString(msgCtxt, request.getQueryString());
+ }
+ if (request.getPathInfo() != null) {
+ MessageContextUtil.setPathInfo(msgCtxt, request.getPathInfo());
+ }
+
+ WSConnection connection =
+ new ServletConnectionImpl(request, response);
+ MessageContextUtil.setHttpRequestHeaders(msgCtxt, connection.getHeaders());
+ tie.handle(connection, targetEndpoint);
+ }
+
+ protected void writeNotFoundErrorPage(
+ Localizer localizer,
+ HttpServletResponse response,
+ String message)
+ throws IOException {
+ response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ response.setContentType("text/html");
+ PrintWriter out = response.getWriter();
+ out.println("<html>");
+ out.println("<head><title>");
+ out.println(
+ localizer.localize(
+ messageFactory.getMessage("servlet.html.title")));
+ out.println("</title></head>");
+ out.println("<body>");
+ out.println(
+ localizer.localize(
+ messageFactory.getMessage("servlet.html.notFound", message)));
+ out.println("</body>");
+ out.println("</html>");
+ }
+
+ protected void writeInvalidMethodType(
+ Localizer localizer,
+ HttpServletResponse response,
+ String message)
+ throws IOException {
+ response.setStatus(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
+ response.setContentType("text/html");
+ PrintWriter out = response.getWriter();
+ out.println("<html>");
+ out.println("<head><title>");
+ out.println(
+ localizer.localize(
+ messageFactory.getMessage("servlet.html.title")));
+ out.println("</title></head>");
+ out.println("<body>");
+ out.println(
+ localizer.localize(
+ messageFactory.getMessage("servlet.html.method", message)));
+ out.println("</body>");
+ out.println("</html>");
+
+ }
+
+ protected void warnMissingContextInformation() {
+ logger.warning(
+ defaultLocalizer.localize(
+ messageFactory.getMessage(
+ "servlet.warning.missingContextInformation")));
+ }
+
+ protected static MimeHeaders getHeaders(HttpServletRequest req) {
+ Enumeration enums = req.getHeaderNames();
+ MimeHeaders headers = new MimeHeaders();
+
+ while (enums.hasMoreElements()) {
+ String headerName = (String) enums.nextElement();
+ String headerValue = req.getHeader(headerName);
+ headers.addHeader(headerName, headerValue);
+ }
+
+ return headers;
+ }
+
+ public void registerEndpointUrlPattern(
+ org.jboss.com.sun.xml.ws.spi.runtime.RuntimeEndpointInfo info) {
+ String urlPattern = ((RuntimeEndpointInfo) info).getUrlPattern();
+ if (urlPattern.indexOf("*.") != -1) {
+ // cannot deal with implicit mapping right now
+ logger.warning(
+ defaultLocalizer.localize(
+ messageFactory.getMessage(
+ "servlet.warning.ignoringImplicitUrlPattern",
+ ((RuntimeEndpointInfo) info).getName())));
+ } else if (urlPattern.endsWith("/*")) {
+ pathUrlPatternEndpoints.add(info);
+ } else {
+ if (fixedUrlPatternEndpoints.containsKey(urlPattern)) {
+ logger.warning(
+ defaultLocalizer.localize(
+ messageFactory.getMessage(
+ "servlet.warning.duplicateEndpointUrlPattern",
+ ((RuntimeEndpointInfo) info).getName())));
+ } else {
+ fixedUrlPatternEndpoints.put(urlPattern, info);
+ }
+ }
+ }
+
+ protected String getValidPathForEndpoint(RuntimeEndpointInfo info) {
+ String s = info.getUrlPattern();
+ if (s.endsWith("/*")) {
+ return s.substring(0, s.length() - 2);
+ } else {
+ return s;
+ }
+ }
+
+ protected RuntimeEndpointInfo getEndpointFor(HttpServletRequest request) {
+
+ /*System.err.println("----");
+ System.err.println("CONTEXT PATH : " + request.getContextPath());
+ System.err.println("PATH INFO : " + request.getPathInfo());
+ System.err.println("PATH TRANSLATED: " + request.getPathTranslated());
+ System.err.println("QUERY STRING : " + request.getQueryString());
+ System.err.println("REQUEST URI : " + request.getRequestURI());
+ System.err.println();
+ */
+
+ String path =
+ request.getRequestURI().substring(
+ request.getContextPath().length());
+ RuntimeEndpointInfo result =
+ (RuntimeEndpointInfo) fixedUrlPatternEndpoints.get(path);
+ if (result == null) {
+ for (Iterator iter = pathUrlPatternEndpoints.iterator();
+ iter.hasNext();
+ ) {
+ RuntimeEndpointInfo candidate =
+ (RuntimeEndpointInfo) iter.next();
+ String noSlashStar = getValidPathForEndpoint(candidate);
+ if (path.equals(noSlashStar) ||
path.startsWith(noSlashStar+"/") || path.startsWith(noSlashStar+"?"))
{
+ result = candidate;
+ break;
+ }
+ }
+ }
+
+ return result;
+ }
+
+ protected boolean checkContentType(MimeHeaders headers) {
+
+ String[] contentTypes = headers.getHeader("Content-Type");
+ if ((contentTypes != null) && (contentTypes.length >= 1)) {
+ if (contentTypes[0].indexOf("text/xml") != -1) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected boolean checkContentLength(MimeHeaders headers) {
+ String[] contentLength = headers.getHeader("Content-Length");
+ if ((contentLength != null) && (contentLength.length > 0)) {
+ int length = new Integer(contentLength[0]).intValue();
+ if (length > 0) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ boolean checkForContent(MimeHeaders headers) {
+ if (checkContentType(headers)) {
+ if (checkContentLength(headers))
+ return true;
+ }
+ return false;
+ }
+
+
+ protected Localizer getLocalizerFor(ServletRequest request) {
+ Locale locale = request.getLocale();
+ if (locale.equals(defaultLocalizer.getLocale())) {
+ return defaultLocalizer;
+ }
+
+ synchronized (localizerMap) {
+ Localizer localizer = (Localizer) localizerMap.get(locale);
+ if (localizer == null) {
+ localizer = new Localizer(locale);
+ localizerMap.put(locale, localizer);
+ }
+ return localizer;
+ }
+ }
+
+ protected QName getFaultServerQName(){
+ return SOAPConstants.FAULT_CODE_SERVER;
+ }
+
+ private void writeWebServicesHtmlPage(HttpServletRequest request,
+ HttpServletResponse response) throws IOException {
+
+ if (publishStatusPage) {
+ Localizer localizer = getLocalizerFor(request);
+
+ // standard browsable page
+ response.setStatus(HttpServletResponse.SC_OK);
+ response.setContentType("text/html");
+ PrintWriter out = response.getWriter();
+ out.println("<html>");
+ out.println("<head><title>");
+ // out.println("Web Services");
+ out.println(
+ localizer.localize(
+ messageFactory.getMessage("servlet.html.title")));
+ out.println("</title></head>");
+ out.println("<body>");
+ // out.println("<h1>Web Services</h1>");
+ out.println(
+ localizer.localize(
+ messageFactory.getMessage("servlet.html.title2")));
+ if (jaxwsInfo == null) {
+ // out.println("<p>No JAX-WS context information
available.</p>");
+ out.println(
+ localizer.localize(
+ messageFactory.getMessage(
+ "servlet.html.noInfoAvailable")));
+ } else {
+ out.println("<table width='100%'
border='1'>");
+ out.println("<tr>");
+ out.println("<td>");
+ // out.println("Port Name");
+ out.println(
+ localizer.localize(
+ messageFactory.getMessage(
+ "servlet.html.columnHeader.portName")));
+ out.println("</td>");
+ out.println("<td>");
+ // out.println("Status");
+ out.println(
+ localizer.localize(
+ messageFactory.getMessage(
+ "servlet.html.columnHeader.status")));
+ out.println("</td>");
+ out.println("<td>");
+ // out.println("Information");
+ out.println(
+ localizer.localize(
+ messageFactory.getMessage(
+ "servlet.html.columnHeader.information")));
+ out.println("</td>");
+ out.println("</tr>");
+ String baseAddress =
+ request.getScheme()
+ + "://"
+ + request.getServerName()
+ + ":"
+ + request.getServerPort()
+ + request.getContextPath();
+
+ for (RuntimeEndpointInfo info : jaxwsInfo) {
+ String endpointAddress =
+ baseAddress + getValidPathForEndpoint(info);
+ String wsdl = (info.getPath("wsdl") == null)
+ ? "NO WSDL PUBLISHED"
+ : endpointAddress+"?wsdl";
+ out.println("<tr>");
+ out.println("<td>" + info.getName() +
"</td>");
+ out.println("<td>");
+ if (info.isDeployed()) {
+ // out.println("ACTIVE");
+ out.println(
+ localizer.localize(
+ messageFactory.getMessage(
+ "servlet.html.status.active")));
+ } else {
+ // out.println("ERROR");
+ out.println(
+ localizer.localize(
+ messageFactory.getMessage(
+ "servlet.html.status.error")));
+ }
+ out.println("</td>");
+ out.println("<td>");
+ out.println(
+ localizer.localize(
+ messageFactory.getMessage(
+ "servlet.html.information.table",
+ new Object[] {
+ endpointAddress,
+ info.getPortName(),
+ info
+ .getImplementor()
+ .getClass()
+ .getName(),
+ wsdl})));
+
+ out.println("</td>");
+ out.println("</tr>");
+ }
+ out.println("</table>");
+ }
+ out.println("</body>");
+ out.println("</html>");
+ }
+ }
+
+ private ServletContext servletContext;
+ private List<RuntimeEndpointInfo> jaxwsInfo;
+ private Localizer defaultLocalizer;
+ private LocalizableMessageFactory messageFactory;
+ private Map fixedUrlPatternEndpoints;
+ private List pathUrlPatternEndpoints;
+ private Map localizerMap;
+ private WSDLPublisher publisher;
+ private boolean publishWSDL;
+ private boolean publishStatusPage;
+
+ private static final Logger logger =
+ Logger.getLogger(
+ org.jboss.com.sun.xml.ws.util.Constants.LoggingDomain +
".servlet.http");
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/servlet/WSServletDelegate.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/servlet/WSServletException.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/servlet/WSServletException.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/servlet/WSServletException.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,45 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.transport.http.servlet;
+
+import org.jboss.com.sun.xml.ws.server.*;
+import org.jboss.com.sun.xml.ws.util.exception.JAXWSExceptionBase;
+import org.jboss.com.sun.xml.ws.util.localization.Localizable;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class WSServletException extends JAXWSExceptionBase {
+ public WSServletException(String key, Object... args) {
+ super(key, args);
+ }
+
+ public WSServletException(Throwable throwable) {
+ super(throwable);
+ }
+
+ public String getResourceBundleName() {
+ return "org.jboss.com.sun.xml.ws.resources.wsservlet";
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/servlet/WSServletException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/servlet/WebServiceContextImpl.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/servlet/WebServiceContextImpl.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/servlet/WebServiceContextImpl.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,70 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.transport.http.servlet;
+import java.security.Principal;
+import javax.xml.ws.handler.MessageContext;
+import javax.servlet.http.HttpServletRequest;
+
+import org.jboss.com.sun.xml.ws.spi.runtime.WebServiceContext;
+
+public class WebServiceContextImpl implements WebServiceContext {
+
+ public ThreadLocal msgContext = new ThreadLocal();
+
+ public MessageContext getMessageContext() {
+ MessageContext ctxt = (MessageContext)msgContext.get();
+ if (ctxt == null) {
+ throw new IllegalStateException();
+ }
+ return ctxt;
+ }
+
+ public void setMessageContext(MessageContext ctxt) {
+ msgContext.set(ctxt);
+ }
+
+ public Principal getUserPrincipal() {
+ MessageContext ctxt = (MessageContext)msgContext.get();
+ if (ctxt != null) {
+ HttpServletRequest req = (HttpServletRequest)ctxt.get(
+ MessageContext.SERVLET_REQUEST);
+ if (req != null) {
+ return req.getUserPrincipal();
+ }
+ }
+ throw new IllegalStateException();
+ }
+
+
+ public boolean isUserInRole(String role) {
+ MessageContext ctxt = (MessageContext)msgContext.get();
+ if (ctxt != null) {
+ HttpServletRequest req = (HttpServletRequest)ctxt.get(
+ MessageContext.SERVLET_REQUEST);
+ if (req != null) {
+ return req.isUserInRole(role);
+ }
+ }
+ throw new IllegalStateException();
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/http/servlet/WebServiceContextImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/local/LocalMessage.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/local/LocalMessage.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/local/LocalMessage.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,58 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.transport.local;
+
+
+import java.io.ByteArrayOutputStream;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.com.sun.xml.ws.util.ByteArrayBuffer;
+
+/**
+ * @author WS Development Team
+ */
+public class LocalMessage {
+ ByteArrayBuffer baos;
+ Map<String, List<String>> headers;
+
+ public LocalMessage () {
+ }
+
+ public ByteArrayBuffer getOutput() {
+ return baos;
+ }
+
+ public void setOutput(ByteArrayBuffer baos) {
+ this.baos = baos;
+ }
+
+ public Map<String, List<String>> getHeaders() {
+ return headers;
+ }
+
+ public void setHeaders(Map<String, List<String>> headers) {
+ this.headers = headers;
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/local/LocalMessage.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/local/client/LocalClientTransport.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/local/client/LocalClientTransport.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/local/client/LocalClientTransport.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,165 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.transport.local.client;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
+
+import java.io.InputStream;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.HashSet;
+import java.net.HttpURLConnection;
+import java.net.ProtocolException;
+
+
+import static
org.jboss.com.sun.xml.ws.developer.JAXWSProperties.CONTENT_NEGOTIATION_PROPERTY;
+
+import javax.xml.ws.http.HTTPException;
+
+import org.jboss.com.sun.xml.ws.client.ClientTransportException;
+import org.jboss.com.sun.xml.ws.handler.MessageContextImpl;
+import org.jboss.com.sun.xml.ws.server.RuntimeEndpointInfo;
+import org.jboss.com.sun.xml.ws.server.Tie;
+import org.jboss.com.sun.xml.ws.spi.runtime.WSConnection;
+import org.jboss.com.sun.xml.ws.spi.runtime.WebServiceContext;
+import org.jboss.com.sun.xml.ws.transport.WSConnectionImpl;
+import org.jboss.com.sun.xml.ws.transport.local.LocalMessage;
+import org.jboss.com.sun.xml.ws.transport.local.server.LocalConnectionImpl;
+import org.jboss.com.sun.xml.ws.util.ByteArrayBuffer;
+import org.jboss.com.sun.xml.ws.util.localization.Localizable;
+
+/**
+ * @author WS Development Team
+ */
+public class LocalClientTransport extends WSConnectionImpl {
+
+ private RuntimeEndpointInfo endpointInfo;
+ private Tie tie = new Tie();
+ LocalMessage lm = new LocalMessage();
+
+ //this class is used primarily for debugging purposes
+ public LocalClientTransport(RuntimeEndpointInfo endpointInfo) {
+ this(endpointInfo, null);
+ }
+
+ public LocalClientTransport(RuntimeEndpointInfo endpointInfo,
+ OutputStream logStream) {
+ this.endpointInfo = endpointInfo;
+ debugStream = logStream;
+ }
+
+
+ @Override
+ public OutputStream getOutput() {
+ try {
+ lm.setOutput(new ByteArrayBuffer());
+ return lm.getOutput();
+ }
+ catch (Exception ex) {
+ throw new ClientTransportException("local.client.failed",ex);
+ }
+ }
+
+ private static void checkMessageContentType(WSConnection con, boolean response) {
+ String negotiation = System.getProperty(CONTENT_NEGOTIATION_PROPERTY,
"none").intern();
+ String contentType = con.getHeaders().get("Content-Type").get(0);
+
+ // Use indexOf() to handle Multipart/related types
+ if (negotiation == "none") {
+ // OK only if XML
+ if (contentType.indexOf("text/xml") < 0 &&
+ contentType.indexOf("application/soap+xml") < 0
&&
+ contentType.indexOf("application/xop+xml") < 0)
+ {
+ throw new RuntimeException("Invalid content type '" +
contentType
+ + "' with content negotiation set to '" +
negotiation + "'.");
+ }
+ }
+ else if (negotiation == "optimistic") {
+ // OK only if FI
+ if (contentType.indexOf("application/fastinfoset") < 0
&&
+ contentType.indexOf("application/soap+fastinfoset") < 0)
+ {
+ throw new RuntimeException("Invalid content type '" +
contentType
+ + "' with content negotiation set to '" +
negotiation + "'.");
+ }
+ }
+ else if (negotiation == "pessimistic") {
+ // OK if FI request is anything and response is FI
+ if (response &&
+ contentType.indexOf("application/fastinfoset") < 0
&&
+ contentType.indexOf("application/soap+fastinfoset") <
0)
+ {
+ throw new RuntimeException("Invalid content type '" +
contentType
+ + "' with content negotiation set to '" +
negotiation + "'.");
+ }
+ }
+ }
+
+ @Override
+ public void closeOutput() {
+ super.closeOutput();
+ WSConnection con = new LocalConnectionImpl(lm);
+
+ // Copy headers for content negotiation
+ con.setHeaders(getHeaders());
+
+ // Check request content type based on negotiation property
+ checkMessageContentType(this, false);
+
+ try {
+ // Set a MessageContext per invocation
+ WebServiceContext wsContext = endpointInfo.getWebServiceContext();
+ wsContext.setMessageContext(new MessageContextImpl());
+ tie.handle(con, endpointInfo);
+
+ checkMessageContentType(con, true);
+ }
+ catch (Exception ex) {
+ new ProtocolException("Server side Exception:" + ex);
+ }
+ }
+
+ @Override
+ public InputStream getInput() {
+ try {
+ return lm.getOutput().newInputStream();
+ }
+ catch (Exception ex) {
+ throw new ClientTransportException("local.client.failed",ex);
+ }
+ }
+
+ @Override
+ public void setHeaders(Map<String, List<String>> headers) {
+ lm.setHeaders(headers);
+ }
+
+ @Override
+ public Map<String, List<String>> getHeaders() {
+ return lm.getHeaders();
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/local/client/LocalClientTransport.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/local/client/LocalClientTransportFactory.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/local/client/LocalClientTransportFactory.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/local/client/LocalClientTransportFactory.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,59 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.transport.local.client;
+
+import java.io.OutputStream;
+
+import java.util.Map;
+
+import org.jboss.com.sun.xml.ws.server.RuntimeEndpointInfo;
+import org.jboss.com.sun.xml.ws.spi.runtime.ClientTransportFactory;
+import org.jboss.com.sun.xml.ws.spi.runtime.WSConnection;
+
+/**
+ * @author WS Development Team
+ */
+public class LocalClientTransportFactory implements ClientTransportFactory {
+ private RuntimeEndpointInfo endpointInfo;
+ private OutputStream logStream;
+
+ //this class is used primarily for debugging purposes
+ public LocalClientTransportFactory(RuntimeEndpointInfo endpointInfo) {
+ this(endpointInfo, null);
+ }
+
+ public LocalClientTransportFactory(RuntimeEndpointInfo endpointInfo,
+ OutputStream logStream) {
+ this.endpointInfo = endpointInfo;
+ this.logStream = logStream;
+ }
+
+ public WSConnection create() {
+ return create(null);
+ }
+
+ public WSConnection create(Map<String, Object> context) {
+ return new LocalClientTransport(endpointInfo, logStream);
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/local/client/LocalClientTransportFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/local/server/LocalConnectionImpl.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/local/server/LocalConnectionImpl.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/local/server/LocalConnectionImpl.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,73 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.transport.local.server;
+import java.util.List;
+import java.util.Map;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.jboss.com.sun.xml.ws.transport.WSConnectionImpl;
+import org.jboss.com.sun.xml.ws.transport.local.LocalMessage;
+import org.jboss.com.sun.xml.ws.util.ByteArrayBuffer;
+
+
+/**
+ * @author WS Development Team
+ *
+ * Server-side Local transport implementation
+ */
+public class LocalConnectionImpl extends WSConnectionImpl {
+ private int status;
+ private LocalMessage lm;
+
+ public LocalConnectionImpl (LocalMessage localMessage) {
+ this.lm = localMessage;
+ }
+
+ public Map<String,List<String>> getHeaders () {
+ return lm.getHeaders ();
+ }
+
+ /**
+ * sets response headers.
+ */
+ public void setHeaders (Map<String,List<String>> headers) {
+ lm.setHeaders (headers);
+ }
+
+ public void setStatus (int status) {
+ this.status = status;
+ }
+
+ public InputStream getInput () {
+ return lm.getOutput().newInputStream();
+ }
+
+ public OutputStream getOutput () {
+ ByteArrayBuffer bab = new ByteArrayBuffer();
+ lm.setOutput(bab);
+ return bab;
+ }
+}
+
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/local/server/LocalConnectionImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/local/server/LocalWSContextImpl.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/local/server/LocalWSContextImpl.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/local/server/LocalWSContextImpl.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,54 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.transport.local.server;
+import java.security.Principal;
+import javax.xml.ws.handler.MessageContext;
+
+import org.jboss.com.sun.xml.ws.spi.runtime.WebServiceContext;
+
+
+public class LocalWSContextImpl implements WebServiceContext {
+
+ public static ThreadLocal msgContext = new ThreadLocal();
+
+ public MessageContext getMessageContext() {
+ MessageContext ctxt = (MessageContext)msgContext.get();
+ if (ctxt == null) {
+ throw new IllegalStateException();
+ }
+ return ctxt;
+ }
+
+ public void setMessageContext(MessageContext ctxt) {
+ msgContext.set(ctxt);
+ }
+
+ public Principal getUserPrincipal() {
+ return null;
+ }
+
+
+ public boolean isUserInRole(String role) {
+ return false;
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/transport/local/server/LocalWSContextImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/ASCIIUtility.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/ASCIIUtility.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/ASCIIUtility.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,144 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.util;
+
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
+
+/**
+ * Copied from mail.jar.
+ */
+public class ASCIIUtility {
+ // Private constructor so that this class is not instantiated
+ private ASCIIUtility() { }
+
+
+ /**
+ * Convert the bytes within the specified range of the given byte
+ * array into a signed integer in the given radix . The range extends
+ * from <code>start</code> till, but not including
<code>end</code>. <p>
+ *
+ * Based on java.lang.Integer.parseInt()
+ */
+ public static int parseInt(byte[] b, int start, int end, int radix)
+ throws NumberFormatException {
+ if (b == null)
+ throw new NumberFormatException("null");
+
+ int result = 0;
+ boolean negative = false;
+ int i = start;
+ int limit;
+ int multmin;
+ int digit;
+
+ if (end > start) {
+ if (b[i] == '-') {
+ negative = true;
+ limit = Integer.MIN_VALUE;
+ i++;
+ } else {
+ limit = -Integer.MAX_VALUE;
+ }
+ multmin = limit / radix;
+ if (i < end) {
+ digit = Character.digit((char)b[i++], radix);
+ if (digit < 0) {
+ throw new NumberFormatException(
+ "illegal number: " + toString(b, start, end)
+ );
+ } else {
+ result = -digit;
+ }
+ }
+ while (i < end) {
+ // Accumulating negatively avoids surprises near MAX_VALUE
+ digit = Character.digit((char)b[i++], radix);
+ if (digit < 0) {
+ throw new NumberFormatException("illegal number");
+ }
+ if (result < multmin) {
+ throw new NumberFormatException("illegal number");
+ }
+ result *= radix;
+ if (result < limit + digit) {
+ throw new NumberFormatException("illegal number");
+ }
+ result -= digit;
+ }
+ } else {
+ throw new NumberFormatException("illegal number");
+ }
+ if (negative) {
+ if (i > start + 1) {
+ return result;
+ } else { /* Only got "-" */
+ throw new NumberFormatException("illegal number");
+ }
+ } else {
+ return -result;
+ }
+ }
+
+ /**
+ * Convert the bytes within the specified range of the given byte
+ * array into a String. The range extends from <code>start</code>
+ * till, but not including <code>end</code>. <p>
+ */
+ public static String toString(byte[] b, int start, int end) {
+ int size = end - start;
+ char[] theChars = new char[size];
+
+ for (int i = 0, j = start; i < size; )
+ theChars[i++] = (char)(b[j++]&0xff);
+
+ return new String(theChars);
+ }
+
+ public static byte[] getBytes(String s) {
+ char [] chars= s.toCharArray();
+ int size = chars.length;
+ byte[] bytes = new byte[size];
+
+ for (int i = 0; i < size;)
+ bytes[i] = (byte) chars[i++];
+ return bytes;
+ }
+
+ public static byte[] getBytes(InputStream is) throws IOException {
+ ByteArrayBuffer bab = new ByteArrayBuffer();
+ bab.write(is);
+ return bab.toByteArray();
+ }
+
+ public static void copyStream(InputStream is, OutputStream out) throws IOException {
+ int size = 1024;
+ byte[] buf = new byte[size];
+ int len;
+
+ while ((len = is.read(buf, 0, size)) != -1)
+ out.write(buf, 0, len);
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/ASCIIUtility.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/Base64Util.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/Base64Util.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/Base64Util.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,174 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.util;
+
+/**
+ *
+ * @author jitu
+ */
+public class Base64Util {
+
+ protected static final char encodeBase64[] = {
+ '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', '+', '/'
+ };
+
+ protected static final int decodeBase64[] = {
+ /*'+'*/ 62,
+ -1, -1, -1,
+ /*'/'*/ 63,
+ /*'0'*/ 52,
+ /*'1'*/ 53,
+ /*'2'*/ 54,
+ /*'3'*/ 55,
+ /*'4'*/ 56,
+ /*'5'*/ 57,
+ /*'6'*/ 58,
+ /*'7'*/ 59,
+ /*'8'*/ 60,
+ /*'9'*/ 61,
+ -1, -1, -1, -1, -1, -1, -1,
+ /*'A'*/ 0,
+ /*'B'*/ 1,
+ /*'C'*/ 2,
+ /*'D'*/ 3,
+ /*'E'*/ 4,
+ /*'F'*/ 5,
+ /*'G'*/ 6,
+ /*'H'*/ 7,
+ /*'I'*/ 8,
+ /*'J'*/ 9,
+ /*'K'*/ 10,
+ /*'L'*/ 11,
+ /*'M'*/ 12,
+ /*'N'*/ 13,
+ /*'O'*/ 14,
+ /*'P'*/ 15,
+ /*'Q'*/ 16,
+ /*'R'*/ 17,
+ /*'S'*/ 18,
+ /*'T'*/ 19,
+ /*'U'*/ 20,
+ /*'V'*/ 21,
+ /*'W'*/ 22,
+ /*'X'*/ 23,
+ /*'Y'*/ 24,
+ /*'Z'*/ 25,
+ -1, -1, -1, -1, -1, -1,
+ /*'a'*/ 26,
+ /*'b'*/ 27,
+ /*'c'*/ 28,
+ /*'d'*/ 29,
+ /*'e'*/ 30,
+ /*'f'*/ 31,
+ /*'g'*/ 32,
+ /*'h'*/ 33,
+ /*'i'*/ 34,
+ /*'j'*/ 35,
+ /*'k'*/ 36,
+ /*'l'*/ 37,
+ /*'m'*/ 38,
+ /*'n'*/ 39,
+ /*'o'*/ 40,
+ /*'p'*/ 41,
+ /*'q'*/ 42,
+ /*'r'*/ 43,
+ /*'s'*/ 44,
+ /*'t'*/ 45,
+ /*'u'*/ 46,
+ /*'v'*/ 47,
+ /*'w'*/ 48,
+ /*'x'*/ 49,
+ /*'y'*/ 50,
+ /*'z'*/ 51
+ };
+
+ public static String encode(byte[] value)
+ throws Exception {
+
+ if (value == null) {
+ return null;
+ }
+ if (value.length == 0) {
+ return "";
+ }
+ int blockCount = value.length / 3;
+ int partialBlockLength = value.length % 3;
+
+ if (partialBlockLength != 0) {
+ ++blockCount;
+ }
+
+ int encodedLength = blockCount * 4;
+ StringBuffer encodedValue = new StringBuffer(encodedLength);
+
+ int idx = 0;
+ for (int i = 0; i < blockCount; ++i) {
+ int b1 = value[idx++];
+ int b2 = (idx < value.length) ? value[idx++] : 0;
+ int b3 = (idx < value.length) ? value[idx++] : 0;
+
+ if (b1 < 0) {
+ b1 += 256;
+ }
+ if (b2 < 0) {
+ b2 += 256;
+ }
+ if (b3 < 0) {
+ b3 += 256;
+ }
+
+ char encodedChar;
+
+ encodedChar = encodeBase64[b1 >> 2];
+ encodedValue.append(encodedChar);
+
+ encodedChar = encodeBase64[((b1 & 0x03) << 4) | (b2 >> 4)];
+ encodedValue.append(encodedChar);
+
+ encodedChar = encodeBase64[((b2 & 0x0f) << 2) | (b3 >> 6)];
+ encodedValue.append(encodedChar);
+
+ encodedChar = encodeBase64[b3 & 0x3f];
+ encodedValue.append(encodedChar);
+ }
+
+ switch (partialBlockLength) {
+ case 0 :
+ // do nothing
+ break;
+ case 1 :
+ encodedValue.setCharAt(encodedLength - 1, '=');
+ encodedValue.setCharAt(encodedLength - 2, '=');
+ break;
+ case 2 :
+ encodedValue.setCharAt(encodedLength - 1, '=');
+ break;
+ }
+
+ return encodedValue.toString();
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/Base64Util.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/ByteArrayBuffer.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/ByteArrayBuffer.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/ByteArrayBuffer.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,171 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.util;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+/**
+ * Read/write buffer that stores a sequence of bytes.
+ *
+ * <p>
+ * It works in a way similar to {@link ByteArrayOutputStream} but
+ * this class works better in the following ways:
+ *
+ * <ol>
+ * <li>no synchronization
+ * <li>offers a {@link #newInputStream()} that creates a new {@link InputStream}
+ * that won't cause buffer reallocation.
+ * <li>less parameter correctness checking
+ * <li>offers a {@link #write(InputStream)} method that reads the entirety of the
+ * given {@link InputStream} without using a temporary buffer.
+ * </ol>
+ *
+ * @author Kohsuke Kawaguchi
+ */
+public final class ByteArrayBuffer extends OutputStream {
+ /**
+ * The buffer where data is stored.
+ */
+ private byte buf[];
+
+ /**
+ * The number of valid bytes in the buffer.
+ */
+ private int count;
+
+ /**
+ * Creates a new byte array output stream. The buffer capacity is
+ * initially 32 bytes, though its size increases if necessary.
+ */
+ public ByteArrayBuffer() {
+ this(32);
+ }
+
+ /**
+ * Creates a new byte array output stream, with a buffer capacity of
+ * the specified size, in bytes.
+ *
+ * @param size the initial size.
+ * @throws IllegalArgumentException if size is negative.
+ */
+ public ByteArrayBuffer(int size) {
+ if (size <= 0)
+ throw new IllegalArgumentException();
+ buf = new byte[size];
+ }
+
+ public ByteArrayBuffer(byte[] data) {
+ this.buf = data;
+ }
+
+ /**
+ * Reads all the data of the given {@link InputStream} and appends them
+ * into this buffer.
+ *
+ * @throws IOException
+ * if the read operation fails with an {@link IOException}.
+ */
+ public void write(InputStream in) throws IOException {
+ while(true) {
+ int cap = buf.length-count; // the remaining buffer space
+ int sz = in.read(buf,count,cap);
+ if(sz<0) return; // hit EOS
+ count += sz;
+
+
+ if(cap==sz)
+ ensureCapacity(buf.length*2); // buffer filled up.
+ }
+ }
+
+ public void write(int b) {
+ int newcount = count + 1;
+ ensureCapacity(newcount);
+ buf[count] = (byte) b;
+ count = newcount;
+ }
+
+ public void write(byte b[], int off, int len) {
+ int newcount = count + len;
+ ensureCapacity(newcount);
+ System.arraycopy(b, off, buf, count, len);
+ count = newcount;
+ }
+
+ private void ensureCapacity(int newcount) {
+ if (newcount > buf.length) {
+ byte newbuf[] = new byte[Math.max(buf.length << 1, newcount)];
+ System.arraycopy(buf, 0, newbuf, 0, count);
+ buf = newbuf;
+ }
+ }
+
+ public void writeTo(OutputStream out) throws IOException {
+ out.write(buf, 0, count);
+ }
+
+ public void reset() {
+ count = 0;
+ }
+
+ /**
+ * Gets the <b>copy</b> of exact-size byte[] that represents the written
data.
+ *
+ * <p>
+ * Since this method needs to allocate a new byte[], this method will be costly.
+ *
+ * @deprecated
+ * this method causes a buffer reallocation. Use it only when
+ * you have to.
+ */
+ public byte toByteArray()[] {
+ byte newbuf[] = new byte[count];
+ System.arraycopy(buf, 0, newbuf, 0, count);
+ return newbuf;
+ }
+
+ public int size() {
+ return count;
+ }
+
+ public void close() {
+ }
+
+ /**
+ * Creates a new {@link InputStream} that reads from this buffer.
+ */
+ public InputStream newInputStream() {
+ return new ByteArrayInputStream(buf,0,count);
+ }
+
+ /**
+ * Creates a new {@link InputStream} that reads a part of this bfufer.
+ */
+ public InputStream newInputStream(int start, int length) {
+ return new ByteArrayInputStream(buf,start,length);
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/ByteArrayBuffer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/ByteArrayDataSource.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/ByteArrayDataSource.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/ByteArrayDataSource.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,72 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.util;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.activation.DataSource;
+
+/**
+ * {@link DataSource} backed by a byte buffer.
+ *
+ * @author Kohsuke Kawaguchi
+ */
+public final class ByteArrayDataSource implements DataSource {
+
+ private final String contentType;
+ private final byte[] buf;
+ private final int start;
+ private final int len;
+
+ public ByteArrayDataSource(byte[] buf, String contentType) {
+ this(buf,0,buf.length,contentType);
+ }
+ public ByteArrayDataSource(byte[] buf, int length, String contentType) {
+ this(buf,0,length,contentType);
+ }
+ public ByteArrayDataSource(byte[] buf, int start, int length, String contentType) {
+ this.buf = buf;
+ this.start = start;
+ this.len = length;
+ this.contentType = contentType;
+ }
+
+ public String getContentType() {
+ if(contentType==null)
+ return "application/octet-stream";
+ return contentType;
+ }
+
+ public InputStream getInputStream() {
+ return new ByteArrayInputStream(buf,start,len);
+ }
+
+ public String getName() {
+ return null;
+ }
+
+ public OutputStream getOutputStream() {
+ throw new UnsupportedOperationException();
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/ByteArrayDataSource.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/Constants.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/Constants.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/Constants.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,37 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.util;
+
+/**
+ * This holds generic constants information for the whole JAX-WS SI.
+ *
+ * @author WS Development Team
+ */
+
+public class Constants {
+ /**
+ * WS SI Logging Domain
+ */
+ public static final String LoggingDomain =
+ "javax.enterprise.resource.webservices.jaxws";
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/Constants.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/DOMUtil.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/DOMUtil.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/DOMUtil.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,86 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.util;
+
+import org.jboss.com.sun.xml.ws.util.xml.XmlUtil;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.xml.sax.SAXException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.FactoryConfigurationError;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.dom.DOMResult;
+import java.io.InputStream;
+import java.io.IOException;
+
+/**
+ * $author: JAXWS Development Team
+ */
+public class DOMUtil {
+
+ private static DocumentBuilder db;
+
+ /**
+ * Creates a new DOM document.
+ */
+ public static Document createDom() {
+ synchronized (DOMUtil.class) {
+ if (db == null) {
+ try {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ db = dbf.newDocumentBuilder();
+ } catch (ParserConfigurationException e) {
+ throw new FactoryConfigurationError(e);
+ }
+ }
+ return db.newDocument();
+ }
+ }
+
+ public static Node createDOMNode(InputStream inputStream) {
+
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ dbf.setValidating(false);
+ try {
+ DocumentBuilder builder = dbf.newDocumentBuilder();
+ try {
+ return builder.parse(inputStream);
+ } catch (SAXException e) {
+ e.printStackTrace(); //To change body of catch statement use File |
Settings | File Templates.
+ } catch (IOException e) {
+ e.printStackTrace(); //To change body of catch statement use File |
Settings | File Templates.
+ }
+ } catch (ParserConfigurationException pce) {
+ IllegalArgumentException iae = new
IllegalArgumentException(pce.getMessage());
+ iae.initCause(pce);
+ throw iae;
+ }
+ return null;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/DOMUtil.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/FastInfosetReflection.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/FastInfosetReflection.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/FastInfosetReflection.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,286 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.util;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+
+
+/**
+ *
+ * @author Santiago.PericasGeertsen(a)sun.com
+ * @author Paul.Sandoz(a)sun.com
+ */
+public class FastInfosetReflection {
+ /**
+ *
+ */
+ public static ClassLoader fiClassLoader;
+
+ /**
+ * FI StAXDocumentParser constructor using reflection.
+ */
+ public static Constructor fiStAXDocumentParser_new;
+
+ /**
+ * FI <code>StAXDocumentParser.setInputStream()</code> method via
reflection.
+ */
+ public static Method fiStAXDocumentParser_setInputStream;
+
+ /**
+ * FI <code>StAXDocumentParser.setStringInterning()</code> method via
reflection.
+ */
+ public static Method fiStAXDocumentParser_setStringInterning;
+
+ /**
+ * FI StAXDocumentSerializer constructor using reflection.
+ */
+ public static Constructor fiStAXDocumentSerializer_new;
+
+ /**
+ * FI <code>StAXDocumentSerializer.setOutputStream()</code> method via
reflection.
+ */
+ public static Method fiStAXDocumentSerializer_setOutputStream;
+
+ /**
+ * FI <code>StAXDocumentSerializer.setEncoding()</code> method via
reflection.
+ */
+ public static Method fiStAXDocumentSerializer_setEncoding;
+
+ /**
+ * FI DOMDocumentParser constructor using reflection.
+ */
+ public static Constructor fiDOMDocumentParser_new;
+
+ /**
+ * FI <code>DOMDocumentParser.parse()</code> method via reflection.
+ */
+ public static Method fiDOMDocumentParser_parse;
+
+ /**
+ * FI DOMDocumentSerializer constructor using reflection.
+ */
+ public static Constructor fiDOMDocumentSerializer_new;
+
+ /**
+ * FI <code>FastInfosetSource.serialize(Document)</code> method via
reflection.
+ */
+ public static Method fiDOMDocumentSerializer_serialize;
+
+ /**
+ * FI <code>FastInfosetSource.setOutputStream(OutputStream)</code> method
via reflection.
+ */
+ public static Method fiDOMDocumentSerializer_setOutputStream;
+
+ /**
+ * FI FastInfosetSource class.
+ */
+ public static Class fiFastInfosetSource;
+
+ /**
+ * FI FastInfosetSource constructor using reflection.
+ */
+ public static Constructor fiFastInfosetSource_new;
+
+ /**
+ * FI <code>FastInfosetSource.getInputStream()</code> method via
reflection.
+ */
+ public static Method fiFastInfosetSource_getInputStream;
+
+ /**
+ * FI <code>FastInfosetSource.setInputSTream()</code> method via
reflection.
+ */
+ public static Method fiFastInfosetSource_setInputStream;
+
+ /**
+ * FI FastInfosetResult class using reflection.
+ */
+ public static Class fiFastInfosetResult;
+
+ /**
+ * FI FastInfosetResult constructor using reflection.
+ */
+ public static Constructor fiFastInfosetResult_new;
+
+ /**
+ * FI <code>FastInfosetResult.getOutputSTream()</code> method via
reflection.
+ */
+ public static Method fiFastInfosetResult_getOutputStream;
+
+ static {
+ // Use reflection to avoid static dependency with FI jar
+ try {
+ Class clazz = null;
+ clazz =
Class.forName("com.sun.xml.fastinfoset.stax.StAXDocumentParser");
+ fiStAXDocumentParser_new = clazz.getConstructor();
+ fiStAXDocumentParser_setInputStream =
+ clazz.getMethod("setInputStream", java.io.InputStream.class);
+ fiStAXDocumentParser_setStringInterning =
+ clazz.getMethod("setStringInterning", boolean.class);
+
+ clazz =
+
Class.forName("com.sun.xml.fastinfoset.stax.StAXDocumentSerializer");
+ fiStAXDocumentSerializer_new = clazz.getConstructor();
+ fiStAXDocumentSerializer_setOutputStream =
+ clazz.getMethod("setOutputStream",
java.io.OutputStream.class);
+ fiStAXDocumentSerializer_setEncoding =
+ clazz.getMethod("setEncoding", String.class);
+
+ clazz =
+
Class.forName("com.sun.xml.fastinfoset.dom.DOMDocumentParser");
+ fiDOMDocumentParser_new = clazz.getConstructor();
+ fiDOMDocumentParser_parse = clazz.getMethod("parse",
+ new Class[] { org.w3c.dom.Document.class, java.io.InputStream.class });
+
+ clazz =
Class.forName("com.sun.xml.fastinfoset.dom.DOMDocumentSerializer");
+ fiDOMDocumentSerializer_new = clazz.getConstructor();
+ fiDOMDocumentSerializer_serialize = clazz.getMethod("serialize",
+ new Class[] { org.w3c.dom.Node.class });
+ fiDOMDocumentSerializer_setOutputStream =
clazz.getMethod("setOutputStream",
+ new Class[] { java.io.OutputStream.class });
+
+ fiFastInfosetSource = clazz =
Class.forName("org.jvnet.fastinfoset.FastInfosetSource");
+ fiFastInfosetSource_new = clazz.getConstructor(
+ new Class[] { java.io.InputStream.class });
+ fiFastInfosetSource_getInputStream =
clazz.getMethod("getInputStream");
+ fiFastInfosetSource_setInputStream =
clazz.getMethod("setInputStream",
+ new Class[] { java.io.InputStream.class });
+
+ fiFastInfosetResult = clazz =
Class.forName("org.jvnet.fastinfoset.FastInfosetResult");
+ fiFastInfosetResult_new = clazz.getConstructor(
+ new Class[] { java.io.OutputStream.class });
+ fiFastInfosetResult_getOutputStream =
clazz.getMethod("getOutputStream");
+ }
+ catch (Exception e) {
+ // falls through
+ }
+ }
+
+ // -- DOMDocumentParser ----------------------------------------------
+
+ public static Object DOMDocumentParser_new() throws Exception {
+ if (fiDOMDocumentParser_new == null) {
+ throw new RuntimeException("Unable to locate Fast Infoset
implementation");
+ }
+ return fiDOMDocumentParser_new.newInstance();
+ }
+
+ public static void DOMDocumentParser_parse(Object parser,
+ Document d, InputStream s) throws Exception
+ {
+ if (fiDOMDocumentParser_parse == null) {
+ throw new RuntimeException("Unable to locate Fast Infoset
implementation");
+ }
+ fiDOMDocumentParser_parse.invoke(parser, d, s);
+ }
+
+ // -- DOMDocumentSerializer-------------------------------------------
+
+ public static Object DOMDocumentSerializer_new() throws Exception {
+ if (fiDOMDocumentSerializer_new == null) {
+ throw new RuntimeException("Unable to locate Fast Infoset
implementation");
+ }
+ return fiDOMDocumentSerializer_new.newInstance();
+ }
+
+ public static void DOMDocumentSerializer_serialize(Object serializer, Node node)
+ throws Exception
+ {
+ if (fiDOMDocumentSerializer_serialize == null) {
+ throw new RuntimeException("Unable to locate Fast Infoset
implementation");
+ }
+ fiDOMDocumentSerializer_serialize.invoke(serializer, node);
+ }
+
+ public static void DOMDocumentSerializer_setOutputStream(Object serializer,
+ OutputStream os) throws Exception
+ {
+ if (fiDOMDocumentSerializer_setOutputStream == null) {
+ throw new RuntimeException("Unable to locate Fast Infoset
implementation");
+ }
+ fiDOMDocumentSerializer_setOutputStream.invoke(serializer, os);
+ }
+
+ // -- FastInfosetSource ----------------------------------------------
+
+ public static boolean isFastInfosetSource(Source source) {
+ return source.getClass() == fiFastInfosetSource;
+ }
+
+ public static Source FastInfosetSource_new(InputStream is)
+ throws Exception
+ {
+ if (fiFastInfosetSource_new == null) {
+ throw new RuntimeException("Unable to locate Fast Infoset
implementation");
+ }
+ return (Source) fiFastInfosetSource_new.newInstance(is);
+ }
+
+ public static InputStream FastInfosetSource_getInputStream(Source source)
+ throws Exception
+ {
+ if (fiFastInfosetSource_getInputStream == null) {
+ throw new RuntimeException("Unable to locate Fast Infoset
implementation");
+ }
+ return (InputStream) fiFastInfosetSource_getInputStream.invoke(source);
+ }
+
+ public static void FastInfosetSource_setInputStream(Source source,
+ InputStream is) throws Exception
+ {
+ if (fiFastInfosetSource_setInputStream == null) {
+ throw new RuntimeException("Unable to locate Fast Infoset
implementation");
+ }
+ fiFastInfosetSource_setInputStream.invoke(source, is);
+ }
+
+ // -- FastInfosetResult ----------------------------------------------
+
+ public static boolean isFastInfosetResult(Result result) {
+ return result.getClass() == fiFastInfosetResult;
+ }
+
+ public static Result FastInfosetResult_new(OutputStream os)
+ throws Exception
+ {
+ if (fiFastInfosetResult_new == null) {
+ throw new RuntimeException("Unable to locate Fast Infoset
implementation");
+ }
+ return (Result) fiFastInfosetResult_new.newInstance(os);
+ }
+
+ public static OutputStream FastInfosetResult_getOutputStream(Result result)
+ throws Exception
+ {
+ if (fiFastInfosetResult_getOutputStream == null) {
+ throw new RuntimeException("Unable to locate Fast Infoset
implementation");
+ }
+ return (OutputStream) fiFastInfosetResult_getOutputStream.invoke(result);
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/FastInfosetReflection.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/FastInfosetUtil.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/FastInfosetUtil.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/FastInfosetUtil.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,101 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.util;
+
+import java.io.OutputStream;
+import java.io.StringReader;
+import java.util.List;
+import java.util.StringTokenizer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.soap.SOAPException;
+
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.util.xml.XmlUtil;
+
+import org.jboss.com.sun.xml.messaging.saaj.soap.MessageImpl;
+
+import static
org.jboss.com.sun.xml.ws.developer.JAXWSProperties.CONTENT_NEGOTIATION_PROPERTY;
+
+public class FastInfosetUtil {
+
+ public static boolean isFastInfosetAccepted(String[] accepts) {
+ if (accepts != null) {
+ for (String accept : accepts) {
+ if (isFastInfosetAccepted(accept)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public static boolean isFastInfosetAccepted(String accept) {
+ StringTokenizer st = new StringTokenizer(accept, ",");
+ while (st.hasMoreTokens()) {
+ final String token = st.nextToken().trim();
+ if (token.equalsIgnoreCase("application/fastinfoset")) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static String getFastInfosetFromAccept(List<String> accepts) {
+ for (String accept : accepts) {
+ StringTokenizer st = new StringTokenizer(accept, ",");
+ while (st.hasMoreTokens()) {
+ final String token = st.nextToken().trim();
+ if (token.equalsIgnoreCase("application/fastinfoset")) {
+ return "application/fastinfoset";
+ }
+ if (token.equalsIgnoreCase("application/soap+fastinfoset")) {
+ return "application/soap+fastinfoset";
+ }
+ }
+ }
+ return null;
+ }
+
+ public static void transcodeXMLStringToFI(String xml, OutputStream out) {
+ try {
+ XmlUtil.newTransformer().transform(
+ new StreamSource(new java.io.StringReader(xml)),
+ FastInfosetReflection.FastInfosetResult_new(out));
+ }
+ catch (Exception e) {
+ // Ignore
+ }
+ }
+
+ public static void ensureCorrectEncoding(MessageInfo messageInfo,
+ SOAPMessage message)
+ {
+ String conneg = (String) messageInfo.getMetaData(CONTENT_NEGOTIATION_PROPERTY);
+ if (conneg == "optimistic") {
+ ((MessageImpl) message).setIsFastInfoset(true);
+ }
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/FastInfosetUtil.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/HandlerAnnotationInfo.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/HandlerAnnotationInfo.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/HandlerAnnotationInfo.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,80 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.util;
+
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.ws.handler.Handler;
+
+/**
+ * Used to hold a list of handlers and a set of roles from an
+ * annotated endpoint. At runtime, these are created by the
+ * HandlerAnnotationProcessor at the request of client and
+ * server code to create the handler chains.
+ *
+ * @see org.jboss.com.sun.xml.ws.util.HandlerAnnotationProcessor
+ *
+ * @author JAX-WS Development Team
+ */
+public class HandlerAnnotationInfo {
+
+ private List<Handler> handlers;
+ private Set<String> roles;
+
+ /**
+ * Return the handlers specified by the handler chain descriptor.
+ *
+ * @return A list of jax-ws handler objects.
+ */
+ public List<Handler> getHandlers() {
+ return handlers;
+ }
+
+ /**
+ * This method should only be called by HandlerAnnotationProcessor.
+ *
+ * @param handlers The handlers specified by the handler chain descriptor.
+ */
+ public void setHandlers(List<Handler> handlers) {
+ this.handlers = handlers;
+ }
+
+ /**
+ * Return the roles contained in the handler chain descriptor.
+ *
+ * @return A set of roles.
+ */
+ public Set<String> getRoles() {
+ return roles;
+ }
+
+ /**
+ * This method should only be called by HandlerAnnotationProcessor.
+ *
+ * @param roles The roles contained in the handler chain descriptor.
+ */
+ public void setRoles(Set<String> roles) {
+ this.roles = roles;
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/HandlerAnnotationInfo.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/HandlerAnnotationProcessor.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/HandlerAnnotationProcessor.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/HandlerAnnotationProcessor.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,215 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.util;
+
+
+import javax.jws.HandlerChain;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPMessageHandlers;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.ws.Provider;
+import javax.xml.ws.Service;
+
+import org.jboss.com.sun.xml.ws.handler.HandlerChainsModel;
+import org.jboss.com.sun.xml.ws.streaming.XMLStreamReaderFactory;
+import org.jboss.com.sun.xml.ws.streaming.XMLStreamReaderUtil;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.logging.Logger;
+
+/**
+ * <p>Used by client and server side to create handler information
+ * from annotated class. The public methods all return a
+ * HandlerChainInfo that contains the handlers and role information
+ * needed at runtime.
+ *
+ * <p>All of the handler chain descriptors follow the same schema,
+ * whether they are wsdl customizations, handler files specified
+ * by an annotation, or are included in the sun-jaxws.xml file.
+ * So this class is used for all handler xml information. The
+ * two public entry points are
+ * {@link HandlerAnnotationProcessor#buildHandlerInfo}, called
+ * when you have an annotated class that points to a file, and
+ * {@link HandlerAnnotationProcessor#parseHandlerFile}, called
+ * when the file reader already exists.
+ *
+ * <p>The methods in the class are static so that it may called
+ * from the runtime statically.
+ *
+ * @see org.jboss.com.sun.xml.ws.util.HandlerAnnotationInfo
+ *
+ * @author JAX-WS Development Team
+ */
+public class HandlerAnnotationProcessor {
+
+ private static final Logger logger = Logger.getLogger(
+ org.jboss.com.sun.xml.ws.util.Constants.LoggingDomain + ".util");
+
+ /**
+ * <p>This method is called by
+ * {@link org.jboss.com.sun.xml.ws.client.ServiceContextBuilder} and
+ * {@link org.jboss.com.sun.xml.ws.server.RuntimeEndpointInfo} when
+ * they have an annotated class.
+ *
+ * <p>If there is no handler chain annotation on the class,
+ * this method will return null. Otherwise it will load the
+ * class and call the parseHandlerFile method to read the
+ * information.
+ *
+ * @return A HandlerAnnotationInfo object that stores the
+ * handlers and roles. Will return null if the class passed
+ * in has no handler chain annotation.
+ */
+ public static HandlerAnnotationInfo buildHandlerInfo(Class clazz,
+ QName serviceName, QName portName, String bindingId) {
+
+// clazz = checkClass(clazz);
+ HandlerChain handlerChain =
+ (HandlerChain) clazz.getAnnotation(HandlerChain.class);
+ if (handlerChain == null) {
+ clazz = getSEI(clazz);
+ if (clazz != null)
+ handlerChain =
+ (HandlerChain) clazz.getAnnotation(HandlerChain.class);
+ if (handlerChain == null)
+ return null;
+ }
+
+ if (clazz.getAnnotation(SOAPMessageHandlers.class) != null) {
+ throw new UtilException(
+ "util.handler.cannot.combine.soapmessagehandlers");
+ }
+ InputStream iStream = getFileAsStream(clazz, handlerChain);
+ XMLStreamReader reader =
+ XMLStreamReaderFactory.createXMLStreamReader(iStream, true);
+ XMLStreamReaderUtil.nextElementContent(reader);
+ HandlerAnnotationInfo handlerAnnInfo =
HandlerChainsModel.parseHandlerFile(reader, clazz.getClassLoader(),
+ serviceName, portName, bindingId);
+ try {
+ reader.close();
+ iStream.close();
+ } catch (XMLStreamException e) {
+ e.printStackTrace();
+ throw new UtilException(e.getMessage());
+ } catch (IOException e) {
+ e.printStackTrace();
+ throw new UtilException(e.getMessage());
+ }
+ return handlerAnnInfo;
+ }
+
+ public static HandlerChainsModel buildHandlerChainsModel(final Class clazz) {
+ if(clazz == null) {
+ return null;
+ }
+ HandlerChain handlerChain =
+ (HandlerChain) clazz.getAnnotation(HandlerChain.class);
+ if(handlerChain == null)
+ return null;
+ InputStream iStream = getFileAsStream(clazz, handlerChain);
+ XMLStreamReader reader =
+ XMLStreamReaderFactory.createXMLStreamReader(iStream, true);
+ XMLStreamReaderUtil.nextElementContent(reader);
+ HandlerChainsModel handlerChainsModel =
HandlerChainsModel.parseHandlerConfigFile(clazz, reader);
+ try {
+ reader.close();
+ iStream.close();
+ } catch (XMLStreamException e) {
+ e.printStackTrace();
+ throw new UtilException(e.getMessage());
+ } catch (IOException e) {
+ e.printStackTrace();
+ throw new UtilException(e.getMessage());
+ }
+ return handlerChainsModel;
+ }
+
+ static Class getClass(String className) {
+ try {
+ return Thread.currentThread().getContextClassLoader().loadClass(
+ className);
+ } catch (ClassNotFoundException e) {
+ throw new UtilException("util.handler.class.not.found",
+ new Object[] {className});
+ }
+ }
+
+ static Class getSEI(Class clazz) {
+ if (Provider.class.isAssignableFrom(clazz)) {
+ //No SEI for Provider Implementation
+ return null;
+ }
+ if (Service.class.isAssignableFrom(clazz)) {
+ //No SEI for Service class
+ return null;
+ }
+ if (!clazz.isAnnotationPresent(WebService.class)) {
+ throw new UtilException("util.handler.no.webservice.annotation",
+ new Object[] {clazz.getCanonicalName()});
+ }
+
+ WebService webService =
+ (WebService) clazz.getAnnotation(WebService.class);
+
+ String ei = webService.endpointInterface();
+ if (ei.length() > 0) {
+ clazz = getClass(webService.endpointInterface());
+ if (!clazz.isAnnotationPresent(WebService.class)) {
+ throw new
UtilException("util.handler.endpoint.interface.no.webservice",
+ new Object[] {webService.endpointInterface()});
+ }
+ return clazz;
+ }
+ return null;
+ }
+
+ static InputStream getFileAsStream(Class clazz, HandlerChain chain) {
+ URL url = clazz.getResource(chain.file());
+ if (url == null) {
+ url = Thread.currentThread().getContextClassLoader().
+ getResource(chain.file());
+ }
+ if (url == null) {
+ String tmp = clazz.getPackage().getName();
+ tmp = tmp.replace('.', '/');
+ tmp += "/" + chain.file();
+ url =
+ Thread.currentThread().getContextClassLoader().getResource(tmp);
+ }
+ if (url == null) {
+ throw new UtilException("util.failed.to.find.handlerchain.file",
+ new Object[] {clazz.getName(), chain.file()});
+ }
+ try {
+ return url.openStream();
+ } catch (IOException e) {
+ throw new UtilException("util.failed.to.parse.handlerchain.file",
+ new Object[] {clazz.getName(), chain.file()});
+ }
+ }
+
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/HandlerAnnotationProcessor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/JAXWSUtils.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/JAXWSUtils.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/JAXWSUtils.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,129 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.util;
+
+import java.util.UUID;
+import java.util.regex.Pattern;
+import java.net.URL;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.io.File;
+import java.io.IOException;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @author Vivek Pandey
+ *
+ * Wrapper utility class to be used from the generated code or run time.
+ */
+public final class JAXWSUtils {
+ public static String getUUID(){
+ return UUID.randomUUID().toString();
+ }
+
+
+
+ public static String getFileOrURLName(String fileOrURL) {
+ try{
+ try {
+ return escapeSpace(new URL(fileOrURL).toExternalForm());
+ } catch (MalformedURLException e) {
+ return new File(fileOrURL).getCanonicalFile().toURL().toExternalForm();
+ }
+ } catch (Exception e) {
+ // try it as an URL
+ return fileOrURL;
+ }
+ }
+
+ public static URL getFileOrURL(String fileOrURL) throws IOException {
+ try {
+ return new URL(fileOrURL);
+ } catch (MalformedURLException e) {
+ return new File(fileOrURL).toURL();
+ }
+ }
+ private static String escapeSpace( String url ) {
+ // URLEncoder didn't work.
+ StringBuffer buf = new StringBuffer();
+ for (int i = 0; i < url.length(); i++) {
+ // TODO: not sure if this is the only character that needs to be escaped.
+ if (url.charAt(i) == ' ')
+ buf.append("%20");
+ else
+ buf.append(url.charAt(i));
+ }
+ return buf.toString();
+ }
+
+ public static String absolutize(String name) {
+ // absolutize all the system IDs in the input,
+ // so that we can map system IDs to DOM trees.
+ try {
+ URL baseURL = new File(".").getCanonicalFile().toURL();
+ return new URL(baseURL, name).toExternalForm();
+ } catch( IOException e ) {
+ ; // ignore
+ }
+ return name;
+ }
+
+ /**
+ * Checks if the system ID is absolute.
+ */
+ public static void checkAbsoluteness(String systemId) {
+ // we need to be able to handle system IDs like "urn:foo", which
java.net.URL can't process,
+ // but OTOH we also need to be able to process system IDs like "file://a b
c/def.xsd",
+ // which java.net.URI can't process. So for now, let's fail only if both
of them fail.
+ // eventually we need a proper URI class that works for us.
+ try {
+ new URL(systemId);
+ } catch( MalformedURLException _ ) {
+ try {
+ new URI(systemId);
+ } catch (URISyntaxException e ) {
+ throw new IllegalArgumentException("system ID
'"+systemId+"' isn't absolute",e);
+ }
+ }
+ }
+
+ /*
+ * To match, both QNames must have the same namespace and the local
+ * part of the target must match the local part of the 'pattern'
+ * QName, which may contain wildcard characters.
+ */
+ public static boolean matchQNames(QName target, QName pattern) {
+ if ((target == null) || (pattern == null)) {
+ // if no service or port is in descriptor
+ return false;
+ }
+ if (pattern.getNamespaceURI().equals(target.getNamespaceURI())) {
+ String regex = pattern.getLocalPart().replaceAll("\\*",
".*");
+ return Pattern.matches(regex, target.getLocalPart());
+ }
+ return false;
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/JAXWSUtils.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/MessageInfoUtil.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/MessageInfoUtil.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/MessageInfoUtil.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,105 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.util;
+
+import com.sun.xml.bind.api.BridgeContext;
+
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.bind.Marshaller;
+
+import org.jboss.com.sun.xml.ws.client.BindingProviderProperties;
+import org.jboss.com.sun.xml.ws.encoding.JAXWSAttachmentMarshaller;
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPDecoder;
+import org.jboss.com.sun.xml.ws.encoding.soap.internal.HeaderBlock;
+import org.jboss.com.sun.xml.ws.handler.HandlerChainCaller;
+import org.jboss.com.sun.xml.ws.handler.HandlerContext;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.server.RuntimeContext;
+
+import java.util.Set;
+
+/**
+ * @author WS RI Development Team
+ */
+public class MessageInfoUtil {
+
+ public static void setRuntimeContext(MessageInfo messageInfo,
+ RuntimeContext runtimeContext) {
+ messageInfo.setMetaData(BindingProviderProperties.JAXWS_RUNTIME_CONTEXT,
runtimeContext);
+ }
+
+ public static RuntimeContext getRuntimeContext(MessageInfo messageInfo) {
+ return (RuntimeContext)
messageInfo.getMetaData(BindingProviderProperties.JAXWS_RUNTIME_CONTEXT);
+ }
+
+ public static MessageContext getMessageContext(MessageInfo messageInfo) {
+ RuntimeContext rtCtxt = getRuntimeContext(messageInfo);
+ HandlerContext hdCtxt = null;
+ if (rtCtxt != null)
+ hdCtxt = rtCtxt.getHandlerContext();
+ else
+ hdCtxt = (HandlerContext)
+
messageInfo.getMetaData(BindingProviderProperties.JAXWS_HANDLER_CONTEXT_PROPERTY);
+ return (hdCtxt == null) ? null : hdCtxt.getMessageContext();
+ }
+
+ public static HandlerChainCaller getHandlerChainCaller(
+ MessageInfo messageInfo) {
+ return (HandlerChainCaller) messageInfo.getMetaData(
+ HandlerChainCaller.HANDLER_CHAIN_CALLER);
+ }
+
+ public static void setHandlerChainCaller(MessageInfo messageInfo,
+ HandlerChainCaller caller) {
+ messageInfo.setMetaData(HandlerChainCaller.HANDLER_CHAIN_CALLER,
+ caller);
+ }
+
+ public static JAXWSAttachmentMarshaller getAttachmentMarshaller(MessageInfo
messageInfo) {
+ Object rtc =
messageInfo.getMetaData(BindingProviderProperties.JAXWS_RUNTIME_CONTEXT);
+ if (rtc != null) {
+ BridgeContext bc = ((RuntimeContext) rtc).getBridgeContext();
+ if (bc != null) {
+ return (JAXWSAttachmentMarshaller) bc.getAttachmentMarshaller();
+ }
+ } else {
+ Marshaller m =
(Marshaller)messageInfo.getMetaData(BindingProviderProperties.DISPATCH_MARSHALLER);
+ if (m != null) {
+ return (JAXWSAttachmentMarshaller) m.getAttachmentMarshaller();
+ }
+ }
+ return null;
+ }
+
+ public static void setNotUnderstoodHeaders(MessageInfo messageInfo,
+ Set<HeaderBlock> headers) {
+
+ messageInfo.setMetaData(SOAPDecoder.NOT_UNDERSTOOD_HEADERS, headers);
+ }
+
+ public static Set<HeaderBlock> getNotUnderstoodHeaders(
+ MessageInfo messageInfo) {
+
+ return (Set<HeaderBlock>) messageInfo.getMetaData(
+ SOAPDecoder.NOT_UNDERSTOOD_HEADERS);
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/MessageInfoUtil.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/NamespaceSupport.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/NamespaceSupport.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/NamespaceSupport.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,746 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.util;
+
+import java.util.ArrayList;
+import java.util.EmptyStackException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.com.sun.xml.ws.encoding.soap.streaming.SOAPNamespaceConstants;
+
+
+/**
+ * Encapsulate Namespace logic for use by SAX drivers.
+ *
+ * <blockquote>
+ * <em>This module, both source code and documentation, is in the
+ * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
+ * </blockquote>
+ *
+ * <p>This class encapsulates the logic of Namespace processing:
+ * it tracks the declarations currently in force for each context
+ * and automatically processes qualified XML 1.0 names into their
+ * Namespace parts; it can also be used in reverse for generating
+ * XML 1.0 from Namespaces.</p>
+ *
+ * <p>Namespace support objects are reusable, but the reset method
+ * must be invoked between each session.</p>
+ *
+ * <p>Here is a simple session:</p>
+ *
+ * <pre>
+ * String parts[] = new String[3];
+ * NamespaceSupport support = new NamespaceSupport();
+ *
+ * support.pushContext();
+ * support.declarePrefix("", "http://www.w3.org/1999/xhtml");
+ * support.declarePrefix("dc", "http://www.purl.org/dc#");
+ *
+ * String parts[] = support.processName("p", parts, false);
+ * System.out.println("Namespace URI: " + parts[0]);
+ * System.out.println("Local name: " + parts[1]);
+ * System.out.println("Raw name: " + parts[2]);
+
+ * String parts[] = support.processName("dc:title", parts, false);
+ * System.out.println("Namespace URI: " + parts[0]);
+ * System.out.println("Local name: " + parts[1]);
+ * System.out.println("Raw name: " + parts[2]);
+
+ * support.popContext();
+ * </pre>
+ *
+ * <p>Note that this class is optimized for the use case where most
+ * elements do not contain Namespace declarations: if the same
+ * prefix/URI mapping is repeated for each context (for example), this
+ * class will be somewhat less efficient.</p>
+ *
+ * @author David Megginson
+ * @author WS Development Team
+ */
+public class NamespaceSupport {
+
+ /* added two new methods, slideContextUp() and slideContextDown()
+ * needed to implement the revised streaming parser class (Parser2)
+ */
+
+ ////////////////////////////////////////////////////////////////////
+ // Constants.
+ ////////////////////////////////////////////////////////////////////
+
+ /**
+ * The XML Namespace as a constant.
+ *
+ * <p>This is the Namespace URI that is automatically mapped
+ * to the "xml" prefix.</p>
+ */
+ public final static String XMLNS = "http://www.w3.org/XML/1998/namespace";
+
+ /**
+ * An empty enumeration.
+ */
+ private final static Iterator EMPTY_ENUMERATION =
+ new ArrayList().iterator();
+
+ ////////////////////////////////////////////////////////////////////
+ // Constructor.
+ ////////////////////////////////////////////////////////////////////
+
+ /**
+ * Create a new Namespace support object.
+ */
+ public NamespaceSupport() {
+ reset();
+ }
+
+ // PBG May 6 2002 added a copy constructor to support recording
+ public NamespaceSupport(NamespaceSupport that) {
+ contexts = new Context[that.contexts.length];
+ currentContext = null;
+ contextPos = that.contextPos;
+
+ Context currentParent = null;
+
+ for (int i = 0; i < that.contexts.length; i++) {
+ Context thatContext = that.contexts[i];
+
+ if (thatContext == null) {
+ contexts[i] = null;
+ continue;
+ }
+
+ Context thisContext = new Context(thatContext, currentParent);
+ contexts[i] = thisContext;
+ if (that.currentContext == thatContext) {
+ currentContext = thisContext;
+ }
+
+ currentParent = thisContext;
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////
+ // Context management.
+ ////////////////////////////////////////////////////////////////////
+
+ /**
+ * Reset this Namespace support object for reuse.
+ *
+ * <p>It is necessary to invoke this method before reusing the
+ * Namespace support object for a new session.</p>
+ */
+ public void reset() {
+ contexts = new Context[32];
+ contextPos = 0;
+ contexts[contextPos] = currentContext = new Context();
+ currentContext.declarePrefix("xml", XMLNS);
+ }
+
+ /**
+ * Start a new Namespace context.
+ *
+ * <p>Normally, you should push a new context at the beginning
+ * of each XML element: the new context will automatically inherit
+ * the declarations of its parent context, but it will also keep
+ * track of which declarations were made within this context.</p>
+ *
+ * <p>The Namespace support object always starts with a base context
+ * already in force: in this context, only the "xml" prefix is
+ * declared.</p>
+ *
+ * @see #popContext
+ */
+ public void pushContext() {
+ int max = contexts.length;
+ contextPos++;
+
+ // Extend the array if necessary
+ if (contextPos >= max) {
+ Context newContexts[] = new Context[max * 2];
+ System.arraycopy(contexts, 0, newContexts, 0, max);
+ contexts = newContexts;
+ }
+
+ // Allocate the context if necessary.
+ currentContext = contexts[contextPos];
+ if (currentContext == null) {
+ contexts[contextPos] = currentContext = new Context();
+ }
+
+ // Set the parent, if any.
+ if (contextPos > 0) {
+ currentContext.setParent(contexts[contextPos - 1]);
+ }
+ }
+
+ /**
+ * Revert to the previous Namespace context.
+ *
+ * <p>Normally, you should pop the context at the end of each
+ * XML element. After popping the context, all Namespace prefix
+ * mappings that were previously in force are restored.</p>
+ *
+ * <p>You must not attempt to declare additional Namespace
+ * prefixes after popping a context, unless you push another
+ * context first.</p>
+ *
+ * @see #pushContext
+ */
+ public void popContext() {
+ contextPos--;
+ if (contextPos < 0) {
+ throw new EmptyStackException();
+ }
+ currentContext = contexts[contextPos];
+ }
+
+ /*
+ * added for the revised streaming parser class (Parser2)
+ * Move the context artificially up one level (i.e. contracting it).
+ */
+ public void slideContextUp() {
+ contextPos--;
+ currentContext = contexts[contextPos];
+ }
+
+ /*
+ * added for the revised streaming parser class (Parser2)
+ * Move the context artificially down one level (i.e. expanding it).
+ */
+ public void slideContextDown() {
+ contextPos++;
+
+ if (contexts[contextPos] == null) {
+ // trying to slide to a context that was never created
+ contexts[contextPos] = contexts[contextPos - 1];
+ }
+
+ currentContext = contexts[contextPos];
+ }
+
+ ////////////////////////////////////////////////////////////////////
+ // Operations within a context.
+ ////////////////////////////////////////////////////////////////////
+
+ /**
+ * Declare a Namespace prefix.
+ *
+ * <p>This method declares a prefix in the current Namespace
+ * context; the prefix will remain in force until this context
+ * is popped, unless it is shadowed in a descendant context.</p>
+ *
+ * <p>To declare a default Namespace, use the empty string. The
+ * prefix must not be "xml" or "xmlns".</p>
+ *
+ * <p>Note that you must <em>not</em> declare a prefix after
+ * you've pushed and popped another Namespace.</p>
+ *
+ * <p>Note that there is an asymmetry in this library: while {@link
+ * #getPrefix getPrefix} will not return the default "" prefix,
+ * even if you have declared one; to check for a default prefix,
+ * you have to look it up explicitly using {@link #getURI getURI}.
+ * This asymmetry exists to make it easier to look up prefixes
+ * for attribute names, where the default prefix is not allowed.</p>
+ *
+ * @param prefix The prefix to declare, or null for the empty
+ * string.
+ * @param uri The Namespace URI to associate with the prefix.
+ * @return true if the prefix was legal, false otherwise
+ * @see #processName
+ * @see #getURI
+ * @see #getPrefix
+ */
+ public boolean declarePrefix(String prefix, String uri) {
+ // bugfix#: 4989753
+ if ((prefix.equals("xml") &&
!uri.equals(SOAPNamespaceConstants.XMLNS))
+ || prefix.equals("xmlns")) {
+ return false;
+ } else {
+ currentContext.declarePrefix(prefix, uri);
+ return true;
+ }
+ }
+
+ /**
+ * Process a raw XML 1.0 name.
+ *
+ * <p>This method processes a raw XML 1.0 name in the current
+ * context by removing the prefix and looking it up among the
+ * prefixes currently declared. The return value will be the
+ * array supplied by the caller, filled in as follows:</p>
+ *
+ * <dl>
+ * <dt>parts[0]</dt>
+ * <dd>The Namespace URI, or an empty string if none is
+ * in use.</dd>
+ * <dt>parts[1]</dt>
+ * <dd>The local name (without prefix).</dd>
+ * <dt>parts[2]</dt>
+ * <dd>The original raw name.</dd>
+ * </dl>
+ *
+ * <p>All of the strings in the array will be internalized. If
+ * the raw name has a prefix that has not been declared, then
+ * the return value will be null.</p>
+ *
+ * <p>Note that attribute names are processed differently than
+ * element names: an unprefixed element name will received the
+ * default Namespace (if any), while an unprefixed element name
+ * will not.</p>
+ *
+ * @param qName The raw XML 1.0 name to be processed.
+ * @param parts An array supplied by the caller, capable of
+ * holding at least three members.
+ * @param isAttribute A flag indicating whether this is an
+ * attribute name (true) or an element name (false).
+ * @return The supplied array holding three internalized strings
+ * representing the Namespace URI (or empty string), the
+ * local name, and the raw XML 1.0 name; or null if there
+ * is an undeclared prefix.
+ * @see #declarePrefix
+ * @see java.lang.String#intern */
+ public String[] processName(
+ String qName,
+ String parts[],
+ boolean isAttribute) {
+ String myParts[] = currentContext.processName(qName, isAttribute);
+ if (myParts == null) {
+ return null;
+ } else {
+ parts[0] = myParts[0];
+ parts[1] = myParts[1];
+ parts[2] = myParts[2];
+ return parts;
+ }
+ }
+
+ /**
+ * Look up a prefix and get the currently-mapped Namespace URI.
+ *
+ * <p>This method looks up the prefix in the current context.
+ * Use the empty string ("") for the default Namespace.</p>
+ *
+ * @param prefix The prefix to look up.
+ * @return The associated Namespace URI, or null if the prefix
+ * is undeclared in this context.
+ * @see #getPrefix
+ * @see #getPrefixes
+ */
+ public String getURI(String prefix) {
+ return currentContext.getURI(prefix);
+ }
+
+ /**
+ * Return an enumeration of all prefixes currently declared.
+ *
+ * <p><strong>Note:</strong> if there is a default prefix, it will
not be
+ * returned in this enumeration; check for the default prefix
+ * using the {@link #getURI getURI} with an argument of "".</p>
+ *
+ * @return An enumeration of all prefixes declared in the
+ * current context except for the empty (default)
+ * prefix.
+ * @see #getDeclaredPrefixes
+ * @see #getURI
+ */
+ public Iterator getPrefixes() {
+ return currentContext.getPrefixes();
+ }
+
+ /**
+ * Return one of the prefixes mapped to a Namespace URI.
+ *
+ * <p>If more than one prefix is currently mapped to the same
+ * URI, this method will make an arbitrary selection; if you
+ * want all of the prefixes, use the {@link #getPrefixes}
+ * method instead.</p>
+ *
+ * <p><strong>Note:</strong> this will never return the empty
(default) prefix;
+ * to check for a default prefix, use the {@link #getURI getURI}
+ * method with an argument of "".</p>
+ *
+ * @param uri The Namespace URI.
+ * @return One of the prefixes currently mapped to the URI supplied,
+ * or null if none is mapped or if the URI is assigned to
+ * the default Namespace.
+ * @see #getPrefixes(java.lang.String)
+ * @see #getURI
+ */
+ public String getPrefix(String uri) {
+ return currentContext.getPrefix(uri);
+ }
+
+ /**
+ * Return an enumeration of all prefixes currently declared for a URI.
+ *
+ * <p>This method returns prefixes mapped to a specific Namespace
+ * URI. The xml: prefix will be included. If you want only one
+ * prefix that's mapped to the Namespace URI, and you don't care
+ * which one you get, use the {@link #getPrefix getPrefix}
+ * method instead.</p>
+ *
+ * <p><strong>Note:</strong> the empty (default) prefix is
<em>never</em> included
+ * in this enumeration; to check for the presence of a default
+ * Namespace, use the {@link #getURI getURI} method with an
+ * argument of "".</p>
+ *
+ * @param uri The Namespace URI.
+ * @return An enumeration of all prefixes declared in the
+ * current context.
+ * @see #getPrefix
+ * @see #getDeclaredPrefixes
+ * @see #getURI
+ */
+ public Iterator getPrefixes(String uri) {
+ List prefixes = new ArrayList();
+ Iterator allPrefixes = getPrefixes();
+ while (allPrefixes.hasNext()) {
+ String prefix = (String) allPrefixes.next();
+ if (uri.equals(getURI(prefix))) {
+ prefixes.add(prefix);
+ }
+ }
+ return prefixes.iterator();
+ }
+
+ /**
+ * Return an enumeration of all prefixes declared in this context.
+ *
+ * <p>The empty (default) prefix will be included in this
+ * enumeration; note that this behaviour differs from that of
+ * {@link #getPrefix} and {@link #getPrefixes}.</p>
+ *
+ * @return An enumeration of all prefixes declared in this
+ * context.
+ * @see #getPrefixes
+ * @see #getURI
+ */
+ public Iterator getDeclaredPrefixes() {
+ return currentContext.getDeclaredPrefixes();
+ }
+
+ ////////////////////////////////////////////////////////////////////
+ // Internal state.
+ ////////////////////////////////////////////////////////////////////
+
+ private Context contexts[];
+ private Context currentContext;
+ private int contextPos;
+
+ ////////////////////////////////////////////////////////////////////
+ // Internal classes.
+ ////////////////////////////////////////////////////////////////////
+
+ /**
+ * Internal class for a single Namespace context.
+ *
+ * <p>This module caches and reuses Namespace contexts, so the number
+ * allocated will be equal to the element depth of the document, not to the
+ * total number of elements (i.e. 5-10 rather than tens of thousands).</p>
+ */
+ final static class Context {
+
+ /**
+ * Create the root-level Namespace context.
+ */
+ Context() {
+ copyTables();
+ }
+ // PGB May 6 2002 added copy constructor
+ Context(Context that, Context newParent) {
+ if (that == null) {
+ copyTables();
+ return;
+ }
+
+ if (newParent != null && !that.tablesDirty) {
+ prefixTable =
+ that.prefixTable == that.parent.prefixTable
+ ? newParent.prefixTable
+ : (HashMap) that.prefixTable.clone();
+
+ uriTable =
+ that.uriTable == that.parent.uriTable
+ ? newParent.uriTable
+ : (HashMap) that.uriTable.clone();
+ elementNameTable =
+ that.elementNameTable == that.parent.elementNameTable
+ ? newParent.elementNameTable
+ : (HashMap) that.elementNameTable.clone();
+ attributeNameTable =
+ that.attributeNameTable == that.parent.attributeNameTable
+ ? newParent.attributeNameTable
+ : (HashMap) that.attributeNameTable.clone();
+ defaultNS =
+ that.defaultNS == that.parent.defaultNS
+ ? newParent.defaultNS
+ : that.defaultNS;
+ } else {
+ prefixTable = (HashMap) that.prefixTable.clone();
+ uriTable = (HashMap) that.uriTable.clone();
+ elementNameTable = (HashMap) that.elementNameTable.clone();
+ attributeNameTable = (HashMap) that.attributeNameTable.clone();
+ defaultNS = that.defaultNS;
+ }
+
+ tablesDirty = that.tablesDirty;
+ parent = newParent;
+ declarations =
+ that.declarations == null
+ ? null
+ : (ArrayList) that.declarations.clone();
+ }
+
+ /**
+ * (Re)set the parent of this Namespace context.
+ *
+ * @param parent The parent Namespace context object.
+ */
+ void setParent(Context parent) {
+ this.parent = parent;
+ declarations = null;
+ prefixTable = parent.prefixTable;
+ uriTable = parent.uriTable;
+ elementNameTable = parent.elementNameTable;
+ attributeNameTable = parent.attributeNameTable;
+ defaultNS = parent.defaultNS;
+ tablesDirty = false;
+ }
+
+ /**
+ * Declare a Namespace prefix for this context.
+ *
+ * @param prefix The prefix to declare.
+ * @param uri The associated Namespace URI.
+ * @see org.xml.sax.helpers.NamespaceSupport#declarePrefix
+ */
+ void declarePrefix(String prefix, String uri) {
+ // Lazy processing...
+ if (!tablesDirty) {
+ copyTables();
+ }
+ if (declarations == null) {
+ declarations = new ArrayList();
+ }
+
+ prefix = prefix.intern();
+ uri = uri.intern();
+ if ("".equals(prefix)) {
+ if ("".equals(uri)) {
+ defaultNS = null;
+ } else {
+ defaultNS = uri;
+ }
+ } else {
+ prefixTable.put(prefix, uri);
+ uriTable.put(uri, prefix); // may wipe out another prefix
+ }
+ declarations.add(prefix);
+ }
+
+ /**
+ * Process a raw XML 1.0 name in this context.
+ *
+ * @param qName The raw XML 1.0 name.
+ * @param isAttribute true if this is an attribute name.
+ * @return An array of three strings containing the
+ * URI part (or empty string), the local part,
+ * and the raw name, all internalized, or null
+ * if there is an undeclared prefix.
+ * @see org.xml.sax.helpers.NamespaceSupport#processName
+ */
+ String[] processName(String qName, boolean isAttribute) {
+ String name[];
+ Map table;
+
+ // Select the appropriate table.
+ if (isAttribute) {
+ table = elementNameTable;
+ } else {
+ table = attributeNameTable;
+ }
+
+ // Start by looking in the cache, and
+ // return immediately if the name
+ // is already known in this content
+ name = (String[]) table.get(qName);
+ if (name != null) {
+ return name;
+ }
+
+ // We haven't seen this name in this
+ // context before.
+ name = new String[3];
+ int index = qName.indexOf(':');
+
+ // No prefix.
+ if (index == -1) {
+ if (isAttribute || defaultNS == null) {
+ name[0] = "";
+ } else {
+ name[0] = defaultNS;
+ }
+ name[1] = qName.intern();
+ name[2] = name[1];
+ }
+
+ // Prefix
+ else {
+ String prefix = qName.substring(0, index);
+ String local = qName.substring(index + 1);
+ String uri;
+ if ("".equals(prefix)) {
+ uri = defaultNS;
+ } else {
+ uri = (String) prefixTable.get(prefix);
+ }
+ if (uri == null) {
+ return null;
+ }
+ name[0] = uri;
+ name[1] = local.intern();
+ name[2] = qName.intern();
+ }
+
+ // Save in the cache for future use.
+ table.put(name[2], name);
+ tablesDirty = true;
+ return name;
+ }
+
+ /**
+ * Look up the URI associated with a prefix in this context.
+ *
+ * @param prefix The prefix to look up.
+ * @return The associated Namespace URI, or null if none is
+ * declared.
+ * @see org.xml.sax.helpers.NamespaceSupport#getURI
+ */
+ String getURI(String prefix) {
+ if ("".equals(prefix)) {
+ return defaultNS;
+ } else if (prefixTable == null) {
+ return null;
+ } else {
+ return (String) prefixTable.get(prefix);
+ }
+ }
+
+ /**
+ * Look up one of the prefixes associated with a URI in this context.
+ *
+ * <p>Since many prefixes may be mapped to the same URI,
+ * the return value may be unreliable.</p>
+ *
+ * @param uri The URI to look up.
+ * @return The associated prefix, or null if none is declared.
+ * @see org.xml.sax.helpers.NamespaceSupport#getPrefix
+ */
+ String getPrefix(String uri) {
+ if (uriTable == null) {
+ return null;
+ } else {
+ return (String) uriTable.get(uri);
+ }
+ }
+
+ /**
+ * Return an enumeration of prefixes declared in this context.
+ *
+ * @return An enumeration of prefixes (possibly empty).
+ * @see org.xml.sax.helpers.NamespaceSupport#getDeclaredPrefixes
+ */
+ Iterator getDeclaredPrefixes() {
+ if (declarations == null) {
+ return EMPTY_ENUMERATION;
+ } else {
+ return declarations.iterator();
+ }
+ }
+
+ /**
+ * Return an enumeration of all prefixes currently in force.
+ *
+ * <p>The default prefix, if in force, is <em>not</em>
+ * returned, and will have to be checked for separately.</p>
+ *
+ * @return An enumeration of prefixes (never empty).
+ * @see org.xml.sax.helpers.NamespaceSupport#getPrefixes
+ */
+ Iterator getPrefixes() {
+ if (prefixTable == null) {
+ return EMPTY_ENUMERATION;
+ } else {
+ return prefixTable.keySet().iterator();
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////
+ // Internal methods.
+ ////////////////////////////////////////////////////////////////
+
+ /**
+ * Copy on write for the internal tables in this context.
+ *
+ * <p>This class is optimized for the normal case where most
+ * elements do not contain Namespace declarations.</p>
+ */
+ private void copyTables() {
+ if (prefixTable != null) {
+ prefixTable = (HashMap) prefixTable.clone();
+ } else {
+ prefixTable = new HashMap();
+ }
+ if (uriTable != null) {
+ uriTable = (HashMap) uriTable.clone();
+ } else {
+ uriTable = new HashMap();
+ }
+ elementNameTable = new HashMap();
+ attributeNameTable = new HashMap();
+ tablesDirty = true;
+ }
+
+ ////////////////////////////////////////////////////////////////
+ // Protected state.
+ ////////////////////////////////////////////////////////////////
+
+ HashMap prefixTable;
+ HashMap uriTable;
+ // PBG May 6 2002 changed these two from Map to HashMap
+ HashMap elementNameTable;
+ HashMap attributeNameTable;
+ String defaultNS = null;
+
+ ////////////////////////////////////////////////////////////////
+ // Internal state.
+ ////////////////////////////////////////////////////////////////
+
+ // PBG May 6 2002 changed this from List to ArrayList
+ private ArrayList declarations = null;
+ private boolean tablesDirty = false;
+ private Context parent = null;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/NamespaceSupport.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/NullIterator.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/NullIterator.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/NullIterator.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,55 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.util;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+/**
+ * An Iterator on an empty collection.
+ *
+ * @author WS Development Team
+ */
+public final class NullIterator implements Iterator {
+
+ public static NullIterator getInstance() {
+ return _instance;
+ }
+
+ private static final NullIterator _instance = new NullIterator();
+
+ private NullIterator() {
+ }
+
+ public boolean hasNext() {
+ return false;
+ }
+
+ public Object next() {
+ throw new NoSuchElementException();
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/NullIterator.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/RuntimeVersion.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/RuntimeVersion.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/RuntimeVersion.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,34 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.util;
+
+/**
+ * Obtains the version number of the JAX-WS runtime.
+ *
+ * @author Kohsuke Kawaguchi
+ */
+public abstract class RuntimeVersion {
+ private RuntimeVersion() {} // no instanciation please
+
+ public static final Version VERSION =
Version.create(RuntimeVersion.class.getResourceAsStream("version.properties"));
+}
\ No newline at end of file
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/RuntimeVersion.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/SOAPConnectionUtil.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/SOAPConnectionUtil.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/SOAPConnectionUtil.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,215 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.util;
+
+import org.jboss.com.sun.xml.messaging.saaj.util.ByteInputStream;
+
+import javax.xml.soap.MimeHeader;
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.soap.SOAPBinding;
+
+import org.jboss.com.sun.xml.ws.binding.BindingImpl;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.server.RuntimeContext;
+import org.jboss.com.sun.xml.ws.server.RuntimeEndpointInfo;
+import org.jboss.com.sun.xml.ws.spi.runtime.WSConnection;
+
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import static
org.jboss.com.sun.xml.ws.developer.JAXWSProperties.CONTENT_NEGOTIATION_PROPERTY;
+
+/**
+ * @author WS Development Team
+ */
+public class SOAPConnectionUtil {
+
+ public static SOAPMessage getSOAPMessage(WSConnection con, MessageInfo mi, String
bindingId) {
+ try {
+ Map<String, List<String>> headers = con.getHeaders();
+ MimeHeaders mh = new MimeHeaders();
+ if (headers != null)
+ for (Map.Entry<String, List<String>> entry :
headers.entrySet()) {
+ String name = entry.getKey();
+ for (String value : entry.getValue()) {
+ try {
+ mh.addHeader(name, value);
+ } catch(IllegalArgumentException ie) {
+ // Not a mime header. Ignore it.
+ }
+ }
+ }
+ RuntimeContext rtCtxt = MessageInfoUtil.getRuntimeContext(mi);
+ if (rtCtxt != null) {
+ RuntimeEndpointInfo endpointInfo = rtCtxt.getRuntimeEndpointInfo();
+ if (bindingId == null)
+ bindingId = ((BindingImpl)
endpointInfo.getBinding()).getBindingId();
+ }
+ SOAPMessage soapMessage = SOAPUtil.createMessage(mh,
+ con.getInput(), bindingId);
+ return soapMessage;
+ } catch (Exception e) {
+// e.printStackTrace();
+ throw new WebServiceException(e);
+ }
+ }
+
+ private static void send(WSConnection con, SOAPMessage soapMessage) {
+ try {
+ if (soapMessage.saveRequired()) {
+ soapMessage.saveChanges();
+ }
+ Map<String, List<String>> headers = new HashMap<String,
List<String>>();
+ MimeHeaders mhs = soapMessage.getMimeHeaders();
+ Iterator i = mhs.getAllHeaders();
+ while (i.hasNext()) {
+ MimeHeader mh = (MimeHeader) i.next();
+ String name = mh.getName();
+ List<String> values = headers.get(name);
+ if (values == null) {
+ values = new ArrayList<String>();
+ headers.put(name, values);
+ }
+ values.add(mh.getValue());
+ }
+ con.setHeaders(headers);
+ soapMessage.writeTo(con.getOutput());
+ con.closeOutput();
+ } catch (Exception e) {
+ throw new WebServiceException(e);
+ }
+ }
+
+ public static void sendResponse(WSConnection con, SOAPMessage soapMessage) {
+ //setStatus(con, WSConnection.OK);
+ send(con, soapMessage);
+ }
+
+ public static void sendKnownError(MessageInfo messageInfo, int status) {
+ WSConnection con = (WSConnection)messageInfo.getConnection();
+ setStatus(con, status);
+ con.getOutput();
+ con.closeOutput();
+ }
+
+ public static void sendResponseOneway(MessageInfo messageInfo) {
+ WSConnection con = (WSConnection)messageInfo.getConnection();
+ setStatus(con, WSConnection.ONEWAY);
+ con.getOutput();
+
+ // Ensure conneg is completed even if no data is sent back
+ if (messageInfo.getMetaData(CONTENT_NEGOTIATION_PROPERTY) ==
"optimistic") {
+ List<String> acceptList = null;
+ List<String> contentTypeList = null;
+ Map<String, List<String>> headers = con.getHeaders();
+
+ // Go through the entries because a gets are case sensitive
+ for (Map.Entry<String, List<String>> entry : headers.entrySet())
{
+ if (entry.getKey().equalsIgnoreCase("content-type")) {
+ contentTypeList = entry.getValue();
+ }
+ else if (entry.getKey().equalsIgnoreCase("accept")) {
+ acceptList = entry.getValue();
+ }
+ }
+
+ // If content-type is FI, FI must be listed in the accept header
+ assert contentTypeList != null && acceptList != null;
+
+ // Use FI MIME type based on Accept header
+ contentTypeList.set(0,
+ FastInfosetUtil.getFastInfosetFromAccept(acceptList));
+ }
+
+ con.closeOutput();
+ }
+
+ public static void sendResponseError(WSConnection con, String bindingId) {
+ try {
+ SOAPMessage message = SOAPUtil.createMessage(bindingId);
+ ByteArrayBuffer bufferedStream = new ByteArrayBuffer();
+ Writer writer = new OutputStreamWriter(bufferedStream, "UTF-8");
+ if(bindingId.equals(SOAPBinding.SOAP12HTTP_BINDING))
+ writer.write(DEFAULT_SERVER_ERROR_SOAP12_ENVELOPE);
+ else
+ writer.write(DEFAULT_SERVER_ERROR_ENVELOPE);
+ writer.close();
+ message.getSOAPPart().setContent(new
StreamSource(bufferedStream.newInputStream()));
+ setStatus(con, WSConnection.INTERNAL_ERR);
+ send(con, message);
+ } catch (Exception e) {
+ throw new WebServiceException(e);
+ }
+ }
+
+ public static Map<String, List<String>> getHeaders(WSConnection con) {
+ return con.getHeaders();
+ }
+
+ /**
+ * sets response headers.
+ */
+ public static void setHeaders(WSConnection con,
+ Map<String, List<String>> headers) {
+ con.setHeaders(headers);
+ }
+
+ public static void setStatus(WSConnection con, int status) {
+ con.setStatus(status);
+ }
+
+ private final static String DEFAULT_SERVER_ERROR_ENVELOPE =
+ "<?xml version='1.0' encoding='UTF-8'?>"
+ + "<env:Envelope
xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\">"
+ + "<env:Body>"
+ + "<env:Fault>"
+ + "<faultcode>env:Server</faultcode>"
+ + "<faultstring>Internal server error</faultstring>"
+ + "</env:Fault>"
+ + "</env:Body>"
+ + "</env:Envelope>";
+
+ private final static String DEFAULT_SERVER_ERROR_SOAP12_ENVELOPE =
+ "<?xml version='1.0' encoding='UTF-8'?>"
+ + "<env:Envelope
xmlns:env=\"http://www.w3.org/2003/05/soap-envelope\">"
+ + "<env:Body>"
+ + "<env:Fault>"
+ +
"<env:Code><env:Value>env:Receiver</env:Value></env:Code>"
+ + "<env:Reason><env:Text lang=\""+
Locale.getDefault().getLanguage() +"\">"
+ + "Internal server error</env:Text></env:Reason>"
+ + "</env:Fault>"
+ + "</env:Body>"
+ + "</env:Envelope>";
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/SOAPConnectionUtil.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/SOAPUtil.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/SOAPUtil.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/SOAPUtil.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,184 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import javax.xml.soap.*;
+import javax.xml.ws.soap.SOAPBinding;
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.xml.ws.encoding.soap.message.SOAPMsgCreateException;
+import org.jboss.com.sun.xml.ws.encoding.soap.message.SOAPMsgFactoryCreateException;
+import org.w3c.dom.*;
+import org.w3c.dom.Node;
+
+/**
+ * $author: JAXWS Development Team
+ */
+
+/**
+ * Has utility methods to create SOAPMessage
+ */
+public class SOAPUtil {
+
+ private static final MessageFactory soap11messageFactory =
+ createMessageFactory(SOAPConstants.SOAP_1_1_PROTOCOL);
+ private static final MessageFactory soap12messageFactory =
+ createMessageFactory(SOAPConstants.SOAP_1_2_PROTOCOL);
+ private static final SOAPFactory soap11Factory =
createSOAPFactory(SOAPConstants.SOAP_1_1_PROTOCOL);
+ private static final SOAPFactory soap12Factory =
createSOAPFactory(SOAPConstants.SOAP_1_2_PROTOCOL);
+
+ private static SOAPFactory createSOAPFactory(String soapProtocol) {
+ try {
+ return SOAPFactory.newInstance(soapProtocol);
+ } catch(SOAPException e) {
+ throw new SOAPMsgFactoryCreateException(
+ "soap.factory.create.err",
+ new Object[] { e });
+ }
+ }
+
+ /**
+ *
+ * @param bindingId
+ * @return
+ * returns SOAPFactor for SOAP 1.2 if bindingID equals SOAP1.2 HTTP binding
else
+ * SOAPFactory for SOAP 1.1
+ */
+ public static SOAPFactory getSOAPFactory(String bindingId){
+ if(bindingId.equals(SOAPBinding.SOAP12HTTP_BINDING)){
+ return soap12Factory;
+ }
+ return soap11Factory;
+ }
+
+ public static SOAPFault createSOAPFault(String bindingId){
+ if(bindingId == null)
+ bindingId = SOAPBinding.SOAP11HTTP_BINDING;
+ try {
+ if(bindingId.equals(SOAPBinding.SOAP12HTTP_BINDING))
+ return soap12Factory.createFault();
+ return soap11Factory.createFault();
+ } catch (SOAPException e) {
+ throw new SOAPMsgFactoryCreateException(
+ "soap.fault.create.err",
+ new Object[] { e });
+ }
+ }
+
+ /**
+ * Creates SOAP 1.1 or SOAP 1.2 SOAPFault based on the bindingId
+ * @param msg
+ * @param code
+ * @param actor
+ * @param detail
+ * @return the created SOAPFault
+ */
+ public static SOAPFault createSOAPFault(String msg, QName code, String actor, Detail
detail, String bindingId){
+ if(bindingId == null)
+ bindingId = SOAPBinding.SOAP11HTTP_BINDING;
+ try {
+ SOAPFault fault = null;
+ if(bindingId.equals(SOAPBinding.SOAP12HTTP_BINDING))
+ fault = soap12Factory.createFault(msg, code);
+ else if(bindingId.equals(SOAPBinding.SOAP11HTTP_BINDING))
+ fault = soap11Factory.createFault(msg, code);
+ if(actor != null)
+ fault.setFaultActor(actor);
+ if(detail != null){
+ Node n = fault.getOwnerDocument().importNode(detail, true);
+ fault.appendChild(n);
+ }
+ return fault;
+ } catch (SOAPException e) {
+ throw new SOAPMsgFactoryCreateException(
+ "soap.fault.create.err",
+ new Object[] { e });
+ }
+ }
+
+ public static SOAPMessage createMessage() {
+ return createMessage(SOAPBinding.SOAP11HTTP_BINDING);
+ }
+
+ /**
+ *
+ * @param binding
+ * @return a <code>SOAPMessage</code> associated with
<code>binding</code>
+ */
+ public static SOAPMessage createMessage(String binding) {
+ try {
+ return getMessageFactory(binding).createMessage();
+ } catch (SOAPException e) {
+ throw new SOAPMsgCreateException(
+ "soap.msg.create.err",
+ new Object[] { e });
+ }
+ }
+
+ /**
+ *
+ * @param binding
+ * @param headers
+ * @param in
+ * @return <code>SOAPMessage</code> with
<code>MimeHeaders</code> from an
+ * <code>InputStream</code> and binding.
+ * @throws IOException
+ */
+ public static SOAPMessage createMessage(MimeHeaders headers, InputStream in,
+ String binding) throws IOException {
+ try {
+ return getMessageFactory(binding).createMessage(headers, in);
+ } catch (SOAPException e) {
+ throw new SOAPMsgCreateException(
+ "soap.msg.create.err",
+ new Object[] { e });
+ }
+ }
+
+ public static SOAPMessage createMessage(MimeHeaders headers, InputStream in)
+ throws IOException {
+ return createMessage(headers, in, SOAPBinding.SOAP11HTTP_BINDING);
+ }
+
+ public static MessageFactory getMessageFactory(String binding) {
+ if (binding.equals(SOAPBinding.SOAP11HTTP_BINDING)) {
+ return soap11messageFactory;
+ } else if (binding.equals(SOAPBinding.SOAP12HTTP_BINDING)) {
+ return soap12messageFactory;
+ }
+ return soap11messageFactory;
+ }
+
+ private static MessageFactory createMessageFactory(String bindingId) {
+ try {
+ return MessageFactory.newInstance(bindingId);
+ } catch(SOAPException e) {
+ throw new SOAPMsgFactoryCreateException(
+ "soap.msg.factory.create.err",
+ new Object[] { e });
+ }
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/SOAPUtil.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/StringUtils.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/StringUtils.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/StringUtils.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,76 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.util;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public class StringUtils {
+
+ /**
+ * Utility method to take a string and convert it to normal Java variable
+ * name capitalization. This normally means converting the first
+ * character from upper case to lower case, but in the (unusual) special
+ * case when there is more than one character and both the first and
+ * second characters are upper case, we leave it alone.
+ * <p>
+ * Thus "FooBah" becomes "fooBah" and "X" becomes
"x", but "URL" stays
+ * as "URL".
+ *
+ * @param name The string to be decapitalized.
+ * @return The decapitalized version of the string.
+ */
+ public static String decapitalize(String name) {
+ if (name == null || name.length() == 0) {
+ return name;
+ }
+ if (name.length() > 1 &&
+ Character.isUpperCase(name.charAt(1)) &&
+ Character.isUpperCase(name.charAt(0))) {
+
+ return name;
+ }
+ char chars[] = name.toCharArray();
+ chars[0] = Character.toLowerCase(chars[0]);
+ return new String(chars);
+ }
+
+ /**
+ * Utility method to take a string and convert it to normal a string
+ * with the first character in upper case.
+ * <p>
+ * Thus "fooBah" becomes "FooBah" and "x" becomes
"X".\
+ *
+ * @param name The string to be capitalized.
+ * @return The capitalized version of the string.
+ */
+ public static String capitalize(String name) {
+ if (name == null || name.length() == 0) {
+ return name;
+ }
+ char chars[] = name.toCharArray();
+ chars[0] = Character.toUpperCase(chars[0]);
+ return new String(chars);
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/StringUtils.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/SunStAXReflection.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/SunStAXReflection.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/SunStAXReflection.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,52 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.util;
+
+import java.lang.reflect.Method;
+
+public class SunStAXReflection {
+ /**
+ * Sun StAX impl <code>XMLReaderImpl.setInputSource()</code> method via
reflection.
+ */
+ public static Method XMLReaderImpl_setInputSource;
+
+ /**
+ * Sun StAX impl <code>XMLReaderImpl.reset()</code> method via
reflection.
+ */
+ public static Method XMLReaderImpl_reset;
+
+ static {
+ try {
+ Class clazz = Class.forName("com.sun.xml.stream.XMLReaderImpl");
+ // Are we running on top of JAXP 1.4?
+ if (clazz == null) {
+ clazz =
Class.forName("com.sun.xml.stream.XMLStreamReaderImpl");
+ }
+ XMLReaderImpl_setInputSource =
+ clazz.getMethod("setInputSource",
org.xml.sax.InputSource.class);
+ XMLReaderImpl_reset = clazz.getMethod("reset");
+ } catch (Exception e) {
+ // falls through
+ }
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/SunStAXReflection.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/UtilException.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/UtilException.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/UtilException.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,53 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.util;
+
+import org.jboss.com.sun.xml.ws.util.exception.JAXWSExceptionBase;
+import org.jboss.com.sun.xml.ws.util.localization.Localizable;
+
+/**
+ * UtilException represents an exception that occurred while
+ * one of the util classes is operating.
+ *
+ * @see JAXWSExceptionBase
+ *
+ * @author JAX-WS Development Team
+ */
+public class UtilException extends JAXWSExceptionBase {
+ public UtilException(String key, Object... args) {
+ super(key, args);
+ }
+
+ public UtilException(Throwable throwable) {
+ super(throwable);
+ }
+
+ public UtilException(Localizable arg) {
+ super("nestedUtilError", arg);
+ }
+
+ public String getResourceBundleName() {
+ return "org.jboss.com.sun.xml.ws.resources.util";
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/UtilException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/Version.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/Version.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/Version.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,71 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.util;
+
+import java.io.InputStream;
+import java.io.IOException;
+import java.util.Properties;
+
+/**
+ * Represents the version information.
+ *
+ * @author Kohsuke Kawaguchi
+ */
+public final class Version {
+ /**
+ * Represents the build id, which is a string like "b13" or
"hudson-250".
+ */
+ public final String BUILD_ID;
+ /**
+ * Represents the complete version string, such as "JAX-WS RI 2.0-b19"
+ */
+ public final String BUILD_VERSION;
+ /**
+ * Represents the major JAX-WS version, such as "2.0".
+ */
+ public final String MAJOR_VERSION;
+
+ private Version(String buildId, String buildVersion, String majorVersion) {
+ this.BUILD_ID = fixNull(buildId);
+ this.BUILD_VERSION = fixNull(buildVersion);
+ this.MAJOR_VERSION = fixNull(majorVersion);
+ }
+
+ public static Version create(InputStream is) {
+ Properties props = new Properties();
+ try {
+ props.load(is);
+ } catch (IOException e) {
+ // ignore even if the property was not found. we'll treat everything as
unknown
+ }
+ return new Version(
+ props.getProperty("build-id"),
+ props.getProperty("build-version"),
+ props.getProperty("major-version"));
+ }
+
+ private String fixNull(String v) {
+ if(v==null) return "unknown";
+ return v;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/Version.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/VersionUtil.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/VersionUtil.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/VersionUtil.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,164 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.util;
+
+import java.util.StringTokenizer;
+
+
+/**
+ * Provides some version utilities.
+ *
+ * @author JAX-WS Development Team
+ */
+
+public final class VersionUtil {
+
+ public static boolean isVersion20(String version) {
+ return JAXWS_VERSION_20.equals(version);
+ }
+
+ /**
+ * @param version
+ * @return true if version is a 2.0 version
+ */
+ public static boolean isValidVersion(String version) {
+ return isVersion20(version);
+ }
+
+ public static String getValidVersionString() {
+ return JAXWS_VERSION_20;
+ }
+
+ /**
+ * BugFix# 4948171
+ * Method getCanonicalVersion.
+ *
+ * Converts a given version to the format "a.b.c.d"
+ * a - major version
+ * b - minor version
+ * c - minor minor version
+ * d - patch version
+ *
+ * @return int[] Canonical version number
+ */
+ public static int[] getCanonicalVersion(String version) {
+ int[] canonicalVersion = new int[4];
+
+ // initialize the default version numbers
+ canonicalVersion[0] = 1;
+ canonicalVersion[1] = 1;
+ canonicalVersion[2] = 0;
+ canonicalVersion[3] = 0;
+
+ final String DASH_DELIM = "_";
+ final String DOT_DELIM = ".";
+
+ StringTokenizer tokenizer =
+ new StringTokenizer(version, DOT_DELIM);
+ String token = tokenizer.nextToken();
+
+ // first token is major version and must not have "_"
+ canonicalVersion[0] = Integer.parseInt(token);
+
+ // resolve the minor version
+ token = tokenizer.nextToken();
+ if (token.indexOf(DASH_DELIM) == -1) {
+ // a.b
+ canonicalVersion[1] = Integer.parseInt(token);
+ } else {
+ // a.b_c
+ StringTokenizer subTokenizer =
+ new StringTokenizer(token, DASH_DELIM);
+ canonicalVersion[1] = Integer.parseInt(subTokenizer.nextToken());
+ // leave minorMinor default
+
+ canonicalVersion[3] = Integer.parseInt(subTokenizer.nextToken());
+ }
+
+ // resolve the minorMinor and patch version, if any
+ if (tokenizer.hasMoreTokens()) {
+ token = tokenizer.nextToken();
+ if (token.indexOf(DASH_DELIM) == -1) {
+ // minorMinor
+ canonicalVersion[2] = Integer.parseInt(token);
+
+ // resolve patch, if any
+ if (tokenizer.hasMoreTokens())
+ canonicalVersion[3] = Integer.parseInt(tokenizer.nextToken());
+ } else {
+ // a.b.c_d
+ StringTokenizer subTokenizer =
+ new StringTokenizer(token, DASH_DELIM);
+ // minorMinor
+ canonicalVersion[2] = Integer.parseInt(subTokenizer.nextToken());
+
+ // patch
+ canonicalVersion[3] = Integer.parseInt(subTokenizer.nextToken());
+ }
+ }
+
+ return canonicalVersion;
+ }
+
+ /**
+ *
+ * @param version1
+ * @param version2
+ * @return -1, 0 or 1 based upon the comparison results
+ * -1 if version1 is less than version2
+ * 0 if version1 is equal to version2
+ * 1 if version1 is greater than version2
+ */
+ public static int compare(String version1, String version2) {
+ int[] canonicalVersion1 = getCanonicalVersion(version1);
+ int[] canonicalVersion2 = getCanonicalVersion(version2);
+
+ if (canonicalVersion1[0] < canonicalVersion2[0]) {
+ return -1;
+ } else if (canonicalVersion1[0] > canonicalVersion2[0]) {
+ return 1;
+ } else {
+ if (canonicalVersion1[1] < canonicalVersion2[1]) {
+ return -1;
+ } else if (canonicalVersion1[1] > canonicalVersion2[1]) {
+ return 1;
+ } else {
+ if (canonicalVersion1[2] < canonicalVersion2[2]) {
+ return -1;
+ } else if (canonicalVersion1[2] > canonicalVersion2[2]) {
+ return 1;
+ } else {
+ if (canonicalVersion1[3] < canonicalVersion2[3]) {
+ return -1;
+ } else if (canonicalVersion1[3] > canonicalVersion2[3]) {
+ return 1;
+ } else
+ return 0;
+ }
+ }
+ }
+ }
+
+ public static final String JAXWS_VERSION_20 = "2.0";
+ // the latest version is default
+ public static final String JAXWS_VERSION_DEFAULT = JAXWS_VERSION_20;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/VersionUtil.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/WSRtObjectFactoryImpl.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/WSRtObjectFactoryImpl.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/WSRtObjectFactoryImpl.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,112 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.util;
+
+import java.io.OutputStream;
+
+
+import java.net.URL;
+import java.util.List;
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.ws.http.HTTPBinding;
+import javax.xml.ws.soap.SOAPBinding;
+
+import org.jboss.com.sun.xml.ws.binding.http.HTTPBindingImpl;
+import org.jboss.com.sun.xml.ws.binding.soap.SOAPBindingImpl;
+import org.jboss.com.sun.xml.ws.handler.MessageContextImpl;
+import org.jboss.com.sun.xml.ws.server.RuntimeEndpointInfo;
+import org.jboss.com.sun.xml.ws.server.Tie;
+import org.jboss.com.sun.xml.ws.spi.runtime.ClientTransportFactory;
+import org.jboss.com.sun.xml.ws.spi.runtime.ClientTransportFactoryTypes;
+import org.jboss.com.sun.xml.ws.spi.runtime.WSConnection;
+import org.jboss.com.sun.xml.ws.transport.http.servlet.ServletConnectionImpl;
+import org.jboss.com.sun.xml.ws.transport.http.servlet.WSServlet;
+import org.jboss.com.sun.xml.ws.util.xml.XmlUtil;
+import org.xml.sax.EntityResolver;
+import javax.xml.ws.handler.MessageContext;
+
+/**
+ * Singleton factory class to instantiate concrete objects.
+ *
+ * @author JAX-WS Development Team
+ */
+public class WSRtObjectFactoryImpl
+ extends org.jboss.com.sun.xml.ws.spi.runtime.WSRtObjectFactory {
+
+ @Override
+ public org.jboss.com.sun.xml.ws.spi.runtime.RuntimeEndpointInfo
createRuntimeEndpointInfo() {
+ return new RuntimeEndpointInfo();
+ }
+
+ /**
+ * Creates a connection for servlet transport
+ */
+ @Override
+ public WSConnection createWSConnection(HttpServletRequest req,
+ HttpServletResponse res) {
+ return new ServletConnectionImpl(req, res);
+ }
+
+ @Override
+ public org.jboss.com.sun.xml.ws.spi.runtime.SOAPMessageContext
createSOAPMessageContext() {
+ return null;
+ }
+
+ @Override
+ public org.jboss.com.sun.xml.ws.spi.runtime.Tie createTie() {
+ return new Tie();
+ }
+
+ @Override
+ public MessageContext createMessageContext() {
+ return new MessageContextImpl();
+ }
+
+ @Override
+ public org.jboss.com.sun.xml.ws.spi.runtime.Binding createBinding(String bindingId)
{
+ if (bindingId.equals(SOAPBinding.SOAP11HTTP_BINDING) ||
+ bindingId.equals(SOAPBinding.SOAP12HTTP_BINDING) ||
+ bindingId.equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING) ||
+ bindingId.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING)) {
+ return new SOAPBindingImpl(bindingId);
+ } else if (bindingId.equals(HTTPBinding.HTTP_BINDING)) {
+ return new HTTPBindingImpl();
+ }
+ return new SOAPBindingImpl(SOAPBinding.SOAP11HTTP_BINDING);
+ }
+
+ /**
+ * creates an EntityResolver for the XML Catalog URL
+ */
+ @Override
+ public EntityResolver createEntityResolver(URL catalogUrl) {
+ return XmlUtil.createEntityResolver(catalogUrl);
+ }
+
+ public List<org.jboss.com.sun.xml.ws.spi.runtime.RuntimeEndpointInfo>
getRuntimeEndpointInfos(
+ ServletContext ctxt) {
+ return
(List<org.jboss.com.sun.xml.ws.spi.runtime.RuntimeEndpointInfo>)ctxt.getAttribute(
+ WSServlet.JAXWS_RI_RUNTIME_INFO);
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/WSRtObjectFactoryImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/XMLConnectionUtil.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/XMLConnectionUtil.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/XMLConnectionUtil.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,147 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.util;
+
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.http.HTTPException;
+import javax.xml.soap.MimeHeader;
+import javax.xml.soap.MimeHeaders;
+import java.io.ByteArrayInputStream;
+import java.net.HttpURLConnection;
+import javax.xml.transform.stream.StreamSource;
+
+import org.jboss.com.sun.xml.ws.encoding.xml.XMLMessage;
+import org.jboss.com.sun.xml.ws.pept.ept.MessageInfo;
+import org.jboss.com.sun.xml.ws.spi.runtime.WSConnection;
+
+import static
org.jboss.com.sun.xml.ws.developer.JAXWSProperties.CONTENT_NEGOTIATION_PROPERTY;
+
+/**
+ * @author WS Development Team
+ */
+public class XMLConnectionUtil {
+
+ public static XMLMessage getXMLMessage(WSConnection con, MessageInfo mi) {
+ try {
+ Map<String, List<String>> headers = con.getHeaders();
+ MimeHeaders mh = new MimeHeaders();
+ if (headers != null) {
+ for (Map.Entry<String, List<String>> entry :
headers.entrySet())
+ {
+ String name = entry.getKey();
+ for (String value : entry.getValue()) {
+ try {
+ mh.addHeader(name, value);
+ } catch (IllegalArgumentException ie) {
+ // Not a mime header. Ignore it.
+ }
+ }
+ }
+ }
+ return new XMLMessage(mh, con.getInput());
+ } catch (Exception e) {
+ throw (HTTPException)new
HTTPException(HttpURLConnection.HTTP_INTERNAL_ERROR).initCause(e);
+ }
+ }
+
+ private static void send(WSConnection con, XMLMessage xmlMessage) {
+ try {
+ Map<String, List<String>> headers = new HashMap<String,
List<String>>();
+ MimeHeaders mhs = xmlMessage.getMimeHeaders();
+ Iterator i = mhs.getAllHeaders();
+ while (i.hasNext()) {
+ MimeHeader mh = (MimeHeader) i.next();
+ String name = mh.getName();
+ List<String> values = headers.get(name);
+ if (values == null) {
+ values = new ArrayList<String>();
+ headers.put(name, values);
+ }
+ values.add(mh.getValue());
+ }
+ con.setHeaders(headers);
+ xmlMessage.writeTo(con.getOutput());
+
+ } catch (Exception e) {
+ throw (HTTPException)new
HTTPException(HttpURLConnection.HTTP_INTERNAL_ERROR).initCause(e);
+ }
+ try {
+ con.closeOutput();
+ } catch (Exception e) {
+ throw (HTTPException)new
HTTPException(HttpURLConnection.HTTP_INTERNAL_ERROR).initCause(e);
+ }
+ }
+
+ public static void sendResponse(WSConnection con, XMLMessage xmlMessage) {
+ setStatus(con, xmlMessage.getStatus());
+ send(con, xmlMessage);
+ }
+
+ public static void sendResponseOneway(WSConnection con) {
+ setStatus(con, WSConnection.ONEWAY);
+ con.getOutput();
+ con.closeOutput();
+ }
+
+ public static void sendResponseError(WSConnection con, MessageInfo messageInfo) {
+ try {
+ StreamSource source = new StreamSource(
+ new ByteArrayInputStream(DEFAULT_SERVER_ERROR.getBytes()));
+ String conneg = (String)
messageInfo.getMetaData(CONTENT_NEGOTIATION_PROPERTY);
+ XMLMessage message = new XMLMessage(source, conneg ==
"optimistic");
+ setStatus(con, WSConnection.INTERNAL_ERR);
+ send(con, message);
+ }
+ catch (Exception e) {
+ throw new WebServiceException(e);
+ }
+ }
+
+ public static Map<String, List<String>> getHeaders(WSConnection con) {
+ return con.getHeaders();
+ }
+
+ /**
+ * sets response headers.
+ */
+ public static void setHeaders(WSConnection con,
+ Map<String, List<String>> headers) {
+ con.setHeaders(headers);
+ }
+
+ public static void setStatus(WSConnection con, int status) {
+ con.setStatus(status);
+ }
+
+ private final static String DEFAULT_SERVER_ERROR =
+ "<?xml version='1.0' encoding='UTF-8'?>"
+ + "<err>Internal Server Error</err>";
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/XMLConnectionUtil.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/exception/JAXWSExceptionBase.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/exception/JAXWSExceptionBase.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/exception/JAXWSExceptionBase.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,87 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.util.exception;
+
+
+import javax.xml.ws.WebServiceException;
+
+import org.jboss.com.sun.xml.ws.util.localization.Localizable;
+import org.jboss.com.sun.xml.ws.util.localization.Localizer;
+
+/**
+ * Represents a {@link WebServiceException} with
+ * localizable message.
+ *
+ * @author WS Development Team
+ */
+public abstract class JAXWSExceptionBase
+ extends WebServiceException implements Localizable {
+
+ private final String key;
+ private final Object[] args;
+
+ protected JAXWSExceptionBase(String key, Object... args) {
+ super(findNestedException(args));
+ if(args==null) args = new Object[0];
+ this.key = key;
+ this.args = args;
+ }
+
+ /**
+ * Creates a new exception that wraps the specified exception.
+ */
+ protected JAXWSExceptionBase(Throwable throwable) {
+ super(throwable);
+ this.key = Localizable.NOT_LOCALIZABLE;
+ this.args = new Object[]{throwable.toString()};
+ }
+
+ private static Throwable findNestedException(Object[] args) {
+ if (args == null)
+ return null;
+
+ for( Object o : args )
+ if(o instanceof Throwable)
+ return (Throwable)o;
+ return null;
+ }
+
+ public String getKey() {
+ return key;
+ }
+
+ public Object[] getArguments() {
+ return args;
+ }
+
+ public String toString() {
+ // for debug purposes only
+ //return getClass().getName() + " (" + getKey() + ")";
+ return getMessage();
+ }
+
+ public String getMessage() {
+ Localizer localizer = new Localizer();
+ return localizer.localize(this);
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/exception/JAXWSExceptionBase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/localization/Localizable.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/localization/Localizable.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/localization/Localizable.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,60 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.util.localization;
+
+/**
+ * Localizable message.
+ *
+ * @author WS Development Team
+ */
+public interface Localizable {
+ /**
+ * Gets the key in the resource bundle.
+ *
+ * @return
+ * if this method returns {@link #NOT_LOCALIZABLE},
+ * that means the message is not localizable, and
+ * the first item of {@link #getArguments()} array
+ * holds a String.
+ */
+ public String getKey();
+
+ /**
+ * Returns the arguments for message formatting.
+ *
+ * @return
+ * can be an array of length 0 but never be null.
+ */
+ public Object[] getArguments();
+ public String getResourceBundleName();
+
+
+ /**
+ * Special constant that represents a message that
+ * is not localizable.
+ *
+ * <p>
+ * Use of "new" is to create an unique instance.
+ */
+ public static final String NOT_LOCALIZABLE = new String("\u0000");
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/localization/Localizable.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/localization/LocalizableMessage.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/localization/LocalizableMessage.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/localization/LocalizableMessage.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,53 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.util.localization;
+
+/**
+ * @author WS Development Team
+ */
+public final class LocalizableMessage implements Localizable {
+
+ private final String _bundlename;
+ private final String _key;
+ private final Object[] _args;
+
+ public LocalizableMessage(String bundlename, String key, Object... args) {
+ _bundlename = bundlename;
+ _key = key;
+ if(args==null)
+ args = new Object[0];
+ _args = args;
+ }
+
+ public String getKey() {
+ return _key;
+ }
+
+ public Object[] getArguments() {
+ return _args;
+ }
+
+ public String getResourceBundleName() {
+ return _bundlename;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/localization/LocalizableMessage.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/localization/LocalizableMessageFactory.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/localization/LocalizableMessageFactory.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/localization/LocalizableMessageFactory.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,40 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.util.localization;
+
+/**
+ * @author WS Development Team
+ */
+public class LocalizableMessageFactory {
+
+ private final String _bundlename;
+
+ public LocalizableMessageFactory(String bundlename) {
+ _bundlename = bundlename;
+ }
+
+ public Localizable getMessage(String key, Object... args) {
+ return new LocalizableMessage(_bundlename, key, args);
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/localization/LocalizableMessageFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/localization/Localizer.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/localization/Localizer.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/localization/Localizer.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,148 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.util.localization;
+
+import java.text.MessageFormat;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * Localizes the {@link Localizable} into a message
+ * by using a configured {@link Locale}.
+ *
+ * @author WS Development Team
+ */
+public class Localizer {
+
+ private final Locale _locale;
+ private final HashMap _resourceBundles;
+
+ public Localizer() {
+ this(Locale.getDefault());
+ }
+
+ public Localizer(Locale l) {
+ _locale = l;
+ _resourceBundles = new HashMap();
+ }
+
+ public Locale getLocale() {
+ return _locale;
+ }
+
+ public String localize(Localizable l) {
+ String bundlename = l.getResourceBundleName();
+
+ try {
+ ResourceBundle bundle =
+ (ResourceBundle) _resourceBundles.get(bundlename);
+
+ if (bundle == null) {
+ try {
+ bundle = ResourceBundle.getBundle(bundlename, _locale);
+ } catch (MissingResourceException e) {
+ // work around a bug in the
com.sun.enterprise.deployment.WebBundleArchivist:
+ // all files with an extension different from .class (hence all the
.properties files)
+ // get copied to the top level directory instead of being in the
package where they
+ // are defined
+ // so, since we can't find the bundle under its proper name, we
look for it under
+ // the top-level package
+
+ int i = bundlename.lastIndexOf('.');
+ if (i != -1) {
+ String alternateBundleName =
+ bundlename.substring(i + 1);
+ try {
+ bundle =
+ ResourceBundle.getBundle(
+ alternateBundleName,
+ _locale);
+ } catch (MissingResourceException e2) {
+ // give up
+ return getDefaultMessage(l);
+ }
+ }
+ }
+
+ _resourceBundles.put(bundlename, bundle);
+ }
+
+ if (bundle == null) {
+ return getDefaultMessage(l);
+ }
+
+ String key = l.getKey();
+ if(key==Localizable.NOT_LOCALIZABLE) {
+ // this message is not localizable
+ return (String)l.getArguments()[0];
+ }
+
+
+ if (key == null)
+ key = "undefined";
+
+ String msg;
+ try {
+ msg = bundle.getString(key);
+ } catch (MissingResourceException e) {
+ // notice that this may throw a MissingResourceException of its own
(caught below)
+ msg = bundle.getString("undefined");
+ }
+
+ // localize all arguments to the given localizable object
+ Object[] args = l.getArguments();
+ for (int i = 0; i < args.length; ++i) {
+ if (args[i] instanceof Localizable)
+ args[i] = localize((Localizable) args[i]);
+ }
+
+ String message = MessageFormat.format(msg, args);
+ return message;
+
+ } catch (MissingResourceException e) {
+ return getDefaultMessage(l);
+ }
+
+ }
+
+ private String getDefaultMessage(Localizable l) {
+ String key = l.getKey();
+ Object[] args = l.getArguments();
+ StringBuilder sb = new StringBuilder();
+ sb.append("[failed to localize] ");
+ sb.append(key);
+ if (args != null) {
+ sb.append('(');
+ for (int i = 0; i < args.length; ++i) {
+ if (i != 0)
+ sb.append(", ");
+ sb.append(String.valueOf(args[i]));
+ }
+ sb.append(')');
+ }
+ return sb.toString();
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/localization/Localizer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/localization/NullLocalizable.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/localization/NullLocalizable.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/localization/NullLocalizable.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,48 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.util.localization;
+
+/**
+ * {@link Localizable} that wraps a non-localizable string.
+ *
+ * @author WS Development Team
+ */
+public final class NullLocalizable implements Localizable {
+ private final String msg;
+
+ public NullLocalizable(String msg) {
+ if(msg==null)
+ throw new IllegalArgumentException();
+ this.msg = msg;
+ }
+
+ public String getKey() {
+ return Localizable.NOT_LOCALIZABLE;
+ }
+ public Object[] getArguments() {
+ return new Object[]{msg};
+ }
+ public String getResourceBundleName() {
+ return "";
+ }
+}
\ No newline at end of file
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/localization/NullLocalizable.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/resources/Messages_en.properties
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/resources/Messages_en.properties
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/resources/Messages_en.properties 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,223 @@
+#
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+#
+
+#
+# English diagnostic messages (and fragments) for Sun's XML parser.
+#
+# P-NNN ... parser messages
+# F-NNN ... message fragments (sometimes associated with more
+# than one message, but usually just with one)
+# V-NNN ... validation related messages
+#
+# Most messages can be produced in only one way.
+#
+
+
+#
+# Generic parsing messages, not specific to validation
+#
+P-000 = No parser input source!
+P-001 = Illegal character at end of document, &#x{0};
+P-002 = Expansion of entity "&{0};" is not well formed
+P-003 = Premature end of input
+P-004 = Missing whitespace {0}
+P-005 = Only whitespace allowed {0}
+
+ #
+ # unadorned "missing whitespace", with P-004 only
+ #
+ F-000 = after element name declaration
+ F-001 = between attribute name and type
+ F-002 = after NOTATION type name
+ F-003 = between attribute type and default value
+ F-004 = after #FIXED
+ F-005 = after <!ENTITY declaration
+ F-006 = after % in parameter entity declaration
+ F-007 = after entity name
+ F-008 = before SYSTEM literal URI
+ F-009 = after PUBLIC keyword
+ # F-010 ... identifier can be reused
+ F-011 = after notation name
+ # F-012 ... identifier can be reused
+ # F-013 ... identifier can be reused
+
+ #
+ # in declaration, in "S Name", with P-004 and P-005
+ #
+ F-014 = before name in <!DOCTYPE declaration
+ F-015 = before name in <!ELEMENT declaration
+ F-016 = before name in <!ATTLIST declaration
+ F-017 = before name in <!ENTITY declaration
+ F-018 = before NDATA notation name in <!ENTITY declaration
+ F-019 = before name in <!NOTATION declaration
+
+P-006 = Name tokens must not start with "{0}" characters
+P-007 = Value must be quoted
+P-008 = Next character must be "{0}" {1} {2}
+
+ F-020 = terminating reference to entity
+ F-021 = terminating reference to parameter entity
+ F-022 = terminating comment
+ F-023 = in XML Declaration
+ F-024 = terminating internal DTD subset
+ F-025 = terminating <!DOCTYPE ...> declaration
+ F-026 = after attribute name
+ F-027 = terminating element
+ F-028 = starting content model for element
+ F-029 = starting list of attribute NOTATIONS
+ F-030 = beginning condition DTD subset
+ F-031 = terminating <!ENTITY ...> declaration
+ F-032 = terminating <!NOTATION ...> declaration
+
+P-009 = Illegal character or entity reference syntax
+
+P-010 = Only external parameter entities may use "%{0};" in entity values
+P-011 = Illegal parameter entity reference syntax
+P-012 = Use "<" for "<" in attribute values
+P-013 = Illegal reference to external entity "&{0};" in attribute
+P-014 = Reference to undefined entity "&{0};"
+P-015 = Expecting quoted value for {0}
+
+ F-033 = PUBLIC identifier
+ F-034 = SYSTEM identifier
+ F-035 = attribute value {0}
+
+P-016 = Illegal character in PUBLIC identifier: "{0}"
+P-017 = End of entity while processing comment
+P-018 = Processing instruction target is missing
+P-019 = XML declaration may only begin entities
+
+P-020 = Illegal processing instruction target: "{0}"
+P-021 = End of input inside processing instruction
+P-022 = Illegal processing instruction name, or missing whitespace
+P-023 = Illegal character "&#x{0};" ({1}) at end of XML Declaration
+P-024 = Expected "{0}=..."
+P-025 = XML version "{0}" should be declared
+P-026 = Illegal XML version string "{0}"
+P-027 = XML version "{0}" is recognized, but not "{1}"
+P-028 = Internal DTD subset must not have "<![..." constructs
+P-029 = Standalone declaration must be "yes" or "no", not
"{0}"
+
+P-030 = Whitespace required before attributes
+P-031 = Attribute names must not start with "{0}" characters
+P-032 = Attribute "{0}" already appeared in this tag
+P-033 = Illegal xml:lang value "{0}"
+P-034 = Expected "</{0}>" to terminate element starting on line {1}
+P-035 = End of entity not allowed; an end tag is missing
+P-036 = ">" must terminate <!ELEMENT {0} ...> declaration, not
"{1}"
+P-037 = Sequence content model must not contain "{0}"
+P-038 = Choice content model must not contain "{0}"
+P-039 = No content model may contain "{0}"
+
+P-040 = Need right parenthesis or "{1}" in content model, not "{0}"
+P-041 = Need right parenthesis, ",", or "|" in content model, not
"{0}"
+P-042 = Illegal mixed content model for "{0}", next char = &#x{1};
+P-043 = Mixed content model for "{0}" must end with ")*", not
"{1}"
+P-044 = Either an attribute declaration or ">" is expected, not
"{0}"
+P-045 = Illegal type (starts with "{1}") for attribute "{0}"
+P-046 = Need keyword in conditional DTD section
+P-047 = Unterminated conditional DTD section
+P-048 = Only INCLUDE and IGNORE are allowed, not "{0}"
+P-049 = Illegal decimal character reference
+
+P-050 = Illegal hexadecimal character reference
+P-051 = Illegal XML character &#x{0};
+P-052 = Internal entity "&{0};" has characters after content
+P-053 = Unparsed entities such as "&{0};" must not be included
+P-054 = Using original entity definition for "&{0};"
+P-055 = Relative URI "{0}"; can not be resolved without a document URI
+P-056 = URI "{0}" has a fragment ID
+P-057 = Need "?>" to terminate XML declaration
+P-058 = External entity "&{0};" has characters after content
+P-059 = External parameter entity "%{0};" has characters after markup
+
+P-060 = Illegal character "{0}" in encoding name
+P-061 = Declared encoding "{0}" does not match actual one "{1}"; \
+ this might not be an error
+P-062 = Notation must be PUBLIC or SYSTEM
+P-063 = Using first definition of notation "{0}"
+P-064 = Premature end of parameter entity "%{0};"
+P-065 = Entity Resolver did not provide SYSTEM id; may affect relative URIs
+# P-066 ... ID available
+P-067 = Document root element is missing
+P-068 = Notation name is required
+P-069 = Expansion of entity "{0}" is recursive
+
+P-070 = Malformed second part of surrogate pair: &#x{0};
+P-071 = Illegal XML character: &#x{0};
+P-072 = Character data cannot have "]]>"
+P-073 = EOF while parsing <![CDATA[ section
+P-074 = Illegal Unicode surrogate pair: &#x{0}; &#x{1};
+P-075 = Unsupported encoding: "{0}" (line number may be too low)
+P-076 = Character conversion error: "{0}" (line number may be too low)
+P-077 = Maximum symbol length ({0} characters) exceeded
+P-078 = No messages for locale "{0}" are available
+P-079 = The content beginning "<{1}" is not legal markup \
+ Perhaps the "{1}" (&#{0};) character should be a letter
+
+P-080 = Parameter entity references must not appear within \
+ markup declarations in the internal DTD subset
+P-081 = Incomplete Unicode surrogate pair: &#x{0}
+
+P-082 = Trying to access null attributes
+P-083 = Illegal stack state
+P-084 = Undeclared namespace prefix of element "{0}"
+P-085 = DTD detected
+P-086 = Illegal namespace prefix "{0}"; prefix "xml" cannot be bound
to any namespace other than its usual namespace
+
+#
+# Validation messages, won't normally show up unless validation is
+# being performed. Note that V-022 relates to a spec bug: there
+# are both a WFC and VC on undefined PEs. If that's a WVC violation
+# there's no need for the VC, ever; and "standalone" would then affect
+# WF-ness. For the moment this assumes it's to be a VC not a WFC
+#
+V-000 = Validation is disabled
+V-001 = Valid documents must have a <!DOCTYPE declaration
+V-002 = This document is standalone, so it must not refer to "&{0};"
+V-003 = Undeclared notation "{0}" is used by an <!ENTITY...> declaration
+V-004 = Undeclared notation "{0}" is used by an <!ATTLIST...>
declaration
+V-005 = Element type "{0}" is not declared
+V-006 = Root element type is "{0}", but was declared to be "{1}"
+V-007 = Attribute "{0}" is not declared for element "{1}"
+V-008 = Attribute "{0}" of element "{1}" must only have value
"{2}"
+V-009 = Attribute value for "{0}" is #REQUIRED
+
+V-010 = This document is standalone, \
+ so attribute "{0}" must not be defaulted
+V-011 = This document is standalone, \
+ so element "{0}" must not have ignorable whitespace
+V-012 = Element "{0}" was already declared
+V-013 = Parameter entities must not contain partial declarations
+V-014 = Parameter entity nesting error in content model for "{0}"
+V-015 = Mixed content model repeats element "{0}"
+V-016 = This element already has an ID attribute, "{0}"
+V-017 = ID attribute "{0}" must not be #FIXED
+V-018 = ID attribute "{0}" must not be defaulted
+V-019 = This document is standalone; this attribute needs to be pre-normalized
+
+V-020 = Parameter entities must not contain partial conditional DTD sections
+V-021 = Parameter entities must not contain partial comments
+V-022 = Reference to undefined parameter entity "%{0};"
+V-023 = This document is standalone; this ignorable CDATA whitespace is forbidden
+V-024 = No element has an ID attribute with value "{0}"
+V-025 = ID values must be XML names; "{0}" is not a name
+V-026 = Another element already has an ID attribute with value "{0}"
+V-027 = IDREF/IDREFS values must be XML names; "{0}" is not a name
+V-028 = NMTOKEN/NMTOKENS values must be XML name tokens; "{0}" is not one
+V-029 = Value "{0}" is not one of the enumerated values for this attribute
+
+V-030 = Attribute value "{0}" does not name a notation
+V-031 = Attribute value "{0}" does not name an unparsed entity
+V-032 = NMTOKENS attributes must have at least one value
+V-033 = EMPTY content models must have no content
+V-034 = Element "{0}" does not allow "{1}" -- {2}
+V-035 = Element "{0}" allows no further input; "{1}" is not allowed
+V-036 = Element "{0}" does not allow "{1}" here
+V-037 = Element "{0}" does not allow text
+V-038 = Element "{0}" requires additional elements
+V-039 = IDREFS attributes must have at least one value
+
+V-040 = ENTITIES attributes must have at least one value
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/xml/CDATA.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/xml/CDATA.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/xml/CDATA.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,55 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.util.xml;
+
+/**
+ * @author WS Development Team
+ */
+public final class CDATA {
+
+ public CDATA(String text) {
+ _text = text;
+ }
+
+ public String getText() {
+ return _text;
+ }
+
+ public boolean equals(Object obj) {
+ if (obj == null)
+ return false;
+
+ if (!(obj instanceof CDATA))
+ return false;
+
+ CDATA cdata = (CDATA) obj;
+
+ return this._text.equals(cdata._text);
+ }
+
+ public int hashCode() {
+ return _text.hashCode();
+ }
+
+ private String _text;
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/xml/CDATA.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/xml/NamedNodeMapIterator.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/xml/NamedNodeMapIterator.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/xml/NamedNodeMapIterator.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,58 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.util.xml;
+
+import java.util.Iterator;
+
+import org.w3c.dom.NamedNodeMap;
+
+/**
+ * @author WS Development Team
+ */
+public class NamedNodeMapIterator implements Iterator {
+
+ protected NamedNodeMap _map;
+ protected int _index;
+
+ public NamedNodeMapIterator(NamedNodeMap map) {
+ _map = map;
+ _index = 0;
+ }
+
+ public boolean hasNext() {
+ if (_map == null)
+ return false;
+ return _index < _map.getLength();
+ }
+
+ public Object next() {
+ Object obj = _map.item(_index);
+ if (obj != null)
+ ++_index;
+ return obj;
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/xml/NamedNodeMapIterator.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/xml/NodeListIterator.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/xml/NodeListIterator.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/xml/NodeListIterator.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,58 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.util.xml;
+
+import java.util.Iterator;
+
+import org.w3c.dom.NodeList;
+
+/**
+ * @author WS Development Team
+ */
+public class NodeListIterator implements Iterator {
+
+ protected NodeList _list;
+ protected int _index;
+
+ public NodeListIterator(NodeList list) {
+ _list = list;
+ _index = 0;
+ }
+
+ public boolean hasNext() {
+ if (_list == null)
+ return false;
+ return _index < _list.getLength();
+ }
+
+ public Object next() {
+ Object obj = _list.item(_index);
+ if (obj != null)
+ ++_index;
+ return obj;
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/xml/NodeListIterator.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/xml/StAXSource.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/xml/StAXSource.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/xml/StAXSource.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,252 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.util.xml;
+
+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.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.ext.LexicalHandler;
+import org.xml.sax.helpers.XMLFilterImpl;
+
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.transform.sax.SAXSource;
+
+/**
+ * A JAXP {@link javax.xml.transform.Source} implementation that wraps
+ * the specified {@link javax.xml.stream.XMLStreamReader} or
+ * {@link javax.xml.stream.XMLEventReader} for use by applications that
+ * expext a {@link javax.xml.transform.Source}.
+ *
+ * <p>
+ * The fact that StAXSource derives from SAXSource is an implementation
+ * detail. Thus in general applications are strongly discouraged from
+ * accessing methods defined on SAXSource. In particular:
+ *
+ * <ul>
+ * <li> The setXMLReader and setInputSource methods shall never be
called.</li>
+ * <li> The XMLReader object obtained by the getXMLReader method shall
+ * be used only for parsing the InputSource object returned by
+ * the getInputSource method.</li>
+ * <li> The InputSource object obtained by the getInputSource method shall
+ * be used only for being parsed by the XMLReader object returned by
+ * the getXMLReader method.</li>
+ * </ul>
+ *
+ * <p>
+ * Example:
+ *
+ * <pre>
+ // create a StAXSource
+ XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new
FileReader(args[0]));
+ Source staxSource = new StAXSource(reader);
+
+ // createa StreamResult
+ Result streamResult = new StreamResult(System.out);
+
+ // run the transform
+ TransformerFactory.newInstance().newTransformer().transform(staxSource,
streamResult);
+ * </pre>
+ *
+ * @author Ryan.Shoemaker(a)Sun.COM
+ * @version 1.0
+ */
+public class StAXSource extends SAXSource {
+
+ // StAX to SAX converter that will read from StAX and produce SAX
+ // this object will be wrapped by the XMLReader exposed to the client
+ private final XMLStreamReaderToContentHandler reader;
+
+ // SAX allows ContentHandler to be changed during the parsing,
+ // but JAXB doesn't. So this repeater will sit between those
+ // two components.
+ private XMLFilterImpl repeater = new XMLFilterImpl();
+
+ // this object will pretend as an XMLReader.
+ // no matter what parameter is specified to the parse method,
+ // it will just read from the StAX reader.
+ private final XMLReader pseudoParser = new XMLReader() {
+ public boolean getFeature(String name) throws SAXNotRecognizedException {
+ throw new SAXNotRecognizedException(name);
+ }
+
+ public void setFeature(String name, boolean value) throws
SAXNotRecognizedException {
+ throw new SAXNotRecognizedException(name);
+ }
+
+ public Object getProperty(String name) throws SAXNotRecognizedException {
+ if( "http://xml.org/sax/properties/lexical-handler".equals(name) )
{
+ return lexicalHandler;
+ }
+ throw new SAXNotRecognizedException(name);
+ }
+
+ public void setProperty(String name, Object value) throws
SAXNotRecognizedException {
+ if( "http://xml.org/sax/properties/lexical-handler".equals(name) )
{
+ this.lexicalHandler = (LexicalHandler)value;
+ return;
+ }
+ throw new SAXNotRecognizedException(name);
+ }
+
+ private LexicalHandler lexicalHandler;
+
+ // we will store this value but never use it by ourselves.
+ private EntityResolver entityResolver;
+ public void setEntityResolver(EntityResolver resolver) {
+ this.entityResolver = resolver;
+ }
+ public EntityResolver getEntityResolver() {
+ return entityResolver;
+ }
+
+ private DTDHandler dtdHandler;
+ public void setDTDHandler(DTDHandler handler) {
+ this.dtdHandler = handler;
+ }
+ public DTDHandler getDTDHandler() {
+ return dtdHandler;
+ }
+
+ public void setContentHandler(ContentHandler handler) {
+ repeater.setContentHandler(handler);
+ }
+ public ContentHandler getContentHandler() {
+ return repeater.getContentHandler();
+ }
+
+ private ErrorHandler errorHandler;
+ public void setErrorHandler(ErrorHandler handler) {
+ this.errorHandler = handler;
+ }
+ public ErrorHandler getErrorHandler() {
+ return errorHandler;
+ }
+
+ public void parse(InputSource input) throws SAXException {
+ parse();
+ }
+
+ public void parse(String systemId) throws SAXException {
+ parse();
+ }
+
+ public void parse() throws SAXException {
+ // parses from a StAX reader and generates SAX events which
+ // go through the repeater and are forwarded to the appropriate
+ // component
+ try {
+ reader.bridge();
+ } catch( XMLStreamException e ) {
+ // wrap it in a SAXException
+ SAXParseException se =
+ new SAXParseException(
+ e.getMessage(),
+ null,
+ null,
+ e.getLocation().getLineNumber(),
+ e.getLocation().getColumnNumber(),
+ e);
+
+ // if the consumer sets an error handler, it is our responsibility
+ // to notify it.
+ if(errorHandler!=null)
+ errorHandler.fatalError(se);
+
+ // this is a fatal error. Even if the error handler
+ // returns, we will abort anyway.
+ throw se;
+
+ }
+ }
+ };
+
+ /**
+ * Creates a new {@link javax.xml.transform.Source} for the given
+ * {@link XMLStreamReader}.
+ *
+ * The XMLStreamReader must be pointing at either a
+ * {@link javax.xml.stream.XMLStreamConstants#START_DOCUMENT} or
+ * {@link javax.xml.stream.XMLStreamConstants#START_ELEMENT} event.
+ *
+ * @param reader XMLStreamReader that will be exposed as a Source
+ * @throws IllegalArgumentException iff the reader is null
+ * @throws IllegalStateException iff the reader is not pointing at either a
+ * START_DOCUMENT or START_ELEMENT event
+ */
+ public StAXSource(XMLStreamReader reader, boolean eagerQuit) {
+ if( reader == null )
+ throw new IllegalArgumentException();
+
+ int eventType = reader.getEventType();
+ if (!(eventType == XMLStreamConstants.START_DOCUMENT)
+ && !(eventType == XMLStreamConstants.START_ELEMENT)) {
+ throw new IllegalStateException();
+ }
+
+ this.reader = new XMLStreamReaderToContentHandler(reader,repeater,eagerQuit);
+
+ super.setXMLReader(pseudoParser);
+ // pass a dummy InputSource. We don't care
+ super.setInputSource(new InputSource());
+ }
+
+// /**
+// * Creates a new {@link javax.xml.transform.Source} for the given
+// * {@link XMLEventReader}.
+// *
+// * The XMLEventReader must be pointing at either a
+// * {@link javax.xml.stream.XMLStreamConstants#START_DOCUMENT} or
+// * {@link javax.xml.stream.XMLStreamConstants#START_ELEMENT} event.
+// *
+// * @param reader XMLEventReader that will be exposed as a Source
+// * @throws IllegalArgumentException iff the reader is null
+// * @throws IllegalStateException iff the reader is not pointing at either a
+// * START_DOCUEMENT or START_ELEMENT event
+// */
+// public StAXSource(XMLEventReader reader) {
+// if( reader == null )
+// throw new IllegalArgumentException();
+//
+// // TODO: detect IllegalStateException for START_ELEMENT|DOCUMENT
+// // bugid 5046340 - peek not implemented
+// // XMLEvent event = staxEventReader.peek();
+//
+// this.reader =
+// new XMLEventReaderToContentHandler(
+// reader,
+// repeater);
+//
+// super.setXMLReader(pseudoParser);
+// // pass a dummy InputSource. We don't care
+// super.setInputSource(new InputSource());
+// }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/xml/StAXSource.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/xml/XMLStreamReaderToContentHandler.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/xml/XMLStreamReaderToContentHandler.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/xml/XMLStreamReaderToContentHandler.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,343 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.util.xml;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.AttributesImpl;
+
+/**
+ * This is a simple utility class that adapts StAX events from an
+ * {@link XMLStreamReader} to SAX events on a
+ * {@link ContentHandler}, bridging between the two
+ * parser technologies.
+ *
+ * @author Ryan.Shoemaker(a)Sun.COM
+ * @version 1.0
+ */
+public class XMLStreamReaderToContentHandler {
+
+ // StAX event source
+ private final XMLStreamReader staxStreamReader;
+
+ // SAX event sink
+ private final ContentHandler saxHandler;
+
+ // if true, when the conversion is completed, leave the cursor to the last
+ // event that was fired (such as end element)
+ private boolean eagerQuit;
+
+ /**
+ * Construct a new StAX to SAX adapter that will convert a StAX event
+ * stream into a SAX event stream.
+ *
+ * @param staxCore
+ * StAX event source
+ * @param saxCore
+ * SAXevent sink
+ */
+ public XMLStreamReaderToContentHandler(XMLStreamReader staxCore, ContentHandler
saxCore, boolean eagerQuit) {
+ this.staxStreamReader = staxCore;
+ this.saxHandler = saxCore;
+ this.eagerQuit = eagerQuit;
+ }
+
+ /*
+ * @see StAXReaderToContentHandler#bridge()
+ */
+ public void bridge() throws XMLStreamException {
+
+ try {
+ // remembers the nest level of elements to know when we are done.
+ int depth=0;
+
+ // if the parser is at the start tag, proceed to the first element
+ int event = staxStreamReader.getEventType();
+ if(event == XMLStreamConstants.START_DOCUMENT) {
+ // nextTag doesn't correctly handle DTDs
+ while( !staxStreamReader.isStartElement() )
+ event = staxStreamReader.next();
+ }
+
+
+ if( event!=XMLStreamConstants.START_ELEMENT)
+ throw new IllegalStateException("The current event is not
START_ELEMENT\n but " + event);
+
+ handleStartDocument();
+
+ OUTER:
+ do {
+ // These are all of the events listed in the javadoc for
+ // XMLEvent.
+ // The spec only really describes 11 of them.
+ switch (event) {
+ case XMLStreamConstants.START_ELEMENT :
+ depth++;
+ handleStartElement();
+ break;
+ case XMLStreamConstants.END_ELEMENT :
+ handleEndElement();
+ depth--;
+ if(depth==0 && eagerQuit)
+ break OUTER;
+ break;
+ case XMLStreamConstants.CHARACTERS :
+ handleCharacters();
+ break;
+ case XMLStreamConstants.ENTITY_REFERENCE :
+ handleEntityReference();
+ break;
+ case XMLStreamConstants.PROCESSING_INSTRUCTION :
+ handlePI();
+ break;
+ case XMLStreamConstants.COMMENT :
+ handleComment();
+ break;
+ case XMLStreamConstants.DTD :
+ handleDTD();
+ break;
+ case XMLStreamConstants.ATTRIBUTE :
+ handleAttribute();
+ break;
+ case XMLStreamConstants.NAMESPACE :
+ handleNamespace();
+ break;
+ case XMLStreamConstants.CDATA :
+ handleCDATA();
+ break;
+ case XMLStreamConstants.ENTITY_DECLARATION :
+ handleEntityDecl();
+ break;
+ case XMLStreamConstants.NOTATION_DECLARATION :
+ handleNotationDecl();
+ break;
+ case XMLStreamConstants.SPACE :
+ handleSpace();
+ break;
+ default :
+ throw new InternalError("processing event: " + event);
+ }
+
+ event=staxStreamReader.next();
+ } while (depth!=0);
+
+ handleEndDocument();
+ } catch (SAXException e) {
+ throw new XMLStreamException(e);
+ }
+ }
+
+ private void handleEndDocument() throws SAXException {
+ saxHandler.endDocument();
+ }
+
+ private void handleStartDocument() throws SAXException {
+ saxHandler.setDocumentLocator(new Locator() {
+ public int getColumnNumber() {
+ return staxStreamReader.getLocation().getColumnNumber();
+ }
+ public int getLineNumber() {
+ return staxStreamReader.getLocation().getLineNumber();
+ }
+ public String getPublicId() {
+ return staxStreamReader.getLocation().getPublicId();
+ }
+ public String getSystemId() {
+ return staxStreamReader.getLocation().getSystemId();
+ }
+ });
+ saxHandler.startDocument();
+ }
+
+ private void handlePI() throws XMLStreamException {
+ try {
+ saxHandler.processingInstruction(
+ staxStreamReader.getPITarget(),
+ staxStreamReader.getPIData());
+ } catch (SAXException e) {
+ throw new XMLStreamException(e);
+ }
+ }
+
+ private void handleCharacters() throws XMLStreamException {
+ try {
+ saxHandler.characters(
+ staxStreamReader.getTextCharacters(),
+ staxStreamReader.getTextStart(),
+ staxStreamReader.getTextLength() );
+ } catch (SAXException e) {
+ throw new XMLStreamException(e);
+ }
+ }
+
+ private void handleEndElement() throws XMLStreamException {
+ QName qName = staxStreamReader.getName();
+
+ try {
+ // fire endElement
+ saxHandler.endElement(
+ qName.getNamespaceURI(),
+ qName.getLocalPart(),
+ qName.toString());
+
+ // end namespace bindings
+ int nsCount = staxStreamReader.getNamespaceCount();
+ for (int i = nsCount - 1; i >= 0; i--) {
+ String prefix = staxStreamReader.getNamespacePrefix(i);
+ if (prefix == null) { // true for default namespace
+ prefix = "";
+ }
+ saxHandler.endPrefixMapping(prefix);
+ }
+ } catch (SAXException e) {
+ throw new XMLStreamException(e);
+ }
+ }
+
+ private void handleStartElement() throws XMLStreamException {
+
+ try {
+ // start namespace bindings
+ int nsCount = staxStreamReader.getNamespaceCount();
+ for (int i = 0; i < nsCount; i++) {
+ saxHandler.startPrefixMapping(
+ fixNull(staxStreamReader.getNamespacePrefix(i)),
+ fixNull(staxStreamReader.getNamespaceURI(i)));
+ }
+
+ // fire startElement
+ QName qName = staxStreamReader.getName();
+ String prefix = qName.getPrefix();
+ String rawname;
+ if(prefix==null || prefix.length()==0)
+ rawname = qName.getLocalPart();
+ else
+ rawname = prefix + ':' + qName.getLocalPart();
+ Attributes attrs = getAttributes();
+ saxHandler.startElement(
+ qName.getNamespaceURI(),
+ qName.getLocalPart(),
+ rawname,
+ attrs);
+ } catch (SAXException e) {
+ throw new XMLStreamException(e);
+ }
+ }
+
+ private static String fixNull(String s) {
+ if(s==null) return "";
+ else return s;
+ }
+
+ /**
+ * Get the attributes associated with the given START_ELEMENT or ATTRIBUTE
+ * StAXevent.
+ *
+ * @return the StAX attributes converted to an org.xml.sax.Attributes
+ */
+ private Attributes getAttributes() {
+ AttributesImpl attrs = new AttributesImpl();
+
+ int eventType = staxStreamReader.getEventType();
+ if (eventType != XMLStreamConstants.ATTRIBUTE
+ && eventType != XMLStreamConstants.START_ELEMENT) {
+ throw new InternalError(
+ "getAttributes() attempting to process: " + eventType);
+ }
+
+ // in SAX, namespace declarations are not part of attributes by default.
+ // (there's a property to control that, but as far as we are concerned
+ // we don't use it.) So don't add xmlns:* to attributes.
+
+ // gather non-namespace attrs
+ for (int i = 0; i < staxStreamReader.getAttributeCount(); i++) {
+ String uri = staxStreamReader.getAttributeNamespace(i);
+ if(uri==null) uri="";
+ String localName = staxStreamReader.getAttributeLocalName(i);
+ String prefix = staxStreamReader.getAttributePrefix(i);
+ String qName;
+ if(prefix==null || prefix.length()==0)
+ qName = localName;
+ else
+ qName = prefix + ':' + localName;
+ String type = staxStreamReader.getAttributeType(i);
+ String value = staxStreamReader.getAttributeValue(i);
+
+ attrs.addAttribute(uri, localName, qName, type, value);
+ }
+
+ return attrs;
+ }
+
+ private void handleNamespace() {
+ // no-op ???
+ // namespace events don't normally occur outside of a startElement
+ // or endElement
+ }
+
+ private void handleAttribute() {
+ // no-op ???
+ // attribute events don't normally occur outside of a startElement
+ // or endElement
+ }
+
+ private void handleDTD() {
+ // no-op ???
+ // it seems like we need to pass this info along, but how?
+ }
+
+ private void handleComment() {
+ // no-op ???
+ }
+
+ private void handleEntityReference() {
+ // no-op ???
+ }
+
+ private void handleSpace() {
+ // no-op ???
+ // this event is listed in the javadoc, but not in the spec.
+ }
+
+ private void handleNotationDecl() {
+ // no-op ???
+ // this event is listed in the javadoc, but not in the spec.
+ }
+
+ private void handleEntityDecl() {
+ // no-op ???
+ // this event is listed in the javadoc, but not in the spec.
+ }
+
+ private void handleCDATA() {
+ // no-op ???
+ // this event is listed in the javadoc, but not in the spec.
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/xml/XMLStreamReaderToContentHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/xml/XmlUtil.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/xml/XmlUtil.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/xml/XmlUtil.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,231 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.util.xml;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerFactory;
+
+import org.jboss.com.sun.xml.ws.server.ServerRtException;
+import org.jboss.com.sun.xml.ws.util.ByteArrayBuffer;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.EntityReference;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
+
+
+import java.net.URL;
+import java.util.Enumeration;
+import javax.xml.ws.WebServiceException;
+import com.sun.org.apache.xml.internal.resolver.CatalogManager;
+import com.sun.org.apache.xml.internal.resolver.tools.CatalogResolver;
+import org.xml.sax.EntityResolver;
+
+/**
+ * @author WS Development Team
+ */
+public class XmlUtil {
+
+ public static String getPrefix(String s) {
+ int i = s.indexOf(':');
+ if (i == -1)
+ return null;
+ return s.substring(0, i);
+ }
+
+ public static String getLocalPart(String s) {
+ int i = s.indexOf(':');
+ if (i == -1)
+ return s;
+ return s.substring(i + 1);
+ }
+
+
+
+ public static String getAttributeOrNull(Element e, String name) {
+ Attr a = e.getAttributeNode(name);
+ if (a == null)
+ return null;
+ return a.getValue();
+ }
+
+ public static String getAttributeNSOrNull(
+ Element e,
+ String name,
+ String nsURI) {
+ Attr a = e.getAttributeNodeNS(nsURI, name);
+ if (a == null)
+ return null;
+ return a.getValue();
+ }
+
+/* public static boolean matchesTagNS(Element e, String tag, String nsURI) {
+ try {
+ return e.getLocalName().equals(tag)
+ && e.getNamespaceURI().equals(nsURI);
+ } catch (NullPointerException npe) {
+
+ // localname not null since parsing would fail before here
+ throw new WSDLParseException(
+ "null.namespace.found",
+ e.getLocalName());
+ }
+ }
+
+ public static boolean matchesTagNS(
+ Element e,
+ javax.xml.namespace.QName name) {
+ try {
+ return e.getLocalName().equals(name.getLocalPart())
+ && e.getNamespaceURI().equals(name.getNamespaceURI());
+ } catch (NullPointerException npe) {
+
+ // localname not null since parsing would fail before here
+ throw new WSDLParseException(
+ "null.namespace.found",
+ e.getLocalName());
+ }
+ }*/
+
+ public static Iterator getAllChildren(Element element) {
+ return new NodeListIterator(element.getChildNodes());
+ }
+
+ public static Iterator getAllAttributes(Element element) {
+ return new NamedNodeMapIterator(element.getAttributes());
+ }
+
+ public static List<String> parseTokenList(String tokenList) {
+ List<String> result = new ArrayList<String>();
+ StringTokenizer tokenizer = new StringTokenizer(tokenList, " ");
+ while (tokenizer.hasMoreTokens()) {
+ result.add(tokenizer.nextToken());
+ }
+ return result;
+ }
+
+ public static String getTextForNode(Node node) {
+ StringBuffer sb = new StringBuffer();
+
+ NodeList children = node.getChildNodes();
+ if (children.getLength() == 0)
+ return null;
+
+ for (int i = 0; i < children.getLength(); ++i) {
+ Node n = children.item(i);
+
+ if (n instanceof Text)
+ sb.append(n.getNodeValue());
+ else if (n instanceof EntityReference) {
+ String s = getTextForNode(n);
+ if (s == null)
+ return null;
+ else
+ sb.append(s);
+ } else
+ return null;
+ }
+
+ return sb.toString();
+ }
+
+ public static InputStream getUTF8Stream(String s) {
+ try {
+ ByteArrayBuffer bab = new ByteArrayBuffer();
+ Writer w = new OutputStreamWriter(bab, "utf-8");
+ w.write(s);
+ w.close();
+ return bab.newInputStream();
+ } catch (IOException e) {
+ throw new RuntimeException("should not happen");
+ }
+ }
+
+ static final TransformerFactory transformerFactory =
TransformerFactory.newInstance();
+
+ public static Transformer newTransformer() {
+ try {
+ return transformerFactory.newTransformer();
+ } catch (TransformerConfigurationException tex) {
+ throw new IllegalStateException("Unable to create a JAXP
transformer");
+ }
+ }
+
+ /*
+ * Gets an EntityResolver using XML catalog
+ */
+ public static EntityResolver createEntityResolver(URL catalogUrl) {
+ // set up a manager
+ CatalogManager manager = new CatalogManager();
+ manager.setIgnoreMissingProperties(true);
+ try {
+ if (catalogUrl != null) {
+ manager.getCatalog().parseCatalog(catalogUrl);
+ }
+ } catch (IOException e) {
+ throw new ServerRtException("server.rt.err",e);
+ }
+ return new CatalogResolver(manager);
+ }
+
+ /**
+ * Gets a default EntityResolver for catalog at META-INF/jaxws-catalog.xml
+ */
+ public static EntityResolver createDefaultCatalogResolver() {
+
+ // set up a manager
+ CatalogManager manager = new CatalogManager();
+ manager.setIgnoreMissingProperties(true);
+
+ // parse the catalog
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ Enumeration<URL> catalogEnum;
+ try {
+ if (cl == null) {
+ catalogEnum =
ClassLoader.getSystemResources("META-INF/jax-ws-catalog.xml");
+ } else {
+ catalogEnum = cl.getResources("META-INF/jax-ws-catalog.xml");
+ }
+
+ while(catalogEnum.hasMoreElements()) {
+ URL url = catalogEnum.nextElement();
+ manager.getCatalog().parseCatalog(url);
+ }
+ } catch (IOException e) {
+ throw new WebServiceException(e);
+ }
+
+ return new CatalogResolver(manager);
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/util/xml/XmlUtil.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/version.properties
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/version.properties
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/version.properties 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,3 @@
+build-id=01/28/2007 08:27 PM(jason)
+build-version=JAX-WS RI 2.0-01/28/2007 08:27 PM(jason)
+major-version=2.0
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/WSDLContext.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/WSDLContext.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/WSDLContext.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,174 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl;
+
+import org.jboss.com.sun.xml.ws.wsdl.parser.*;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.SAXException;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.soap.SOAPBinding;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * $author: JAXWS Development Team
+ */
+public class WSDLContext {
+ private final URL orgWsdlLocation;
+ private String targetNamespace;
+ private final WSDLDocument wsdlDoc;
+
+ /**
+ * Creates a {@link WSDLContext} by parsing the given wsdl file.
+ */
+ public WSDLContext(URL wsdlDocumentLocation, EntityResolver entityResolver) throws
WebServiceException {
+ //must get binding information
+ assert entityResolver != null;
+
+ if (wsdlDocumentLocation == null)
+ throw new WebServiceException("No WSDL location Information present,
error");
+
+ orgWsdlLocation = wsdlDocumentLocation;
+ try {
+ wsdlDoc = RuntimeWSDLParser.parse(wsdlDocumentLocation, entityResolver);
+ } catch (IOException e) {
+ throw new WebServiceException(e);
+ } catch (XMLStreamException e) {
+ throw new WebServiceException(e);
+ } catch (SAXException e) {
+ throw new WebServiceException(e);
+ }
+ }
+
+ public URL getWsdlLocation() {
+ return orgWsdlLocation;
+ }
+
+ public String getOrigURLPath() {
+ return orgWsdlLocation.getPath();
+ }
+
+ public QName getServiceQName() {
+ return wsdlDoc.getFirstServiceName();
+ }
+
+ public boolean contains(QName serviceName) {
+ return (wsdlDoc.getServices().containsKey(serviceName));
+ }
+
+ //just get the first one for now
+ public String getEndpoint(QName serviceName) {
+ if (serviceName == null)
+ throw new WebServiceException("Service unknown, can not identify ports
for an unknown Service.");
+ Service service = wsdlDoc.getService(serviceName);
+ String endpoint = null;
+ if (service != null) {
+ Iterator<Map.Entry<QName, Port>> iter =
service.entrySet().iterator();
+ if (iter.hasNext()) {
+ Port port = iter.next().getValue();
+ endpoint = port.getAddress();
+ }
+ }
+ if (endpoint == null)
+ throw new WebServiceException("Endpoint not found. Check WSDL file to
verify endpoint was provided.");
+ return endpoint;
+ }
+
+ //just get the first one for now
+ public QName getPortName() {
+ return wsdlDoc.getFirstPortName();
+ }
+
+ public String getBindingID(QName serviceName, QName portName) {
+ return getWsdlDocument().getBindingId(serviceName, portName);
+ }
+
+ public String getTargetNamespace() {
+ return targetNamespace;
+ }
+
+ public void setTargetNamespace(String tns) {
+ targetNamespace = tns;
+ }
+
+ public Set<QName> getPortsAsSet(QName serviceName) {
+ Service service = wsdlDoc.getService(serviceName);
+ if (service != null) {
+ return service.keySet();
+ }
+ return null;
+ }
+
+
+ public boolean contains(QName serviceName, QName portName) {
+ Service service = wsdlDoc.getService(serviceName);
+ if (service != null) {
+
+ Iterator<Map.Entry<QName, Port>> iter =
service.entrySet().iterator();
+ while (iter.hasNext()) {
+ Port port = iter.next().getValue();
+ if (port.getName().equals(portName))
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public QName getFirstServiceName() {
+ return wsdlDoc.getFirstServiceName();
+ }
+
+ public Set<QName> getAllServiceNames() {
+ return wsdlDoc.getServices().keySet();
+ }
+
+ public WSDLDocument getWsdlDocument() {
+ return wsdlDoc;
+ }
+
+ public Binding getWsdlBinding(QName service, QName port) {
+ if (wsdlDoc == null)
+ return null;
+ return wsdlDoc.getBinding(service, port);
+ }
+
+ public String getEndpoint(QName serviceName, QName portQName) {
+ Service service = wsdlDoc.getService(serviceName);
+ if (service != null) {
+ Port p = service.get(portQName);
+ if (p != null)
+ return p.getAddress();
+ else
+ throw new WebServiceException("No ports found for service " +
serviceName);
+ } else {
+ throw new WebServiceException("Service unknown, can not identify ports
for an unknown Service.");
+ }
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/WSDLContext.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/Binding.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/Binding.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/Binding.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,115 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.parser;
+
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.xml.ws.model.Mode;
+import org.jboss.com.sun.xml.ws.model.ParameterBinding;
+
+import java.util.HashMap;
+
+public class Binding extends HashMap<String, BindingOperation> {
+ private QName name;
+ private QName portTypeName;
+ private PortType portType;
+ private String bindingId;
+ private WSDLDocument wsdlDoc;
+ private boolean finalized = false;
+
+ public Binding(QName name, QName portTypeName) {
+ super();
+ this.name = name;
+ this.portTypeName = portTypeName;
+ }
+
+ public QName getName() {
+ return name;
+ }
+
+ public QName getPortTypeName(){
+ return portTypeName;
+ }
+
+ public PortType getPortType() {
+ return portType;
+ }
+
+ public void setPortType(PortType portType) {
+ this.portType = portType;
+ }
+
+ public String getBindingId() {
+ return bindingId;
+ }
+
+ public void setBindingId(String bindingId) {
+ this.bindingId = bindingId;
+ }
+
+ public void setWsdlDocument(WSDLDocument wsdlDoc) {
+ this.wsdlDoc = wsdlDoc;
+ }
+
+ public ParameterBinding getBinding(String operation, String part, Mode mode){
+ BindingOperation op = get(operation);
+ if(op == null){
+ //TODO throw exception
+ return null;
+ }
+ if((Mode.IN == mode)||(Mode.INOUT == mode))
+ return op.getInputBinding(part);
+ else
+ return op.getOutputBinding(part);
+ }
+
+ /**
+ * Gives binding for a given {@link BindingOperation} a wsdl part and {@link Mode}
+ * @param op must be non-null
+ * @param part must be non-null
+ * @param mode must be non-null
+ * @return parameter Binding, null the binding could not be determined.
+ */
+ public ParameterBinding getBinding(BindingOperation op, String part, Mode mode){
+ if((Mode.IN == mode)||(Mode.INOUT == mode))
+ return op.getInputBinding(part);
+ else
+ return op.getOutputBinding(part);
+ }
+
+ public String getMimeType(String operation, String part, Mode mode){
+ BindingOperation op = get(operation);
+ if(Mode.IN == mode)
+ return op.getMimeTypeForInputPart(part);
+ else
+ return op.getMimeTypeForOutputPart(part);
+ }
+
+ public void finalizeBinding(){
+ if(!finalized){
+ wsdlDoc.finalizeBinding(this);
+ finalized = true;
+ }
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/Binding.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/BindingOperation.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/BindingOperation.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/BindingOperation.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,174 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.parser;
+
+
+import javax.xml.ws.Response;
+
+import org.jboss.com.sun.xml.ws.model.Mode;
+import org.jboss.com.sun.xml.ws.model.ParameterBinding;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class BindingOperation {
+ private String name;
+
+ // map of wsdl:part to the binding
+ private Map<String, ParameterBinding> inputParts;
+ private Map<String, ParameterBinding> outputParts;
+ private Map<String, String> inputMimeTypes;
+ private Map<String, String> outputMimeTypes;
+
+ private boolean explicitInputSOAPBodyParts = false;
+ private boolean explicitOutputSOAPBodyParts = false;
+
+ private Boolean emptyInputBody;
+ private Boolean emptyOutputBody;
+
+ private Map<String, Part> inParts;
+ private Map<String, Part> outParts;
+
+
+ /**
+ *
+ * @param name wsdl:operation name qualified value
+ */
+ public BindingOperation(String name) {
+ this.name = name;
+ inputParts = new HashMap<String, ParameterBinding>();
+ outputParts = new HashMap<String, ParameterBinding>();
+ inputMimeTypes = new HashMap<String, String>();
+ outputMimeTypes = new HashMap<String, String>();
+ inParts = new HashMap<String, Part>();
+ outParts = new HashMap<String, Part>();
+ }
+
+ public String getName(){
+ return name;
+ }
+
+ public Part getPart(String partName, Mode mode){
+ if(mode.equals(Mode.IN)){
+ return inParts.get(partName);
+ }else if(mode.equals(Mode.OUT)){
+ return outParts.get(partName);
+ }
+ return null;
+ }
+
+ public void addPart(Part part, Mode mode){
+ if(mode.equals(Mode.IN))
+ inParts.put(part.getName(), part);
+ else if(mode.equals(Mode.OUT))
+ outParts.put(part.getName(), part);
+ }
+
+ public Map<String, ParameterBinding> getInputParts() {
+ return inputParts;
+ }
+
+ public Map<String, ParameterBinding> getOutputParts() {
+ return outputParts;
+ }
+
+ public Map<String, String> getInputMimeTypes() {
+ return inputMimeTypes;
+ }
+
+ public Map<String, String> getOutputMimeTypes() {
+ return outputMimeTypes;
+ }
+
+ public ParameterBinding getInputBinding(String part){
+ if(emptyInputBody == null){
+ if(inputParts.get(" ") != null)
+ emptyInputBody = true;
+ else
+ emptyInputBody = false;
+ }
+ ParameterBinding block = inputParts.get(part);
+ if(block == null){
+ if(explicitInputSOAPBodyParts || emptyInputBody)
+ return ParameterBinding.UNBOUND;
+ return ParameterBinding.BODY;
+ }
+
+ return block;
+ }
+
+ public ParameterBinding getOutputBinding(String part){
+ if(emptyOutputBody == null){
+ if(outputParts.get(" ") != null)
+ emptyOutputBody = true;
+ else
+ emptyOutputBody = false;
+ }
+ ParameterBinding block = outputParts.get(part);
+ if(block == null){
+ if(explicitOutputSOAPBodyParts || emptyOutputBody)
+ return ParameterBinding.UNBOUND;
+ return ParameterBinding.BODY;
+ }
+
+ return block;
+ }
+
+ public String getMimeTypeForInputPart(String part){
+ return inputMimeTypes.get(part);
+ }
+
+ public String getMimeTypeForOutputPart(String part){
+ return outputMimeTypes.get(part);
+ }
+
+ public void setInputExplicitBodyParts(boolean b) {
+ explicitInputSOAPBodyParts = b;
+ }
+
+ public void setOutputExplicitBodyParts(boolean b) {
+ explicitOutputSOAPBodyParts = b;
+ }
+
+ String reqNamespace;
+ String respNamespace;
+
+ /**
+ * For rpclit gives namespace value on soapbinding:body@namespace
+ *
+ * @return non-null for rpclit and null for doclit
+ * @see
org.jboss.com.sun.xml.ws.modeler.RuntimeModeler#processRpcMethod(org.jboss.com.sun.xml.ws.model.JavaMethod,
String, javax.jws.WebMethod, String, java.lang.reflect.Method, javax.jws.WebService)
+ */
+ public String getRequestNamespace(){
+ return reqNamespace;
+ }
+
+ /**
+ * For rpclit gives namespace value on soapbinding:body@namespace
+ *
+ * @return non-null for rpclit and null for doclit
+ * * @see
org.jboss.com.sun.xml.ws.modeler.RuntimeModeler#processRpcMethod(org.jboss.com.sun.xml.ws.model.JavaMethod,
String, javax.jws.WebMethod, String, java.lang.reflect.Method, javax.jws.WebService)
+ */
+ public String getResponseNamespace(){
+ return respNamespace;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/BindingOperation.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/MIMEConstants.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/MIMEConstants.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/MIMEConstants.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,37 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.parser;
+
+import javax.xml.namespace.QName;
+
+
+public interface MIMEConstants {
+ // namespace URIs
+ public static String NS_WSDL_MIME =
"http://schemas.xmlsoap.org/wsdl/mime/";
+
+ // QNames
+ public static QName QNAME_CONTENT = new QName(NS_WSDL_MIME, "content");
+ public static QName QNAME_MULTIPART_RELATED =
+ new QName(NS_WSDL_MIME, "multipartRelated");
+ public static QName QNAME_PART = new QName(NS_WSDL_MIME, "part");
+ public static QName QNAME_MIME_XML = new QName(NS_WSDL_MIME, "mimeXml");
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/MIMEConstants.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/Message.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/Message.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/Message.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,42 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.parser;
+
+import javax.xml.namespace.QName;
+import java.util.HashMap;
+import java.util.TreeMap;
+import java.util.LinkedHashSet;
+
+public class Message extends LinkedHashSet<String>{
+ private QName name;
+
+ /**
+ * @param name wsdl:message name attribute qualified name
+ */
+ public Message(QName name) {
+ this.name = name;
+ }
+
+ public QName getName() {
+ return name;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/Message.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/ParserUtil.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/ParserUtil.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/ParserUtil.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,118 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.parser;
+
+
+
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+
+import org.jboss.com.sun.xml.ws.streaming.Attributes;
+import org.jboss.com.sun.xml.ws.streaming.XMLReader;
+import org.jboss.com.sun.xml.ws.streaming.XMLReaderException;
+import org.jboss.com.sun.xml.ws.util.xml.XmlUtil;
+
+
+/**
+ * @author WS Development Team
+ */
+public class ParserUtil {
+ public static String getAttribute(XMLStreamReader reader, String name) {
+ return reader.getAttributeValue(null, name);
+ }
+
+ public static void verifyTag(XMLReader reader, QName name) {
+ if (!name.equals(reader.getName())) {
+ throw new XMLReaderException("xmlreader.unexpectedState.tag",
+ new Object[] { name, reader.getName() });
+ }
+ }
+
+ public static QName getQName(XMLStreamReader reader, String tag){
+ String localName = XmlUtil.getLocalPart(tag);
+ String pfix = XmlUtil.getPrefix(tag);
+ String uri = reader.getNamespaceURI(pfix);
+ return new QName(uri, localName);
+ }
+
+ public static String getMandatoryNonEmptyAttribute(XMLStreamReader reader,
+ String name) {
+// String value = getAttribute(reader, name);
+ String value = reader.getAttributeValue(null, name);
+
+ if (value == null) {
+ failWithLocalName("client.missing.attribute", reader, name);
+ } else if (value.equals("")) {
+ failWithLocalName("client.invalidAttributeValue", reader, name);
+ }
+
+ return value;
+ }
+
+ public static void fail(String key, XMLReader reader) {
+ //throw new WebServicesClientException(key,
+ // Integer.toString(reader.getLineNumber()));
+ }
+
+ public static void failWithFullName(String key, XMLReader reader) {
+ //throw new WebServicesClientException(key,
+ //new Object[]{
+ // Integer.toString(reader.getLineNumber()),
+ // reader.getName().toString()});
+ }
+
+ public static void failWithFullName(String key, XMLStreamReader reader) {
+// throw new WebServicesClientException(key,
+// new Object[]{
+// Integer.toString(reader.getLineNumber()),
+// reader.getName().toString()});
+ }
+
+ public static void failWithLocalName(String key, XMLStreamReader reader) {
+ //throw new WebServicesClientException(key,
+ // new Object[]{
+ // Integer.toString(reader.getLineNumber()),
+ // reader.getLocalName()});
+ }
+
+ public static void failWithLocalName(String key, XMLReader reader,
+ String arg) {
+ //throw new WebServicesClientException(key,
+ // new Object[]{
+ // Integer.toString(reader.getLineNumber()),
+ // reader.getLocalName(),
+ // arg});
+ }
+
+ public static void failWithLocalName(String key, XMLStreamReader reader,
+ String arg) {
+ //throw new WebServicesClientException(key,
+ // new Object[]{
+ // Integer.toString(reader.getLineNumber()),
+ // reader.getLocalName(),
+ // arg});
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/ParserUtil.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/Part.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/Part.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/Part.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,48 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.parser;
+
+import org.jboss.com.sun.xml.ws.model.ParameterBinding;
+
+public class Part {
+ private String name;
+ private ParameterBinding binding;
+ private int index;
+
+ public Part(String name, ParameterBinding binding, int index) {
+ this.name = name;
+ this.binding = binding;
+ this.index = index;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public ParameterBinding getBinding() {
+ return binding;
+ }
+
+ public int getIndex() {
+ return index;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/Part.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/Port.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/Port.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/Port.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,59 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.parser;
+
+import javax.xml.namespace.QName;
+
+public class Port {
+ private QName name;
+ private String address;
+ private QName bindingName;
+ private Binding binding;
+
+ public Port(QName name, QName binding, String address) {
+ this.name = name;
+ this.bindingName = binding;
+ this.address = address;
+ }
+
+ public QName getName() {
+ return name;
+ }
+
+ public QName getBindingName() {
+ return bindingName;
+ }
+
+ public String getAddress() {
+ return address;
+ }
+
+ public Binding getBinding() {
+ return binding;
+ }
+
+ public void setBinding(Binding binding) {
+ this.binding = binding;
+ }
+
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/Port.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/PortType.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/PortType.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/PortType.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,38 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.parser;
+
+import javax.xml.namespace.QName;
+import java.util.HashMap;
+
+public class PortType extends HashMap<String, PortTypeOperation>{
+ private QName name;
+
+ public PortType(QName name) {
+ super();
+ this.name = name;
+ }
+
+ public QName getName() {
+ return name;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/PortType.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/PortTypeOperation.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/PortTypeOperation.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/PortTypeOperation.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,73 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.parser;
+
+import javax.xml.namespace.QName;
+
+public class PortTypeOperation{
+ private QName name;
+ private String parameterOrder;
+ private QName inputMessage;
+ private QName outputMessage;
+ private QName faultMessage;
+
+ public PortTypeOperation(QName name) {
+ this.name = name;
+ }
+
+ public QName getName() {
+ return name;
+ }
+
+ public String getParameterOrder() {
+ return parameterOrder;
+ }
+
+ public void setParameterOrder(String parameterOrder) {
+ this.parameterOrder = parameterOrder;
+ }
+
+ public QName getInputMessage() {
+ return inputMessage;
+ }
+
+ public void setInputMessage(QName inputMessage) {
+ this.inputMessage = inputMessage;
+ }
+
+ public QName getOutputMessage() {
+ return outputMessage;
+ }
+
+ public void setOutputMessage(QName outputMessage) {
+ this.outputMessage = outputMessage;
+ }
+
+ public QName getFaultMessage() {
+ return faultMessage;
+ }
+
+ public void setFaultMessage(QName faultMessage) {
+ this.faultMessage = faultMessage;
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/PortTypeOperation.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/RuntimeWSDLParser.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/RuntimeWSDLParser.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/RuntimeWSDLParser.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,558 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.wsdl.parser;
+import org.jboss.com.sun.xml.ws.model.ParameterBinding;
+import org.jboss.com.sun.xml.ws.server.DocInfo;
+import org.jboss.com.sun.xml.ws.server.DocInfo.DOC_TYPE;
+import org.jboss.com.sun.xml.ws.streaming.TidyXMLStreamReader;
+import org.jboss.com.sun.xml.ws.streaming.XMLStreamReaderFactory;
+import org.jboss.com.sun.xml.ws.streaming.XMLStreamReaderUtil;
+import org.jboss.com.sun.xml.ws.util.xml.XmlUtil;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.ws.soap.SOAPBinding;
+import javax.xml.ws.WebServiceException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.net.URL;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.HashSet;
+
+public class RuntimeWSDLParser {
+ private final WSDLDocument wsdlDoc = new WSDLDocument();
+ /**
+ * Target namespace URI of the WSDL that we are currently parsing.
+ */
+ private String targetNamespace;
+ /**
+ * System IDs of WSDLs that are already read.
+ */
+ private final Set<String> importedWSDLs = new HashSet<String>();
+ /**
+ * Must not be null.
+ */
+ private final EntityResolver resolver;
+
+ public static WSDLDocument parse(URL wsdlLoc, EntityResolver resolver) throws
IOException, XMLStreamException, SAXException {
+ assert resolver!=null;
+ RuntimeWSDLParser parser = new RuntimeWSDLParser(resolver);
+ parser.parseWSDL(wsdlLoc);
+ return parser.wsdlDoc;
+ }
+
+ /*
+ * Fills DocInfo with Document type(WSDL, or schema),
+ * Service Name, Port Type name, targetNamespace for the document.
+ *
+ * Don't follow imports
+ */
+ public static void fillDocInfo(DocInfo docInfo, QName serviceName,
+ QName portTypeName) throws XMLStreamException {
+
+ RuntimeWSDLParser parser = new RuntimeWSDLParser(null);
+ InputSource source = new InputSource(docInfo.getDoc());
+
+ XMLStreamReader reader = createReader(source);
+ try {
+ XMLStreamReaderUtil.nextElementContent(reader);
+
+ if(reader.getName().equals(WSDLConstants.QNAME_SCHEMA)){
+ docInfo.setDocType(DOC_TYPE.SCHEMA);
+ String tns = ParserUtil.getMandatoryNonEmptyAttribute(reader,
WSDLConstants.ATTR_TNS);
+ docInfo.setTargetNamespace(tns);
+ return;
+ }else if (reader.getName().equals(WSDLConstants.QNAME_DEFINITIONS)) {
+ docInfo.setDocType(DOC_TYPE.WSDL);
+ String tns = ParserUtil.getMandatoryNonEmptyAttribute(reader,
WSDLConstants.ATTR_TNS);
+ parser.targetNamespace = tns;
+ docInfo.setTargetNamespace(tns);
+ }else{
+ docInfo.setDocType(DOC_TYPE.OTHER);
+ return;
+ }
+
+ while (XMLStreamReaderUtil.nextElementContent(reader) !=
+ XMLStreamConstants.END_ELEMENT) {
+ if(reader.getEventType() == XMLStreamConstants.END_DOCUMENT)
+ break;
+
+ QName name = reader.getName();
+ if (WSDLConstants.QNAME_PORT_TYPE.equals(name)) {
+ String pn = ParserUtil.getMandatoryNonEmptyAttribute(reader,
WSDLConstants.ATTR_NAME);
+ if (portTypeName != null) {
+ if(portTypeName.getLocalPart().equals(pn) &&
portTypeName.getNamespaceURI().equals(docInfo.getTargetNamespace())) {
+ docInfo.setHavingPortType(true);
+ }
+ }
+ XMLStreamReaderUtil.skipElement(reader);
+ } else if (WSDLConstants.QNAME_SERVICE.equals(name)) {
+ String sn = ParserUtil.getMandatoryNonEmptyAttribute(reader,
WSDLConstants.ATTR_NAME);
+ QName sqn = new QName(docInfo.getTargetNamespace(), sn);
+ if(serviceName.equals(sqn)) {
+ parser.parseService(reader);
+ docInfo.setService(parser.wsdlDoc.getService(sqn));
+ if(reader.getEventType() != XMLStreamConstants.END_ELEMENT)
+ XMLStreamReaderUtil.next(reader);
+ } else {
+ XMLStreamReaderUtil.skipElement(reader);
+ }
+ } else{
+ XMLStreamReaderUtil.skipElement(reader);
+ }
+ }
+ } finally {
+ reader.close();
+ }
+ }
+
+ private RuntimeWSDLParser(EntityResolver resolver) {
+ this.resolver = resolver;
+ }
+
+ /**
+ * Make sure to return a "fresh" reader each time it is called because
+ * more than one active reader may be needed within a single thread
+ * to parse a WSDL file.
+ */
+ private static XMLStreamReader createReader(InputSource source) {
+ // Char stream available?
+ if (source.getCharacterStream() != null) {
+ Reader reader = source.getCharacterStream();
+ return new
TidyXMLStreamReader(XMLStreamReaderFactory.createFreshXMLStreamReader(source.getSystemId(),
reader), reader);
+ }
+
+ // Byte stream available?
+ if (source.getByteStream() != null) {
+ InputStream stream = source.getByteStream();
+ return new
TidyXMLStreamReader(XMLStreamReaderFactory.createFreshXMLStreamReader(source.getSystemId(),
stream), stream);
+ }
+
+ // Otherwise, open URI
+ try {
+ InputStream stream = new URL(source.getSystemId()).openStream();
+ return new
TidyXMLStreamReader(XMLStreamReaderFactory.createFreshXMLStreamReader(source.getSystemId(),
stream), stream);
+ } catch (IOException e) {
+ throw new WebServiceException(e);
+ }
+ }
+
+ private void parseWSDL(URL wsdlLoc) throws XMLStreamException, IOException,
SAXException {
+
+// String systemId = wsdlLoc.toExternalForm();
+// InputSource source = resolver.resolveEntity(null,systemId);
+// if(source==null)
+// source = new InputSource(systemId);
+
+ InputSource source = resolver.resolveEntity(null,wsdlLoc.toExternalForm());
+ if(source==null)
+ source = new InputSource(wsdlLoc.toExternalForm()); // default resolution
+ else
+ if(source.getSystemId()==null)
+ // ideally entity resolvers should be giving us the system ID for the
resource
+ // (or otherwise we won't be able to resolve references within this
imported WSDL correctly),
+ // but if none is given, the system ID before the entity resolution is
better than nothing.
+ source.setSystemId(wsdlLoc.toExternalForm());
+
+ // avoid processing the same WSDL twice.
+ if(!importedWSDLs.add(source.getSystemId()))
+ return;
+
+
+ XMLStreamReader reader = createReader(source);
+ XMLStreamReaderUtil.nextElementContent(reader);
+
+ //wsdl:definition
+ if (!reader.getName().equals(WSDLConstants.QNAME_DEFINITIONS)) {
+ ParserUtil.failWithFullName("runtime.parser.wsdl.invalidElement",
reader);
+ }
+
+ //get the targetNamespace of the service
+ String tns = ParserUtil.getMandatoryNonEmptyAttribute(reader,
WSDLConstants.ATTR_TNS);
+
+ final String oldTargetNamespace = targetNamespace;
+ targetNamespace = tns;
+
+ while (XMLStreamReaderUtil.nextElementContent(reader) !=
+ XMLStreamConstants.END_ELEMENT) {
+ if(reader.getEventType() == XMLStreamConstants.END_DOCUMENT)
+ break;
+
+ QName name = reader.getName();
+ if (WSDLConstants.QNAME_IMPORT.equals(name)) {
+ parseImport(wsdlLoc, reader);
+ } else if(WSDLConstants.QNAME_MESSAGE.equals(name)){
+ parseMessage(reader);
+ } else if(WSDLConstants.QNAME_PORT_TYPE.equals(name)){
+ parsePortType(reader);
+ } else if (WSDLConstants.QNAME_BINDING.equals(name)) {
+ parseBinding(reader);
+ } else if (WSDLConstants.QNAME_SERVICE.equals(name)) {
+ parseService(reader);
+ } else{
+ XMLStreamReaderUtil.skipElement(reader);
+ }
+ }
+ targetNamespace = oldTargetNamespace;
+ reader.close();
+ }
+
+ private void parseService(XMLStreamReader reader) {
+ String serviceName = ParserUtil.getMandatoryNonEmptyAttribute(reader,
WSDLConstants.ATTR_NAME);
+ Service service = new Service(new QName(targetNamespace, serviceName));
+ while (XMLStreamReaderUtil.nextElementContent(reader) !=
XMLStreamConstants.END_ELEMENT) {
+ QName name = reader.getName();
+ if(WSDLConstants.QNAME_PORT.equals(name)){
+ parsePort(reader, service);
+ if(reader.getEventType() != XMLStreamConstants.END_ELEMENT)
+ XMLStreamReaderUtil.next(reader);
+ }else{
+ XMLStreamReaderUtil.skipElement(reader);
+ }
+ }
+ wsdlDoc.addService(service);
+ }
+
+ private static void parsePort(XMLStreamReader reader, Service service) {
+ String portName = ParserUtil.getMandatoryNonEmptyAttribute(reader,
WSDLConstants.ATTR_NAME);
+ String binding = ParserUtil.getMandatoryNonEmptyAttribute(reader,
"binding");
+ QName bindingName = ParserUtil.getQName(reader, binding);
+ String location = null;
+ while (XMLStreamReaderUtil.nextElementContent(reader) !=
XMLStreamConstants.END_ELEMENT) {
+ QName name = reader.getName();
+
if(SOAPConstants.QNAME_ADDRESS.equals(name)||SOAPConstants.QNAME_SOAP12ADDRESS.equals(name)){
+ location = ParserUtil.getMandatoryNonEmptyAttribute(reader,
WSDLConstants.ATTR_LOCATION);
+ XMLStreamReaderUtil.next(reader);
+ }else{
+ XMLStreamReaderUtil.skipElement(reader);
+ }
+ }
+ QName portQName = new QName(service.getName().getNamespaceURI(), portName);
+ service.put(portQName, new Port(portQName, bindingName, location));
+ }
+
+ private void parseBinding(XMLStreamReader reader) {
+ String bindingName = ParserUtil.getMandatoryNonEmptyAttribute(reader,
"name");
+ String portTypeName = ParserUtil.getMandatoryNonEmptyAttribute(reader,
"type");
+ if((bindingName == null) || (portTypeName == null)){
+ //TODO: throw exception?
+ //skip wsdl:binding element for now
+ XMLStreamReaderUtil.skipElement(reader);
+ return;
+ }
+ Binding binding = new Binding(new QName(targetNamespace, bindingName),
+ ParserUtil.getQName(reader, portTypeName));
+ binding.setWsdlDocument(wsdlDoc);
+ wsdlDoc.addBinding(binding);
+
+ while (XMLStreamReaderUtil.nextElementContent(reader) !=
XMLStreamConstants.END_ELEMENT) {
+ QName name = reader.getName();
+ if (WSDLConstants.NS_SOAP_BINDING.equals(name)) {
+ binding.setBindingId(SOAPBinding.SOAP11HTTP_BINDING);
+ XMLStreamReaderUtil.next(reader);
+ } else if (WSDLConstants.NS_SOAP12_BINDING.equals(name)) {
+ binding.setBindingId(SOAPBinding.SOAP12HTTP_BINDING);
+ XMLStreamReaderUtil.next(reader);
+ } else if (WSDLConstants.QNAME_OPERATION.equals(name)) {
+ parseBindingOperation(reader, binding);
+ }else{
+ XMLStreamReaderUtil.skipElement(reader);
+ }
+ }
+ }
+
+ private static void parseBindingOperation(XMLStreamReader reader, Binding binding) {
+ String bindingOpName = ParserUtil.getMandatoryNonEmptyAttribute(reader,
"name");
+ if(bindingOpName == null){
+ //TODO: throw exception?
+ //skip wsdl:binding element for now
+ XMLStreamReaderUtil.skipElement(reader);
+ return;
+ }
+
+ BindingOperation bindingOp = new BindingOperation(bindingOpName);
+ binding.put(bindingOpName, bindingOp);
+
+ while (XMLStreamReaderUtil.nextElementContent(reader) !=
XMLStreamConstants.END_ELEMENT) {
+ QName name = reader.getName();
+ if (WSDLConstants.QNAME_INPUT.equals(name)) {
+ parseInputBinding(reader, bindingOp);
+ }else if(WSDLConstants.QNAME_OUTPUT.equals(name)){
+ parseOutputBinding(reader, bindingOp);
+ }else{
+ XMLStreamReaderUtil.skipElement(reader);
+ }
+ }
+ }
+
+ private static void parseInputBinding(XMLStreamReader reader, BindingOperation
bindingOp) {
+ boolean bodyFound = false;
+ while (XMLStreamReaderUtil.nextElementContent(reader) !=
XMLStreamConstants.END_ELEMENT) {
+ QName name = reader.getName();
+ if((SOAPConstants.QNAME_BODY.equals(name) ||
SOAPConstants.QNAME_SOAP12BODY.equals(name)) && !bodyFound){
+ bodyFound = true;
+ bindingOp.setInputExplicitBodyParts(parseSOAPBodyBinding(reader,
bindingOp, BindingMode.INPUT));
+ goToEnd(reader);
+ }else if((SOAPConstants.QNAME_HEADER.equals(name) ||
SOAPConstants.QNAME_SOAP12HEADER.equals(name))){
+ parseSOAPHeaderBinding(reader, bindingOp.getInputParts());
+ }else if(MIMEConstants.QNAME_MULTIPART_RELATED.equals(name)){
+ parseMimeMultipartBinding(reader, bindingOp, BindingMode.INPUT);
+ }else{
+ XMLStreamReaderUtil.skipElement(reader);
+ }
+
+ }
+ }
+
+ private static void parseOutputBinding(XMLStreamReader reader, BindingOperation
bindingOp) {
+ boolean bodyFound = false;
+ while (XMLStreamReaderUtil.nextElementContent(reader) !=
XMLStreamConstants.END_ELEMENT) {
+ QName name = reader.getName();
+ if((SOAPConstants.QNAME_BODY.equals(name) ||
SOAPConstants.QNAME_SOAP12BODY.equals(name)) && !bodyFound){
+ bodyFound = true;
+ bindingOp.setOutputExplicitBodyParts(parseSOAPBodyBinding(reader,
bindingOp, BindingMode.OUTPUT));
+ goToEnd(reader);
+ }else if((SOAPConstants.QNAME_HEADER.equals(name) ||
SOAPConstants.QNAME_SOAP12HEADER.equals(name))){
+ parseSOAPHeaderBinding(reader, bindingOp.getOutputParts());
+ }else if(MIMEConstants.QNAME_MULTIPART_RELATED.equals(name)){
+ parseMimeMultipartBinding(reader, bindingOp, BindingMode.OUTPUT);
+ }else{
+ XMLStreamReaderUtil.skipElement(reader);
+ }
+
+ }
+ }
+
+ private static boolean parseSOAPBodyBinding(XMLStreamReader reader, BindingOperation
op, BindingMode mode){
+ String namespace = reader.getAttributeValue(null, "namespace");
+ if(mode == BindingMode.INPUT){
+ op.reqNamespace = namespace;
+ return parseSOAPBodyBinding(reader, op.getInputParts());
+ }
+ //resp
+ op.respNamespace = namespace;
+ return parseSOAPBodyBinding(reader, op.getOutputParts());
+ }
+
+ /**
+ * Returns true if body has explicit parts declaration
+ */
+ private static boolean parseSOAPBodyBinding(XMLStreamReader reader, Map<String,
ParameterBinding> parts){
+ String partsString = reader.getAttributeValue(null, "parts");
+ if(partsString != null){
+ List<String> partsList = XmlUtil.parseTokenList(partsString);
+ if(partsList.isEmpty()){
+ parts.put(" ", ParameterBinding.BODY);
+ }else{
+ for(String part:partsList){
+ parts.put(part, ParameterBinding.BODY);
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+
+ private static void parseSOAPHeaderBinding(XMLStreamReader reader,
Map<String,ParameterBinding> parts){
+ String part = reader.getAttributeValue(null, "part");
+ //if(part == null| part.equals("")||message == null ||
message.equals("")){
+ if(part == null| part.equals("")){
+ return;
+ }
+
+ //lets not worry about message attribute for now, probably additional headers
wont be there
+ //String message = reader.getAttributeValue(null, "message");
+ //QName msgName = ParserUtil.getQName(reader, message);
+ parts.put(part, ParameterBinding.HEADER);
+ goToEnd(reader);
+ }
+
+
+ private enum BindingMode {INPUT, OUTPUT};
+
+ private static void parseMimeMultipartBinding(XMLStreamReader reader,
BindingOperation op, BindingMode mode){
+ while (XMLStreamReaderUtil.nextElementContent(reader) !=
XMLStreamConstants.END_ELEMENT) {
+ QName name = reader.getName();
+ if(MIMEConstants.QNAME_PART.equals(name)){
+ parseMIMEPart(reader, op, mode);
+ }else{
+ XMLStreamReaderUtil.skipElement(reader);
+ }
+ }
+
+ }
+
+ private static void parseMIMEPart(XMLStreamReader reader, BindingOperation op,
BindingMode mode) {
+ boolean bodyFound = false;
+ Map<String,ParameterBinding> parts = null;
+ Map<String,String> mimeTypes = null;
+ if(mode == BindingMode.INPUT){
+ parts = op.getInputParts();
+ mimeTypes = op.getInputMimeTypes();
+ }else{
+ parts = op.getOutputParts();
+ mimeTypes = op.getOutputMimeTypes();
+ }
+
+ while (XMLStreamReaderUtil.nextElementContent(reader) !=
XMLStreamConstants.END_ELEMENT) {
+ QName name = reader.getName();
+ if(SOAPConstants.QNAME_BODY.equals(name) && !bodyFound){
+ bodyFound = true;
+ parseSOAPBodyBinding(reader, op, mode);
+ XMLStreamReaderUtil.next(reader);
+ }else if(SOAPConstants.QNAME_HEADER.equals(name)){
+ bodyFound = true;
+ parseSOAPHeaderBinding(reader, parts);
+ XMLStreamReaderUtil.next(reader);
+ }else if(MIMEConstants.QNAME_CONTENT.equals(name)){
+ String part = reader.getAttributeValue(null, "part");
+ String type = reader.getAttributeValue(null, "type");
+ if((part == null) || (type == null)){
+ XMLStreamReaderUtil.skipElement(reader);
+ continue;
+ }
+ ParameterBinding sb = ParameterBinding.createAttachment(type);
+ parts.put(part, sb);
+ //mimeTypes.put(part, type);
+ XMLStreamReaderUtil.next(reader);
+ }else{
+ XMLStreamReaderUtil.skipElement(reader);
+ }
+ }
+ }
+
+ protected void parseImport(URL baseURL, XMLStreamReader reader) throws IOException,
SAXException, XMLStreamException {
+ // expand to the absolute URL of the imported WSDL.
+ String importLocation =
+ ParserUtil.getMandatoryNonEmptyAttribute(reader,
WSDLConstants.ATTR_LOCATION);
+ URL importURL = new URL(baseURL,importLocation);
+ parseWSDL(importURL);
+ while (XMLStreamReaderUtil.nextElementContent(reader) !=
XMLStreamConstants.END_ELEMENT){
+ XMLStreamReaderUtil.skipElement(reader);
+ }
+ }
+
+ private void parsePortType(XMLStreamReader reader) {
+ String portTypeName = ParserUtil.getMandatoryNonEmptyAttribute(reader,
WSDLConstants.ATTR_NAME);
+ if(portTypeName == null){
+ //TODO: throw exception?
+ //skip wsdl:portType element for now
+ XMLStreamReaderUtil.skipElement(reader);
+ return;
+ }
+ PortType portType = new PortType(new QName(targetNamespace, portTypeName));
+ wsdlDoc.addPortType(portType);
+ while (XMLStreamReaderUtil.nextElementContent(reader) !=
XMLStreamConstants.END_ELEMENT) {
+ QName name = reader.getName();
+ if(WSDLConstants.QNAME_OPERATION.equals(name)){
+ parsePortTypeOperation(reader, portType);
+ }else{
+ XMLStreamReaderUtil.skipElement(reader);
+ }
+ }
+ }
+
+ private void parsePortTypeOperation(XMLStreamReader reader, PortType portType) {
+ String operationName = ParserUtil.getMandatoryNonEmptyAttribute(reader,
WSDLConstants.ATTR_NAME);
+ if(operationName == null){
+ //TODO: throw exception?
+ //skip wsdl:portType element for now
+ XMLStreamReaderUtil.skipElement(reader);
+ return;
+ }
+
+ QName operationQName = new QName(portType.getName().getNamespaceURI(),
operationName);
+ PortTypeOperation operation = new PortTypeOperation(operationQName);
+ String parameterOrder = ParserUtil.getAttribute(reader,
"parameterOrder");
+ operation.setParameterOrder(parameterOrder);
+ portType.put(operationName, operation);
+ while (XMLStreamReaderUtil.nextElementContent(reader) !=
XMLStreamConstants.END_ELEMENT) {
+ QName name = reader.getName();
+ if(name.equals(WSDLConstants.QNAME_INPUT)){
+ parsePortTypeOperationInput(reader, operation);
+ }else if(name.equals(WSDLConstants.QNAME_OUTPUT)){
+ parsePortTypeOperationOutput(reader, operation);
+ }else{
+ XMLStreamReaderUtil.skipElement(reader);
+ }
+ }
+ }
+
+ private void parsePortTypeOperationInput(XMLStreamReader reader, PortTypeOperation
operation) {
+ String msg = ParserUtil.getAttribute(reader, "message");
+ QName msgName = ParserUtil.getQName(reader, msg);
+ operation.setInputMessage(msgName);
+ goToEnd(reader);
+ }
+
+ private void parsePortTypeOperationOutput(XMLStreamReader reader, PortTypeOperation
operation) {
+ String msg = ParserUtil.getAttribute(reader, "message");
+ QName msgName = ParserUtil.getQName(reader, msg);
+ operation.setOutputMessage(msgName);
+ goToEnd(reader);
+ }
+
+ private void parseMessage(XMLStreamReader reader) {
+ String msgName = ParserUtil.getMandatoryNonEmptyAttribute(reader,
WSDLConstants.ATTR_NAME);
+ Message msg = new Message(new QName(targetNamespace, msgName));
+ while (XMLStreamReaderUtil.nextElementContent(reader) !=
XMLStreamConstants.END_ELEMENT) {
+ QName name = reader.getName();
+ if (WSDLConstants.QNAME_PART.equals(name)) {
+ String part = ParserUtil.getMandatoryNonEmptyAttribute(reader,
WSDLConstants.ATTR_NAME);
+// String desc = null;
+// int index = reader.getAttributeCount();
+// for (int i = 0; i < index; i++) {
+// if (reader.getAttributeName(i).equals("element") ||
reader.getAttributeName(i).equals("type")) {
+// desc = reader.getAttributeValue(i);
+// break;
+// }
+// }
+// if (desc == null)
+// continue;
+ msg.add(part);
+ if(reader.getEventType() != XMLStreamConstants.END_ELEMENT)
+ goToEnd(reader);
+ }else{
+ XMLStreamReaderUtil.skipElement(reader);
+ }
+ }
+ wsdlDoc.addMessage(msg);
+ if(reader.getEventType() != XMLStreamConstants.END_ELEMENT)
+ goToEnd(reader);
+ }
+
+ private static void goToEnd(XMLStreamReader reader){
+ while (XMLStreamReaderUtil.nextElementContent(reader) !=
XMLStreamConstants.END_ELEMENT){
+ XMLStreamReaderUtil.skipElement(reader);
+ }
+ }
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/RuntimeWSDLParser.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/SOAPConstants.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/SOAPConstants.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/SOAPConstants.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,68 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.parser;
+
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.xml.ws.encoding.soap.streaming.SOAP12NamespaceConstants;
+import org.jboss.com.sun.xml.ws.encoding.soap.streaming.SOAPNamespaceConstants;
+
+public interface SOAPConstants {
+
+ // namespace URIs
+ public static final String URI_ENVELOPE = SOAPNamespaceConstants.ENVELOPE;
+ public static final String URI_ENVELOPE12 = SOAP12NamespaceConstants.ENVELOPE;
+
+ public static final String NS_WSDL_SOAP =
+ "http://schemas.xmlsoap.org/wsdl/soap/";
+
+ public static final String NS_WSDL_SOAP12 =
+ "http://schemas.xmlsoap.org/wsdl/soap12/";
+
+ public static final String NS_SOAP_ENCODING =
"http://schemas.xmlsoap.org/soap/encoding/";
+
+ // other URIs
+ public final String URI_SOAP_TRANSPORT_HTTP =
+ "http://schemas.xmlsoap.org/soap/http";
+
+ // QNames
+ public static final QName QNAME_ADDRESS =
+ new QName(NS_WSDL_SOAP, "address");
+ public static final QName QNAME_SOAP12ADDRESS =
+ new QName(NS_WSDL_SOAP12, "address");
+ public static final QName QNAME_BINDING =
+ new QName(NS_WSDL_SOAP, "binding");
+ public static final QName QNAME_BODY = new QName(NS_WSDL_SOAP, "body");
+ public static final QName QNAME_SOAP12BODY = new QName(NS_WSDL_SOAP12,
"body");
+ public static final QName QNAME_FAULT = new QName(NS_WSDL_SOAP, "fault");
+ public static final QName QNAME_HEADER = new QName(NS_WSDL_SOAP,
"header");
+ public static final QName QNAME_SOAP12HEADER = new QName(NS_WSDL_SOAP12,
"header");
+ public static final QName QNAME_HEADERFAULT =
+ new QName(NS_WSDL_SOAP, "headerfault");
+ public static final QName QNAME_OPERATION =
+ new QName(NS_WSDL_SOAP, "operation");
+ public static final QName QNAME_MUSTUNDERSTAND =
+ new QName(URI_ENVELOPE, "mustUnderstand");
+
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/SOAPConstants.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/Service.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/Service.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/Service.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,40 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.parser;
+
+import javax.xml.namespace.QName;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+
+public class Service extends LinkedHashMap<QName, Port> {
+ private QName name;
+
+ public Service(QName name) {
+ super();
+ this.name = name;
+ }
+
+ public QName getName() {
+ return name;
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/Service.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/WSDLConstants.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/WSDLConstants.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/WSDLConstants.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,78 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.parser;
+
+import javax.xml.namespace.QName;
+
+
+/**
+ * Interface defining WSDL-related constants.
+ *
+ * @author WS Development Team
+ */
+public interface WSDLConstants {
+ // namespace URIs
+ public static final String NS_XMLNS = "http://www.w3.org/2001/XMLSchema";
+ public static final String NS_WSDL = "http://schemas.xmlsoap.org/wsdl/";
+ public static final String NS_SOAP11_HTTP_BINDING =
"http://schemas.xmlsoap.org/soap/http";
+
+ public static final QName QNAME_SCHEMA = new QName(NS_XMLNS, "schema");
+
+ // QNames
+ public static final QName QNAME_BINDING = new QName(NS_WSDL, "binding");
+ public static final QName QNAME_DEFINITIONS = new QName(NS_WSDL,
"definitions");
+ public static final QName QNAME_DOCUMENTATION = new QName(NS_WSDL,
"documentation");
+ public static final QName NS_SOAP_BINDING_ADDRESS = new
QName("http://schemas.xmlsoap.org/wsdl/soap/",
+ "address");
+ public static final QName NS_SOAP_BINDING = new
QName("http://schemas.xmlsoap.org/wsdl/soap/",
+ "binding");
+ public static final QName NS_SOAP12_BINDING = new
QName("http://schemas.xmlsoap.org/wsdl/soap12/",
+ "binding");
+ public static final QName NS_SOAP12_BINDING_ADDRESS = new
QName("http://schemas.xmlsoap.org/wsdl/soap12/",
+ "address");
+
+ //public static final QName QNAME_FAULT = new QName(NS_WSDL, "fault");
+ public static final QName QNAME_IMPORT = new QName(NS_WSDL, "import");
+
+ //public static final QName QNAME_INPUT = new QName(NS_WSDL, "input");
+ public static final QName QNAME_MESSAGE = new QName(NS_WSDL, "message");
+ public static final QName QNAME_PART = new QName(NS_WSDL, "part");
+ public static final QName QNAME_OPERATION = new QName(NS_WSDL,
"operation");
+ public static final QName QNAME_INPUT = new QName(NS_WSDL, "input");
+ public static final QName QNAME_OUTPUT = new QName(NS_WSDL, "output");
+
+ //public static final QName QNAME_OUTPUT = new QName(NS_WSDL, "output");
+ //public static final QName QNAME_PART = new QName(NS_WSDL, "part");
+ public static final QName QNAME_PORT = new QName(NS_WSDL, "port");
+ public static final QName QNAME_ADDRESS = new QName(NS_WSDL, "address");
+ public static final QName QNAME_PORT_TYPE = new QName(NS_WSDL,
"portType");
+ public static final QName QNAME_FAULT = new QName(NS_WSDL, "fault");
+ public static final QName QNAME_SERVICE = new QName(NS_WSDL, "service");
+ public static final QName QNAME_TYPES = new QName(NS_WSDL, "types");
+
+ public static final String ATTR_TRANSPORT = "transport";
+ public static final String ATTR_LOCATION = "location";
+ public static final String ATTR_NAME = "name";
+ public static final String ATTR_TNS = "targetNamespace";
+
+ //public static final QName QNAME_ATTR_ARRAY_TYPE = new QName(NS_WSDL,
"arrayType");
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/WSDLConstants.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/WSDLDocument.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/WSDLDocument.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/WSDLDocument.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,251 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package org.jboss.com.sun.xml.ws.wsdl.parser;
+
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.soap.SOAPBinding;
+
+import org.jboss.com.sun.xml.ws.model.Mode;
+import org.jboss.com.sun.xml.ws.model.ParameterBinding;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+public class WSDLDocument {
+ protected Map<QName, Message> messages;
+ protected Map<QName, PortType> portTypes;
+ protected Map<QName, Binding> bindings;
+ protected Map<QName, Service> services;
+
+ public WSDLDocument() {
+ messages = new HashMap<QName, Message>();
+ portTypes = new HashMap<QName, PortType>();
+ bindings = new HashMap<QName, Binding>();
+ services = new LinkedHashMap<QName, Service>();
+ }
+
+ public void addMessage(Message msg){
+ messages.put(msg.getName(), msg);
+ }
+
+ public Message getMessage(QName name){
+ return messages.get(name);
+ }
+
+ public void addPortType(PortType pt){
+ portTypes.put(pt.getName(), pt);
+ }
+
+ public PortType getPortType(QName name){
+ return portTypes.get(name);
+ }
+
+ public void addBinding(Binding binding){
+ bindings.put(binding.getName(), binding);
+ }
+
+ public Binding getBinding(QName name){
+ return bindings.get(name);
+ }
+
+ public void addService(Service svc){
+ services.put(svc.getName(), svc);
+ }
+
+ public Service getService(QName name){
+ return services.get(name);
+ }
+
+ public Map<QName, Service> getServices(){
+ return services;
+ }
+
+ /**
+ * Returns the first service QName from insertion order
+ * @return
+ */
+ public QName getFirstServiceName(){
+ if(services.isEmpty())
+ return null;
+ return services.values().iterator().next().getName();
+ }
+
+ /**
+ * Returns first port QName from first service as per the insertion order
+ * @return
+ */
+ public QName getFirstPortName(){
+ if(services.isEmpty())
+ return null;
+ Service service = services.values().iterator().next();
+ Iterator<QName> iter = service.keySet().iterator();
+ QName port = (iter.hasNext())?iter.next():null;
+ return port;
+ }
+
+ private Port getFirstPort(){
+ if(services.isEmpty())
+ return null;
+ Service service = services.values().iterator().next();
+ Collection<Port> coll = service.values();
+ Port port = (coll !=
null)?((coll.iterator().hasNext())?coll.iterator().next():null):null;
+ return port;
+ }
+
+
+ /**
+ * Returns biningId of the first port
+ * @return
+ */
+ public String getBindingId(){
+ Port port = getFirstPort();
+ if(port == null)
+ return null;
+ Binding binding = bindings.get(port.getBindingName());
+ if(binding == null)
+ return null;
+ return binding.getBindingId();
+ }
+
+ /**
+ * Gives the binding Id of the given service and port
+ * @param service
+ * @param port
+ * @return
+ */
+ public String getBindingId(QName service, QName port){
+ Service s = services.get(service);
+ if(s != null){
+ Port p = s.get(port);
+ if(p != null){
+ Binding b = bindings.get(p.getBindingName());
+ if(b != null)
+ return b.getBindingId();
+ }
+
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @param serviceName non-null service QName
+ * @param portName non-null port QName
+ * @return
+ * BindingOperation on success otherwise null. throws NPE if any of the
parameters null
+ */
+ public Binding getBinding(QName serviceName, QName portName){
+ Service service = services.get(serviceName);
+ if(service != null){
+ Port port = service.get(portName);
+ if(port != null){
+ QName bindingName = port.getBindingName();
+ return bindings.get(bindingName);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the bindings for the given bindingId
+ * @param service non-null service
+ * @param bindingId non-null binding id
+ * @return
+ */
+ public List<Binding> getBindings(Service service, String bindingId){
+ List<Binding> bs = new ArrayList<Binding>();
+ Collection<Port> ports = service.values();
+ if(ports.isEmpty())
+ return bs;
+ for(Port port:ports){
+ Binding b = bindings.get(port.getName());
+ if(b == null)
+ return bs;
+ if(b.equals(bindingId))
+ bs.add(b);
+ }
+ return bs;
+ }
+
+ public QName getPortName(QName serviceName, QName portType){
+ Service service = services.get(serviceName);
+ for(Port port:service.values()){
+ QName bindingName = port.getBindingName();
+ assert (bindingName != null);
+ Binding binding = bindings.get(bindingName);
+ QName ptName = binding.getPortTypeName();
+ assert (ptName != null);
+ if(ptName.equals(portType))
+ return port.getName();
+ }
+ return null;
+ }
+
+ public void finalizeBinding(Binding binding){
+ assert(binding != null);
+ QName portTypeName = binding.getPortTypeName();
+ if(portTypeName == null)
+ return;
+ PortType pt = portTypes.get(portTypeName);
+ if(pt == null)
+ return;
+ for(String op:binding.keySet()){
+ PortTypeOperation pto = pt.get(op);
+ if(pto == null)
+ return;
+ QName inMsgName = pto.getInputMessage();
+ if(inMsgName == null)
+ continue;
+ Message inMsg = messages.get(inMsgName);
+ BindingOperation bo = binding.get(op);
+ int bodyindex = 0;
+ if(inMsg != null){
+ for(String name:inMsg){
+ ParameterBinding pb = bo.getInputBinding(name);
+ if(pb.isBody()){
+ bo.addPart(new Part(name, pb, bodyindex++), Mode.IN);
+ }
+ }
+ }
+ bodyindex=0;
+ QName outMsgName = pto.getOutputMessage();
+ if(outMsgName == null)
+ continue;
+ Message outMsg = messages.get(outMsgName);
+ if(outMsg!= null){
+ for(String name:outMsg){
+ ParameterBinding pb = bo.getOutputBinding(name);
+ if(pb.isBody()){
+ bo.addPart(new Part(name, pb, bodyindex++), Mode.OUT);
+ }
+ }
+ }
+ }
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/parser/WSDLDocument.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/WSDLGenerator.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/WSDLGenerator.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/WSDLGenerator.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,891 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.writer;
+
+
+import com.sun.xml.bind.api.JAXBRIContext;
+import static com.sun.xml.bind.v2.schemagen.Util.*;
+import com.sun.xml.txw2.TXW;
+import com.sun.xml.txw2.TypedXmlWriter;
+import com.sun.xml.txw2.output.ResultFactory;
+import com.sun.xml.txw2.output.XmlSerializer;
+
+import javax.xml.bind.SchemaOutputResolver;
+import javax.xml.namespace.QName;
+import javax.xml.transform.Result;
+import javax.xml.ws.Holder;
+import javax.xml.ws.WebServiceException;
+
+import org.jboss.com.sun.xml.ws.encoding.soap.SOAPVersion;
+import org.jboss.com.sun.xml.ws.encoding.soap.streaming.SOAP12NamespaceConstants;
+import org.jboss.com.sun.xml.ws.encoding.soap.streaming.SOAPNamespaceConstants;
+import org.jboss.com.sun.xml.ws.model.CheckedException;
+import org.jboss.com.sun.xml.ws.model.JavaMethod;
+import org.jboss.com.sun.xml.ws.model.Parameter;
+import org.jboss.com.sun.xml.ws.model.ParameterBinding;
+import org.jboss.com.sun.xml.ws.model.RuntimeModel;
+import org.jboss.com.sun.xml.ws.model.WrapperParameter;
+import org.jboss.com.sun.xml.ws.model.soap.SOAPBinding;
+import org.jboss.com.sun.xml.ws.model.soap.Style;
+import org.jboss.com.sun.xml.ws.model.soap.Use;
+import org.jboss.com.sun.xml.ws.pept.presentation.MessageStruct;
+import org.jboss.com.sun.xml.ws.wsdl.parser.SOAPConstants;
+import org.jboss.com.sun.xml.ws.wsdl.parser.WSDLConstants;
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.Binding;
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.BindingOperationType;
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.Definitions;
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.Fault;
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.FaultType;
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.Import;
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.Message;
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.Operation;
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.ParamType;
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.Port;
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.PortType;
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.Service;
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.Types;
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.soap.Body;
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.soap.BodyType;
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.soap.Header;
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.soap.SOAPAddress;
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.soap.SOAPFault;
+
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+
+/**
+ * Class used to generate WSDLs from a <code>RunTimeModel</code>
+ *
+ * @author WS Development Team
+ */
+public class WSDLGenerator {
+ private JAXWSOutputSchemaResolver resolver;
+ private WSDLOutputResolver wsdlResolver = null;
+ private RuntimeModel model;
+ private Definitions serviceDefinitions;
+ private Definitions portDefinitions;
+ private Types types;
+ public static final String DOT_WSDL = ".wsdl";
+ public static final String RESPONSE = "Response";
+ public static final String PARAMETERS = "parameters";
+ public static final String RESULT = "parameters";
+ public static final String UNWRAPPABLE_RESULT = "result";
+ public static final String WSDL_NAMESPACE = WSDLConstants.NS_WSDL;
+ public static final String WSDL_PREFIX = "wsdl";
+ public static final String XSD_NAMESPACE = SOAPNamespaceConstants.XSD;
+ public static final String XSD_PREFIX = "xsd";
+ public static final String SOAP11_NAMESPACE = SOAPConstants.NS_WSDL_SOAP;
+ public static final String SOAP12_NAMESPACE = SOAPConstants.NS_WSDL_SOAP12;
+ public static final String SOAP_PREFIX = "soap";
+ public static final String SOAP12_PREFIX = "soap12";
+ public static final String TNS_PREFIX = "tns";
+ public static final String BINDING = "Binding";
+ public static final String SOAP_HTTP_TRANSPORT =
SOAPNamespaceConstants.TRANSPORT_HTTP;
+ public static final String SOAP12_HTTP_TRANSPORT =
SOAP12NamespaceConstants.TRANSPORT_HTTP;
+ public static final String DOCUMENT = "document";
+ public static final String RPC = "rpc";
+ public static final String LITERAL = "literal";
+ public static final String REPLACE_WITH_ACTUAL_URL =
"REPLACE_WITH_ACTUAL_URL";
+ private Set<QName> processedExceptions = new HashSet<QName>();
+ private String bindingId;
+ private String wsdlLocation;
+ private String portWSDLID;
+ private String schemaPrefix;
+
+
+ public WSDLGenerator(RuntimeModel model, WSDLOutputResolver wsdlResolver, String
bindingId) {
+ this.model = model;
+ resolver = new JAXWSOutputSchemaResolver();
+ this.wsdlResolver = wsdlResolver;
+ this.bindingId = bindingId;
+ }
+
+ public void doGeneration() {
+ XmlSerializer serviceWriter;
+ XmlSerializer portWriter = null;
+ String fileName =
JAXBRIContext.mangleNameToClassName(model.getServiceQName().getLocalPart());
+// System.out.println("concrete name: "+ fileName);
+ Result result = wsdlResolver.getWSDLOutput(fileName+DOT_WSDL);
+ if (result == null)
+ return;
+ wsdlLocation = result.getSystemId();
+ serviceWriter = ResultFactory.createSerializer(result);
+ if (model.getServiceQName().getNamespaceURI().equals(model.getTargetNamespace()))
{
+ portWriter = serviceWriter;
+ schemaPrefix = fileName+"_";
+ } else {
+ String wsdlName =
JAXBRIContext.mangleNameToClassName(model.getPortTypeName().getLocalPart());
+ if (wsdlName.equals(fileName))
+ wsdlName += "PortType";
+// System.out.println("abstract name: "+ wsdlName);
+ Holder<String> absWSDLName = new Holder<String>();
+ absWSDLName.value = wsdlName+DOT_WSDL;
+// System.out.println("absWSDLName.value: "+ absWSDLName.value);
+ result = wsdlResolver.getAbstractWSDLOutput(absWSDLName);
+// System.out.println("absWSDLName.value: "+ absWSDLName.value);
+// schemaPrefix =
model.getJAXBContext().mangleNameToClassName(portWSDLID)+"_";
+
+ if (result != null) {
+ portWSDLID = result.getSystemId();
+ if (portWSDLID.equals(wsdlLocation)) {
+ portWriter = serviceWriter;
+ } else {
+ portWriter = ResultFactory.createSerializer(result);
+ }
+ } else {
+ portWSDLID = absWSDLName.value;
+ }
+ schemaPrefix = new java.io.File(portWSDLID).getName();
+ int idx = schemaPrefix.lastIndexOf('.');
+ if (idx > 0)
+ schemaPrefix = schemaPrefix.substring(0, idx);
+ schemaPrefix =
JAXBRIContext.mangleNameToClassName(schemaPrefix)+"_";
+// System.out.println("portWSDLID: "+ portWSDLID);
+// schemaPrefix =
model.getJAXBContext().mangleNameToClassName(portWSDLID)+"_";
+// System.out.println("schemaPrefix: "+ schemaPrefix);
+ }
+ generateDocument(serviceWriter, portWriter);
+ }
+
+ private void generateDocument(XmlSerializer serviceStream, XmlSerializer portStream)
{
+ serviceDefinitions = TXW.create(Definitions.class, serviceStream);
+ serviceDefinitions._namespace(WSDL_NAMESPACE, "");//WSDL_PREFIX);
+ serviceDefinitions._namespace(XSD_NAMESPACE, XSD_PREFIX);
+ serviceDefinitions.targetNamespace(model.getServiceQName().getNamespaceURI());
+ serviceDefinitions._namespace(model.getServiceQName().getNamespaceURI(),
TNS_PREFIX);
+ if(bindingId.equals(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING))
+ serviceDefinitions._namespace(SOAP12_NAMESPACE, SOAP12_PREFIX);
+ else
+ serviceDefinitions._namespace(SOAP11_NAMESPACE, SOAP_PREFIX);
+ serviceDefinitions.name(model.getServiceQName().getLocalPart());
+ if (serviceStream != portStream && portStream != null) {
+ // generate an abstract and concrete wsdl
+ portDefinitions = TXW.create(Definitions.class, portStream);
+ portDefinitions._namespace(WSDL_NAMESPACE, "");//WSDL_PREFIX);
+ portDefinitions._namespace(XSD_NAMESPACE, XSD_PREFIX);
+ if (model.getTargetNamespace() != null) {
+ portDefinitions.targetNamespace(model.getTargetNamespace());
+ portDefinitions._namespace(model.getTargetNamespace(), TNS_PREFIX);
+ }
+
+ String schemaLoc = relativize(portWSDLID, wsdlLocation);
+ Import _import =
serviceDefinitions._import().namespace(model.getTargetNamespace());
+ _import.location(schemaLoc);
+ } else if (portStream != null) {
+ // abstract and concrete are the same
+ portDefinitions = serviceDefinitions;
+ } else {
+ // import a provided abstract wsdl
+ String schemaLoc = relativize(portWSDLID, wsdlLocation);
+ Import _import =
serviceDefinitions._import().namespace(model.getTargetNamespace());
+ _import.location(schemaLoc);
+ }
+
+ if (portDefinitions != null) {
+ generateTypes();
+ generateMessages();
+ generatePortType();
+ }
+ generateBinding();
+ generateService();
+ serviceDefinitions.commit();
+ if (portDefinitions != null && portDefinitions != serviceDefinitions)
+ portDefinitions.commit();
+ }
+
+
+
+ protected void generateTypes() {
+ types = portDefinitions.types();
+ if (model.getJAXBContext() != null) {
+ try {
+ model.getJAXBContext().generateSchema(resolver);
+ } catch (IOException e) {
+ // TODO locallize and wrap this
+ e.printStackTrace();
+ throw new WebServiceException(e.getMessage());
+ }
+ }
+ }
+
+ protected void generateMessages() {
+ for (JavaMethod method : model.getJavaMethods()) {
+ if (method.getBinding() instanceof SOAPBinding)
+ generateSOAPMessages(method, (SOAPBinding)method.getBinding());
+ }
+ }
+
+ protected void generateSOAPMessages(JavaMethod method, SOAPBinding binding) {
+ boolean isDoclit = binding.isDocLit();
+ Message message = portDefinitions.message().name(method.getOperationName());
+ org.jboss.com.sun.xml.ws.wsdl.writer.document.Part part;
+ JAXBRIContext jaxbContext = model.getJAXBContext();
+ boolean unwrappable = true;
+ for (Parameter param : method.getRequestParameters()) {
+ if (isDoclit) {
+ if (isHeaderParameter(param))
+ unwrappable = false;
+ if (param.isWrapperStyle()) {
+ part = message.part().name(PARAMETERS);
+ part.element(param.getName());
+ } else {
+ part = message.part().name(param.getPartName());
+ part.element(param.getName());
+ }
+ } else {
+ if (param.isWrapperStyle()) {
+ for (Parameter childParam :
((WrapperParameter)param).getWrapperChildren()) {
+ part = message.part().name(childParam.getPartName());
+
part.type(jaxbContext.getTypeName(childParam.getTypeReference()));
+ }
+ } else {
+ part = message.part().name(param.getPartName());
+ part.element(param.getName());
+ }
+ }
+ }
+ if (method.getMEP() != MessageStruct.ONE_WAY_MEP) {
+ message =
portDefinitions.message().name(method.getOperationName()+RESPONSE);
+ if (unwrappable) {
+ for (Parameter param : method.getResponseParameters()) {
+ if (isHeaderParameter(param))
+ unwrappable = false;
+ }
+ }
+
+ for (Parameter param : method.getResponseParameters()) {
+ if (isDoclit) {
+ if (param.isWrapperStyle()) {
+ // if its not really wrapper style dont use the same name as
input message
+ if (unwrappable)
+ part = message.part().name(RESULT);
+ else
+ part = message.part().name(UNWRAPPABLE_RESULT);
+ part.element(param.getName());
+ } else {
+ part = message.part().name(param.getPartName());
+ part.element(param.getName());
+ }
+ } else {
+ if (param.isWrapperStyle()) {
+ for (Parameter childParam :
((WrapperParameter)param).getWrapperChildren()) {
+ part = message.part().name(childParam.getPartName());
+
part.type(jaxbContext.getTypeName(childParam.getTypeReference()));
+ }
+ } else {
+ part = message.part().name(param.getPartName());
+ part.element(param.getName());
+ }
+ }
+ }
+ }
+ for (CheckedException exception : method.getCheckedExceptions()) {
+ QName tagName = exception.getDetailType().tagName;
+// if (processedExceptions.contains(tagName))
+// continue;
+// message = portDefinitions.message().name(tagName.getLocalPart());
+ String messageName = exception.getMessageName();
+ QName messageQName = new QName(model.getTargetNamespace(), messageName);
+ if (processedExceptions.contains(messageQName))
+ continue;
+ message = portDefinitions.message().name(messageName);
+
+ part = message.part().name("fault");//tagName.getLocalPart());
+ part.element(tagName);
+// processedExceptions.add(tagName);
+ processedExceptions.add(messageQName);
+ }
+ }
+
+ protected void generatePortType() {
+
+ PortType portType =
portDefinitions.portType().name(model.getPortTypeName().getLocalPart());
+ for (JavaMethod method : model.getJavaMethods()) {
+ Operation operation = portType.operation().name(method.getOperationName());
+ generateParameterOrder(operation, method);
+ switch (method.getMEP()) {
+ case MessageStruct.REQUEST_RESPONSE_MEP:
+ // input message
+ generateInputMessage(operation, method);
+ // output message
+ generateOutputMessage(operation, method);
+ break;
+ case MessageStruct.ONE_WAY_MEP:
+ generateInputMessage(operation, method);
+ break;
+ }
+ // faults
+ for (CheckedException exception : method.getCheckedExceptions()) {
+ QName tagName = exception.getDetailType().tagName;
+// QName messageName = new QName(model.getTargetNamespace(),
tagName.getLocalPart());
+// FaultType paramType =
operation.fault().name(tagName.getLocalPart()).message(messageName);
+ QName messageName = new QName(model.getTargetNamespace(),
exception.getMessageName());
+ FaultType paramType =
operation.fault().name(exception.getMessageName()).message(messageName);
+ }
+ }
+ }
+
+ protected boolean isWrapperStyle(JavaMethod method) {
+ if (method.getRequestParameters().size() > 0) {
+ Parameter param = method.getRequestParameters().iterator().next();
+ return param.isWrapperStyle();
+ }
+ return false;
+ }
+
+ protected boolean isRpcLit(JavaMethod method) {
+ if (method.getBinding() instanceof SOAPBinding) {
+ if (((SOAPBinding)method.getBinding()).getStyle().equals(Style.RPC))
+ return true;
+ }
+ return false;
+ }
+
+ protected void generateParameterOrder(Operation operation, JavaMethod method) {
+ if (method.getMEP() == MessageStruct.ONE_WAY_MEP)
+ return;
+ if (isRpcLit(method))
+ generateRpcParameterOrder(operation, method);
+ else
+ generateDocumentParameterOrder(operation, method);
+ }
+
+ protected void generateRpcParameterOrder(Operation operation, JavaMethod method) {
+ String partName;
+ StringBuffer paramOrder = new StringBuffer();
+ Set<String> partNames = new HashSet<String>();
+ List<Parameter> sortedParams = sortMethodParameters(method);
+ int i = 0;
+ for (Parameter parameter : sortedParams) {
+ if (parameter.getIndex() >= 0) {
+ partName = parameter.getPartName();
+ if (!partNames.contains(partName)) {
+ if (i++ > 0)
+ paramOrder.append(' ');
+ paramOrder.append(partName);
+ partNames.add(partName);
+ }
+ }
+ }
+ operation.parameterOrder(paramOrder.toString());
+ }
+
+
+ protected void generateDocumentParameterOrder(Operation operation, JavaMethod method)
{
+ String partName;
+ StringBuffer paramOrder = new StringBuffer();
+ Set<String> partNames = new HashSet<String>();
+ List<Parameter> sortedParams = sortMethodParameters(method);
+ boolean isWrapperStyle = isWrapperStyle(method);
+ int i = 0;
+ for (Parameter parameter : sortedParams) {
+// System.out.println("param: "+parameter.getIndex()+" name:
"+parameter.getName().getLocalPart());
+ if (parameter.getIndex() < 0)
+ continue;
+ if (isWrapperStyle && isBodyParameter(parameter)) {
+// System.out.println("isWrapper and is body");
+ if (method.getRequestParameters().contains(parameter))
+ partName = PARAMETERS;
+ else {
+ // really make sure this is a wrapper style wsdl we are creating
+ partName = RESPONSE;
+ }
+ } else {
+ partName = parameter.getPartName();
+ }
+ if (!partNames.contains(partName)) {
+ if (i++ > 0)
+ paramOrder.append(' ');
+ paramOrder.append(partName);
+ partNames.add(partName);
+ }
+ }
+ if (i>1) {
+ operation.parameterOrder(paramOrder.toString());
+ }
+ }
+
+ protected List<Parameter> sortMethodParameters(JavaMethod method) {
+ Set<Parameter> paramSet = new HashSet<Parameter>();
+ List<Parameter> sortedParams = new ArrayList<Parameter>();
+ if (isRpcLit(method)) {
+ for (Parameter param : method.getRequestParameters()) {
+ if (param instanceof WrapperParameter) {
+ paramSet.addAll(((WrapperParameter)param).getWrapperChildren());
+ } else {
+ paramSet.add(param);
+ }
+ }
+ for (Parameter param : method.getResponseParameters()) {
+ if (param instanceof WrapperParameter) {
+ paramSet.addAll(((WrapperParameter)param).getWrapperChildren());
+ } else {
+ paramSet.add(param);
+ }
+ }
+ } else {
+ paramSet.addAll(method.getRequestParameters());
+ paramSet.addAll(method.getResponseParameters());
+ }
+ Iterator<Parameter>params = paramSet.iterator();
+ if (paramSet.size() == 0)
+ return sortedParams;
+ Parameter param = params.next();
+ sortedParams.add(param);
+ Parameter sortedParam;
+ int pos;
+ for (int i=1; i<paramSet.size();i++) {
+ param = params.next();
+ for (pos=0; pos<i; pos++) {
+ sortedParam = sortedParams.get(pos);
+ if (param.getIndex() == sortedParam.getIndex() &&
+ param instanceof WrapperParameter)
+ break;
+ if (param.getIndex() < sortedParam.getIndex()) {
+ break;
+ }
+ }
+ sortedParams.add(pos, param);
+ }
+ return sortedParams;
+ }
+
+ protected boolean isBodyParameter(Parameter parameter) {
+ ParameterBinding paramBinding = parameter.getBinding();
+ return paramBinding.isBody();
+ }
+
+ protected boolean isHeaderParameter(Parameter parameter) {
+ ParameterBinding paramBinding = parameter.getBinding();
+ return paramBinding.isHeader();
+ }
+
+ protected boolean isAttachmentParameter(Parameter parameter) {
+ ParameterBinding paramBinding = parameter.getBinding();
+ return paramBinding.isAttachment();
+ }
+
+
+ protected void generateBinding() {
+ Binding binding =
serviceDefinitions.binding().name(model.getPortName().getLocalPart()+BINDING);
+ binding.type(model.getPortTypeName());
+ boolean first = true;
+ for (JavaMethod method : model.getJavaMethods()) {
+ if (first) {
+ if (method.getBinding() instanceof SOAPBinding) {
+ SOAPBinding sBinding = (SOAPBinding)method.getBinding();
+ SOAPVersion soapVersion = sBinding.getSOAPVersion();
+
+
if(soapVersion.equals(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING)){
+ org.jboss.com.sun.xml.ws.wsdl.writer.document.soap12.SOAPBinding
soapBinding = binding.soap12Binding();
+ soapBinding.transport(SOAP12_HTTP_TRANSPORT);
+ if (sBinding.getStyle().equals(Style.DOCUMENT))
+ soapBinding.style(DOCUMENT);
+ else
+ soapBinding.style(RPC);
+ }else{
+ org.jboss.com.sun.xml.ws.wsdl.writer.document.soap.SOAPBinding
soapBinding = binding.soapBinding();
+ soapBinding.transport(SOAP_HTTP_TRANSPORT);
+ if (sBinding.getStyle().equals(Style.DOCUMENT))
+ soapBinding.style(DOCUMENT);
+ else
+ soapBinding.style(RPC);
+ }
+ }
+ first = false;
+ }
+ if(bindingId.equals(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING))
+ generateSOAP12BindingOperation(method, binding);
+ else
+ generateBindingOperation(method, binding);
+ }
+ }
+
+ protected void generateBindingOperation(JavaMethod method, Binding binding) {
+ BindingOperationType operation =
binding.operation().name(method.getOperationName());
+ String targetNamespace = model.getTargetNamespace();
+ QName requestMessage = new QName(targetNamespace, method.getOperationName());
+ QName responseMessage = new QName(targetNamespace,
method.getOperationName()+RESPONSE);
+ if (method.getBinding() instanceof SOAPBinding) {
+ List<Parameter> bodyParams = new ArrayList<Parameter>();
+ List<Parameter> headerParams = new ArrayList<Parameter>();
+ splitParameters(bodyParams, headerParams, method.getRequestParameters());
+ SOAPBinding soapBinding = (SOAPBinding)method.getBinding();
+ operation.soapOperation().soapAction(soapBinding.getSOAPAction());
+
+ // input
+ TypedXmlWriter input = operation.input();
+ BodyType body = input._element(Body.class);
+ boolean isRpc = soapBinding.getStyle().equals(Style.RPC);
+ if (soapBinding.getUse().equals(Use.LITERAL)) {
+ body.use(LITERAL);
+ if (headerParams.size() > 0) {
+ if (bodyParams.size() > 0) {
+ Parameter param = bodyParams.iterator().next();
+ if (isRpc) {
+ StringBuffer parts = new StringBuffer();
+ int i=0;
+ for (Parameter parameter :
((WrapperParameter)param).getWrapperChildren()) {
+ if (i++>0)
+ parts.append(' ');
+ parts.append(parameter.getPartName());
+ }
+ body.parts(parts.toString());
+ } else if (param.isWrapperStyle()) {
+ body.parts(PARAMETERS);
+ } else {
+ body.parts(param.getPartName());
+ }
+ } else {
+ body.parts("");
+ }
+ generateSOAPHeaders(input, headerParams, requestMessage);
+ }
+ if (isRpc) {
+
body.namespace(method.getRequestParameters().iterator().next().getName().getNamespaceURI());
+ }
+ } else {
+ // TODO localize this
+ throw new WebServiceException("encoded use is not supported");
+ }
+
+ if (method.getMEP() != MessageStruct.ONE_WAY_MEP) {
+ boolean unwrappable = headerParams.size() == 0;
+ // output
+ bodyParams.clear();
+ headerParams.clear();
+ splitParameters(bodyParams, headerParams,
method.getResponseParameters());
+ unwrappable = unwrappable ? headerParams.size() == 0 : unwrappable;
+ TypedXmlWriter output = operation.output();
+ body = output._element(Body.class);
+ body.use(LITERAL);
+ if (headerParams.size() > 0) {
+ String parts = "";
+ if (bodyParams.size() > 0) {
+ Parameter param = bodyParams.iterator().next();
+ if (isRpc) {
+ int i=0;
+ for (Parameter parameter :
((WrapperParameter)param).getWrapperChildren()) {
+ if (i++>0)
+ parts += " ";
+ parts += parameter.getPartName();
+ }
+ } else {
+ if (param != null) {
+ if (param.isWrapperStyle()) {
+ // if its not really wrapper style dont use the same
name as input message
+ if (unwrappable)
+ parts = RESULT;
+ else
+ parts = UNWRAPPABLE_RESULT;
+ } else {
+ parts = param.getPartName();
+ }
+ }
+ }
+ }
+ body.parts(parts);
+ generateSOAPHeaders(output, headerParams, responseMessage);
+ }
+ if (isRpc) {
+
body.namespace(method.getRequestParameters().iterator().next().getName().getNamespaceURI());
+ }
+ }
+ for (CheckedException exception : method.getCheckedExceptions()) {
+// QName tagName = exception.getDetailType().tagName;
+// Fault fault = operation.fault().name(tagName.getLocalPart());
+// SOAPFault soapFault =
fault._element(SOAPFault.class).name(tagName.getLocalPart());
+ Fault fault = operation.fault().name(exception.getMessageName());
+ SOAPFault soapFault =
fault._element(SOAPFault.class).name(exception.getMessageName());
+ soapFault.use(LITERAL);
+ }
+ }
+ }
+
+ protected void generateSOAP12BindingOperation(JavaMethod method, Binding binding) {
+ BindingOperationType operation =
binding.operation().name(method.getOperationName());
+ String targetNamespace = model.getTargetNamespace();
+ QName requestMessage = new QName(targetNamespace, method.getOperationName());
+ QName responseMessage = new QName(targetNamespace,
method.getOperationName()+RESPONSE);
+ if (method.getBinding() instanceof SOAPBinding) {
+ List<Parameter> bodyParams = new ArrayList<Parameter>();
+ List<Parameter> headerParams = new ArrayList<Parameter>();
+ splitParameters(bodyParams, headerParams, method.getRequestParameters());
+ SOAPBinding soapBinding = (SOAPBinding)method.getBinding();
+ operation.soap12Operation().soapAction(soapBinding.getSOAPAction());
+
+ // input
+ TypedXmlWriter input = operation.input();
+
+ org.jboss.com.sun.xml.ws.wsdl.writer.document.soap12.BodyType body =
input._element(org.jboss.com.sun.xml.ws.wsdl.writer.document.soap12.Body.class);
+ boolean isRpc = soapBinding.getStyle().equals(Style.RPC);
+ if (soapBinding.getUse().equals(Use.LITERAL)) {
+ body.use(LITERAL);
+ if (headerParams.size() > 0) {
+ if (bodyParams.size() > 0) {
+ Parameter param = bodyParams.iterator().next();
+ if (isRpc) {
+ StringBuffer parts = new StringBuffer();
+ int i=0;
+ for (Parameter parameter :
((WrapperParameter)param).getWrapperChildren()) {
+ if (i++>0)
+ parts.append(' ');
+ parts.append(parameter.getPartName());
+ }
+ body.parts(parts.toString());
+ } else if (param.isWrapperStyle()) {
+ body.parts(PARAMETERS);
+ } else {
+ body.parts(param.getPartName());
+ }
+ } else {
+ body.parts("");
+ }
+ generateSOAP12Headers(input, headerParams, requestMessage);
+ }
+ if (isRpc) {
+
body.namespace(method.getRequestParameters().iterator().next().getName().getNamespaceURI());
+ }
+ } else {
+ // TODO localize this
+ throw new WebServiceException("encoded use is not supported");
+ }
+
+ if (method.getMEP() != MessageStruct.ONE_WAY_MEP) {
+ // output
+ boolean unwrappable = headerParams.size() == 0;
+ bodyParams.clear();
+ headerParams.clear();
+ splitParameters(bodyParams, headerParams,
method.getResponseParameters());
+ unwrappable = unwrappable ? headerParams.size() == 0 : unwrappable;
+ TypedXmlWriter output = operation.output();
+ body =
output._element(org.jboss.com.sun.xml.ws.wsdl.writer.document.soap12.Body.class);
+ body.use(LITERAL);
+ if (headerParams.size() > 0) {
+ if (bodyParams.size() > 0) {
+ Parameter param = bodyParams.iterator().next();
+ if (isRpc) {
+ String parts = "";
+ int i=0;
+ for (Parameter parameter :
((WrapperParameter)param).getWrapperChildren()) {
+ if (i++>0)
+ parts += " ";
+ parts += parameter.getPartName();
+ }
+ body.parts(parts);
+ } else if (param.isWrapperStyle()) {
+ // if its not really wrapper style dont use the same name as
input message
+ if (unwrappable)
+ body.parts(RESULT);
+ else
+ body.parts(UNWRAPPABLE_RESULT);
+ } else {
+ body.parts(param.getPartName());
+ }
+ } else {
+ body.parts("");
+ }
+ generateSOAP12Headers(output, headerParams, responseMessage);
+ }
+ if (isRpc) {
+
body.namespace(method.getRequestParameters().iterator().next().getName().getNamespaceURI());
+ }
+ }
+ for (CheckedException exception : method.getCheckedExceptions()) {
+// QName tagName = exception.getDetailType().tagName;
+// Fault fault = operation.fault().name(tagName.getLocalPart());
+// org.jboss.com.sun.xml.ws.wsdl.writer.document.soap12.SOAPFault
soapFault =
fault._element(org.jboss.com.sun.xml.ws.wsdl.writer.document.soap12.SOAPFault.class).name(tagName.getLocalPart());
+ Fault fault = operation.fault().name(exception.getMessageName());
+ org.jboss.com.sun.xml.ws.wsdl.writer.document.soap12.SOAPFault soapFault
=
fault._element(org.jboss.com.sun.xml.ws.wsdl.writer.document.soap12.SOAPFault.class).name(exception.getMessageName());
+ soapFault.use(LITERAL);
+ }
+ }
+ }
+
+ protected void splitParameters(List<Parameter> bodyParams,
List<Parameter>headerParams, List<Parameter>params) {
+ for (Parameter parameter : params) {
+ if (isBodyParameter(parameter)) {
+ bodyParams.add(parameter);
+ } else {
+ headerParams.add(parameter);
+ }
+ }
+ }
+
+ protected void generateSOAPHeaders(TypedXmlWriter writer, List<Parameter>
parameters, QName message) {
+
+ for (Parameter headerParam : parameters) {
+ Header header = writer._element(Header.class);
+ header.message(message);
+ header.part(headerParam.getPartName());
+ header.use(LITERAL);
+ }
+ }
+
+ protected void generateSOAP12Headers(TypedXmlWriter writer, List<Parameter>
parameters, QName message) {
+
+ for (Parameter headerParam : parameters) {
+ org.jboss.com.sun.xml.ws.wsdl.writer.document.soap12.Header header =
writer._element(org.jboss.com.sun.xml.ws.wsdl.writer.document.soap12.Header.class);
+ header.message(message);
+
+
+ header.part(headerParam.getPartName());
+ header.use(LITERAL);
+ }
+ }
+
+ protected void generateService() {
+ QName portQName = model.getPortName();
+ QName serviceQName = model.getServiceQName();
+ Service service =
serviceDefinitions.service().name(serviceQName.getLocalPart());
+ Port port = service.port().name(portQName.getLocalPart());
+ port.binding(new QName(serviceQName.getNamespaceURI(),
portQName.getLocalPart()+BINDING));
+ if (model.getJavaMethods().size() == 0)
+ return;
+ if (model.getJavaMethods().iterator().next().getBinding() instanceof SOAPBinding)
{
+ if(bindingId.equals(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING)){
+ org.jboss.com.sun.xml.ws.wsdl.writer.document.soap12.SOAPAddress address
= port._element(org.jboss.com.sun.xml.ws.wsdl.writer.document.soap12.SOAPAddress.class);
+ address.location(REPLACE_WITH_ACTUAL_URL);
+ }else{
+ SOAPAddress address = port._element(SOAPAddress.class);
+ address.location(REPLACE_WITH_ACTUAL_URL);
+ }
+ }
+ }
+
+ protected void generateInputMessage(Operation operation, JavaMethod method) {
+ ParamType paramType = operation.input();
+ paramType.message(new QName(model.getTargetNamespace(),
method.getOperationName()));
+ }
+
+ protected void generateOutputMessage(Operation operation, JavaMethod method) {
+ ParamType paramType = operation.output();
+ paramType.message(new QName(model.getTargetNamespace(),
method.getOperationName()+RESPONSE));
+ }
+
+ public Result createOutputFile(String namespaceUri, String suggestedFileName) throws
IOException {
+ Result result;
+ if (namespaceUri.equals("")) {
+ return null;
+ }
+ org.jboss.com.sun.xml.ws.wsdl.writer.document.xsd.Import _import =
types.schema()._import().namespace(namespaceUri);
+
+ Holder<String> fileNameHolder = new Holder<String>();
+ fileNameHolder.value = schemaPrefix+suggestedFileName;
+ result = wsdlResolver.getSchemaOutput(namespaceUri, fileNameHolder);
+// System.out.println("schema file: "+fileNameHolder.value);
+// System.out.println("result: "+result);
+ String schemaLoc;
+ if (result == null)
+ schemaLoc = fileNameHolder.value;
+ else
+ schemaLoc = relativize(result.getSystemId(), wsdlLocation);
+// System.out.println("schemaLoca: "+schemaLoc);
+ _import.schemaLocation(schemaLoc);
+ return result;
+ }
+
+ /**
+ * Relativizes a URI by using another URI (base URI.)
+ *
+ * <p>
+ * For example, {@code
relative("http://www.sun.com/abc/def","http://www.sun.com/...
=> "../abc/def"}
+ *
+ * <p>
+ * This method only works on hierarchical URI's, not opaque URI's (refer to
the
+ * <a
href="http://java.sun.com/j2se/1.5.0/docs/api/java/net/URI.html"...
+ * javadoc for complete definitions of these terms.
+ *
+ * <p>
+ * This method will not normalize the relative URI.
+ *
+ * @return the relative URI or the original URI if a relative one could not be
computed
+ */
+ protected static String relativize(String uri, String baseUri) {
+ try {
+ assert uri!=null;
+
+ if(baseUri==null) return uri;
+
+ URI theUri = new URI(escapeURI(uri));
+ URI theBaseUri = new URI(escapeURI(baseUri));
+
+ if (theUri.isOpaque() || theBaseUri.isOpaque())
+ return uri;
+
+ if (!equalsIgnoreCase(theUri.getScheme(), theBaseUri.getScheme()) ||
+ !equal(theUri.getAuthority(), theBaseUri.getAuthority()))
+ return uri;
+
+ String uriPath = theUri.getPath();
+ String basePath = theBaseUri.getPath();
+
+ // normalize base path
+ if (!basePath.endsWith("/")) {
+ basePath = normalizeUriPath(basePath);
+ }
+
+ if( uriPath.equals(basePath))
+ return ".";
+
+ String relPath = calculateRelativePath(uriPath, basePath);
+
+ if (relPath == null)
+ return uri; // recursion found no commonality in the two uris at all
+ StringBuffer relUri = new StringBuffer();
+ relUri.append(relPath);
+ if (theUri.getQuery() != null)
+ relUri.append('?').append(theUri.getQuery());
+ if (theUri.getFragment() != null)
+ relUri.append('#').append(theUri.getFragment());
+
+ return relUri.toString();
+ } catch (URISyntaxException e) {
+ throw new InternalError("Error escaping one of these
uris:\n\t"+uri+"\n\t"+baseUri);
+ }
+ }
+
+ private static String calculateRelativePath(String uri, String base) {
+ if (base == null) {
+ return null;
+ }
+ if (uri.startsWith(base)) {
+ return uri.substring(base.length());
+ } else {
+ return "../" + calculateRelativePath(uri, getParentUriPath(base));
+ }
+ }
+
+
+ protected class JAXWSOutputSchemaResolver extends SchemaOutputResolver {
+ public Result createOutput(String namespaceUri, String suggestedFileName) throws
IOException {
+ return createOutputFile(namespaceUri, suggestedFileName);
+ }
+ }
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/WSDLGenerator.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/WSDLOutputResolver.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/WSDLOutputResolver.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/WSDLOutputResolver.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,51 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.writer;
+
+import javax.xml.transform.Result;
+import javax.xml.ws.Holder;
+
+
+/**
+ *
+ * @author WS Development Team
+ */
+public interface WSDLOutputResolver {
+ public Result getWSDLOutput(String suggestedFilename);
+
+ /*
+ * Updates filename if the suggested filename need to be changed in
+ * wsdl:import
+ *
+ * return null if abstract WSDL need not be generated
+ */
+ public Result getAbstractWSDLOutput(Holder<String> filename);
+
+ /*
+ * Updates filename if the suggested filename need to be changed in
+ * xsd:import
+ *
+ * return null if schema need not be generated
+ */
+ public Result getSchemaOutput(String namespace, Holder<String> filename);
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/WSDLOutputResolver.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Binding.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Binding.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Binding.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,57 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.writer.document;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.soap.SOAPBinding;
+
+import com.sun.xml.txw2.TypedXmlWriter;
+import com.sun.xml.txw2.annotation.XmlAttribute;
+import com.sun.xml.txw2.annotation.XmlElement;
+
+/**
+ *
+ * @author WS Development Team
+ */
+@XmlElement("binding")
+public interface Binding
+ extends TypedXmlWriter, StartWithExtensionsType
+{
+
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.Binding type(QName value);
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.Binding name(String value);
+
+ @XmlElement
+ public BindingOperationType operation();
+
+
@XmlElement(value="binding",ns="http://schemas.xmlsoap.org/wsdl/soap/")
+ public SOAPBinding soapBinding();
+
+
@XmlElement(value="binding",ns="http://schemas.xmlsoap.org/wsdl/soap12/")
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.soap12.SOAPBinding
soap12Binding();
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Binding.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/BindingOperationType.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/BindingOperationType.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/BindingOperationType.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,59 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.writer.document;
+
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.Fault;
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.StartWithExtensionsType;
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.soap.SOAPOperation;
+
+import com.sun.xml.txw2.TypedXmlWriter;
+import com.sun.xml.txw2.annotation.XmlAttribute;
+import com.sun.xml.txw2.annotation.XmlElement;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public interface BindingOperationType
+ extends TypedXmlWriter, StartWithExtensionsType
+{
+
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.BindingOperationType name(String
value);
+
+
@XmlElement(value="operation",ns="http://schemas.xmlsoap.org/wsdl/soap/")
+ public SOAPOperation soapOperation();
+
+
@XmlElement(value="operation",ns="http://schemas.xmlsoap.org/wsdl/soap12/")
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.soap12.SOAPOperation
soap12Operation();
+
+ @XmlElement
+ public Fault fault();
+
+ @XmlElement
+ public StartWithExtensionsType output();
+
+ @XmlElement
+ public StartWithExtensionsType input();
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/BindingOperationType.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Definitions.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Definitions.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Definitions.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,62 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.writer.document;
+
+import com.sun.xml.txw2.TypedXmlWriter;
+import com.sun.xml.txw2.annotation.XmlAttribute;
+import com.sun.xml.txw2.annotation.XmlElement;
+
+/**
+ *
+ * @author WS Development Team
+ */
+@XmlElement("definitions")
+public interface Definitions
+ extends TypedXmlWriter, Documented
+{
+
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.Definitions name(String value);
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.Definitions
targetNamespace(String value);
+
+ @XmlElement
+ public Service service();
+
+ @XmlElement
+ public Binding binding();
+
+ @XmlElement
+ public PortType portType();
+
+ @XmlElement
+ public Message message();
+
+ @XmlElement
+ public Types types();
+
+ @XmlElement("import")
+ public Import _import();
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Definitions.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Documented.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Documented.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Documented.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,39 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.writer.document;
+
+import com.sun.xml.txw2.TypedXmlWriter;
+import com.sun.xml.txw2.annotation.XmlElement;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public interface Documented
+ extends TypedXmlWriter
+{
+
+
+ @XmlElement
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.Documented documentation(String
value);
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Documented.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Fault.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Fault.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Fault.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,43 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.writer.document;
+
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.StartWithExtensionsType;
+
+import com.sun.xml.txw2.TypedXmlWriter;
+import com.sun.xml.txw2.annotation.XmlAttribute;
+import com.sun.xml.txw2.annotation.XmlElement;
+
+/**
+ *
+ * @author WS Development Team
+ */
+@XmlElement("fault")
+public interface Fault
+ extends TypedXmlWriter, StartWithExtensionsType
+{
+
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.Fault name(String value);
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Fault.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/FaultType.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/FaultType.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/FaultType.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,42 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.writer.document;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.Documented;
+
+import com.sun.xml.txw2.TypedXmlWriter;
+import com.sun.xml.txw2.annotation.XmlAttribute;
+
+public interface FaultType
+ extends TypedXmlWriter, Documented
+{
+
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.FaultType message(QName value);
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.FaultType name(String value);
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/FaultType.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Import.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Import.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Import.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,46 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.writer.document;
+
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.Documented;
+
+import com.sun.xml.txw2.TypedXmlWriter;
+import com.sun.xml.txw2.annotation.XmlAttribute;
+import com.sun.xml.txw2.annotation.XmlElement;
+
+/**
+ *
+ * @author WS Development Team
+ */
+@XmlElement("import")
+public interface Import
+ extends TypedXmlWriter, Documented
+{
+
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.Import location(String value);
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.Import namespace(String value);
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Import.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Message.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Message.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Message.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,44 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.writer.document;
+
+import com.sun.xml.txw2.TypedXmlWriter;
+import com.sun.xml.txw2.annotation.XmlAttribute;
+import com.sun.xml.txw2.annotation.XmlElement;
+
+/**
+ *
+ * @author WS Development Team
+ */
+@XmlElement("message")
+public interface Message
+ extends TypedXmlWriter, Documented
+{
+
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.Message name(String value);
+
+ @XmlElement
+ public Part part();
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Message.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/OpenAtts.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/OpenAtts.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/OpenAtts.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,33 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.writer.document;
+
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.Documented;
+
+import com.sun.xml.txw2.TypedXmlWriter;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public interface OpenAtts extends TypedXmlWriter, Documented {
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/OpenAtts.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Operation.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Operation.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Operation.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,66 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.writer.document;
+
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.Documented;
+
+import com.sun.xml.txw2.TypedXmlWriter;
+import com.sun.xml.txw2.annotation.XmlAttribute;
+import com.sun.xml.txw2.annotation.XmlElement;
+
+/**
+ *
+ * @author WS Development Team
+ */
+@XmlElement("operation")
+public interface Operation
+ extends TypedXmlWriter, Documented
+{
+
+/*
+ @XmlElement("notification-operation")
+ public NotificationOperation notificationOperation();
+
+ @XmlElement("solicit-response-operation")
+ public SolicitResponseOperation solicitResponseOperation();
+
+ @XmlElement("request-response-operation")
+ public RequestResponseOperation requestResponseOperation();
+
+ @XmlElement("one-way-operation")
+ public OneWayOperation oneWayOperation();
+*/
+ @XmlElement
+ public ParamType input();
+
+ @XmlElement
+ public ParamType output();
+
+ @XmlElement
+ public FaultType fault();
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.Operation name(String value);
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.Operation parameterOrder(String
value);
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Operation.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/ParamType.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/ParamType.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/ParamType.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,46 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.writer.document;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.Documented;
+
+import com.sun.xml.txw2.TypedXmlWriter;
+import com.sun.xml.txw2.annotation.XmlAttribute;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public interface ParamType
+ extends TypedXmlWriter, Documented
+{
+
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.ParamType message(QName value);
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.ParamType name(String value);
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/ParamType.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Part.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Part.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Part.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,51 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.writer.document;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.OpenAtts;
+
+import com.sun.xml.txw2.TypedXmlWriter;
+import com.sun.xml.txw2.annotation.XmlAttribute;
+import com.sun.xml.txw2.annotation.XmlElement;
+
+/**
+ *
+ * @author WS Development Team
+ */
+@XmlElement("part")
+public interface Part
+ extends TypedXmlWriter, OpenAtts
+{
+
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.Part element(QName value);
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.Part type(QName value);
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.Part name(String value);
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Part.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Port.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Port.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Port.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,51 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.writer.document;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.Documented;
+
+import com.sun.xml.txw2.TypedXmlWriter;
+import com.sun.xml.txw2.annotation.XmlAttribute;
+import com.sun.xml.txw2.annotation.XmlElement;
+
+/**
+ *
+ * @author WS Development Team
+ */
+@XmlElement("port")
+public interface Port
+ extends TypedXmlWriter, Documented
+{
+
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.Port name(String value);
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.Port arrayType(String value);
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.Port binding(QName value);
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Port.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/PortType.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/PortType.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/PortType.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,47 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.writer.document;
+
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.Documented;
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.Operation;
+
+import com.sun.xml.txw2.TypedXmlWriter;
+import com.sun.xml.txw2.annotation.XmlAttribute;
+import com.sun.xml.txw2.annotation.XmlElement;
+
+/**
+ *
+ * @author WS Development Team
+ */
+@XmlElement("portType")
+public interface PortType
+ extends TypedXmlWriter, Documented
+{
+
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.PortType name(String value);
+
+ @XmlElement
+ public Operation operation();
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/PortType.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Service.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Service.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Service.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,47 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.writer.document;
+
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.Documented;
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.Port;
+
+import com.sun.xml.txw2.TypedXmlWriter;
+import com.sun.xml.txw2.annotation.XmlAttribute;
+import com.sun.xml.txw2.annotation.XmlElement;
+
+/**
+ *
+ * @author WS Development Team
+ */
+@XmlElement("service")
+public interface Service
+ extends TypedXmlWriter, Documented
+{
+
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.Service name(String value);
+
+ @XmlElement
+ public Port port();
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Service.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/StartWithExtensionsType.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/StartWithExtensionsType.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/StartWithExtensionsType.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,34 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.writer.document;
+
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.Documented;
+
+import com.sun.xml.txw2.TypedXmlWriter;
+
+
+/**
+ *
+ * @author WS Development Team
+ */
+public interface StartWithExtensionsType extends TypedXmlWriter, Documented {
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/StartWithExtensionsType.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Types.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Types.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Types.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,40 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.writer.document;
+
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.Documented;
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.xsd.Schema;
+
+import com.sun.xml.txw2.TypedXmlWriter;
+import com.sun.xml.txw2.annotation.XmlElement;
+
+/**
+ *
+ * @author WS Development Team
+ */
+@XmlElement("types")
+public interface Types
+ extends TypedXmlWriter, Documented
+{
+
@XmlElement(value="schema",ns="http://www.w3.org/2001/XMLSchema")
+ public Schema schema();
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/Types.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/http/Address.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/http/Address.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/http/Address.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,43 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+
+package org.jboss.com.sun.xml.ws.wsdl.writer.document.http;
+
+import com.sun.xml.txw2.TypedXmlWriter;
+import com.sun.xml.txw2.annotation.XmlAttribute;
+import com.sun.xml.txw2.annotation.XmlElement;
+
+/**
+ *
+ * @author WS Development Team
+ */
+@XmlElement("address")
+public interface Address
+ extends TypedXmlWriter
+{
+
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.http.Address location(String
value);
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/http/Address.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/http/Binding.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/http/Binding.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/http/Binding.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,43 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+
+package org.jboss.com.sun.xml.ws.wsdl.writer.document.http;
+
+import com.sun.xml.txw2.TypedXmlWriter;
+import com.sun.xml.txw2.annotation.XmlAttribute;
+import com.sun.xml.txw2.annotation.XmlElement;
+
+/**
+ *
+ * @author WS Development Team
+ */
+@XmlElement("binding")
+public interface Binding
+ extends TypedXmlWriter
+{
+
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.http.Binding verb(String
value);
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/http/Binding.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/http/Operation.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/http/Operation.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/http/Operation.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,43 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+
+package org.jboss.com.sun.xml.ws.wsdl.writer.document.http;
+
+import com.sun.xml.txw2.TypedXmlWriter;
+import com.sun.xml.txw2.annotation.XmlAttribute;
+import com.sun.xml.txw2.annotation.XmlElement;
+
+/**
+ *
+ * @author WS Development Team
+ */
+@XmlElement("operation")
+public interface Operation
+ extends TypedXmlWriter
+{
+
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.http.Operation location(String
value);
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/http/Operation.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/http/package-info.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/http/package-info.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/http/package-info.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,30 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+
+
+/**
+ *
+ * @author WS Development Team
+ */
+@com.sun.xml.txw2.annotation.XmlNamespace("http://schemas.xmlsoap.org/wsdl/http/")
+package org.jboss.com.sun.xml.ws.wsdl.writer.document.http;
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/http/package-info.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/package-info.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/package-info.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/package-info.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,28 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+/**
+ *
+ * @author WS Development Team
+ */
+@com.sun.xml.txw2.annotation.XmlNamespace("http://schemas.xmlsoap.org/wsdl/")
+package org.jboss.com.sun.xml.ws.wsdl.writer.document;
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/package-info.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/Body.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/Body.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/Body.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,39 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.writer.document.soap;
+
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.soap.BodyType;
+
+import com.sun.xml.txw2.TypedXmlWriter;
+import com.sun.xml.txw2.annotation.XmlElement;
+
+/**
+ *
+ * @author WS Development Team
+ */
+@XmlElement("body")
+public interface Body
+ extends TypedXmlWriter, BodyType
+{
+
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/Body.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/BodyType.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/BodyType.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/BodyType.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,48 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.writer.document.soap;
+
+import com.sun.xml.txw2.TypedXmlWriter;
+import com.sun.xml.txw2.annotation.XmlAttribute;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public interface BodyType
+ extends TypedXmlWriter
+{
+
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.soap.BodyType
encodingStyle(String value);
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.soap.BodyType namespace(String
value);
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.soap.BodyType use(String
value);
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.soap.BodyType parts(String
value);
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/BodyType.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/Header.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/Header.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/Header.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,52 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.writer.document.soap;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.soap.BodyType;
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.soap.HeaderFault;
+
+import com.sun.xml.txw2.TypedXmlWriter;
+import com.sun.xml.txw2.annotation.XmlAttribute;
+import com.sun.xml.txw2.annotation.XmlElement;
+
+/**
+ *
+ * @author WS Development Team
+ */
+@XmlElement("header")
+public interface Header
+ extends TypedXmlWriter, BodyType
+{
+
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.soap.Header message(QName
value);
+
+ @XmlElement
+ public HeaderFault headerFault();
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.soap.BodyType part(String
value);
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/Header.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/HeaderFault.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/HeaderFault.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/HeaderFault.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,45 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.writer.document.soap;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.soap.BodyType;
+
+import com.sun.xml.txw2.TypedXmlWriter;
+import com.sun.xml.txw2.annotation.XmlAttribute;
+import com.sun.xml.txw2.annotation.XmlElement;
+
+/**
+ *
+ * @author WS Development Team
+ */
+@XmlElement("headerFault")
+public interface HeaderFault
+ extends TypedXmlWriter, BodyType
+{
+
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.soap.HeaderFault message(QName
value);
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/HeaderFault.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/SOAPAddress.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/SOAPAddress.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/SOAPAddress.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,41 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.writer.document.soap;
+
+import com.sun.xml.txw2.TypedXmlWriter;
+import com.sun.xml.txw2.annotation.XmlAttribute;
+import com.sun.xml.txw2.annotation.XmlElement;
+
+/**
+ *
+ * @author WS Development Team
+ */
+@XmlElement("address")
+public interface SOAPAddress
+ extends TypedXmlWriter
+{
+
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.soap.SOAPAddress location(String
value);
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/SOAPAddress.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/SOAPBinding.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/SOAPBinding.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/SOAPBinding.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,44 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.writer.document.soap;
+
+import com.sun.xml.txw2.TypedXmlWriter;
+import com.sun.xml.txw2.annotation.XmlAttribute;
+import com.sun.xml.txw2.annotation.XmlElement;
+
+/**
+ *
+ * @author WS Development Team
+ */
+@XmlElement("binding")
+public interface SOAPBinding
+ extends TypedXmlWriter
+{
+
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.soap.SOAPBinding
transport(String value);
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.soap.SOAPBinding style(String
value);
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/SOAPBinding.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/SOAPFault.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/SOAPFault.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/SOAPFault.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,41 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.writer.document.soap;
+
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.soap.BodyType;
+
+import com.sun.xml.txw2.TypedXmlWriter;
+import com.sun.xml.txw2.annotation.XmlAttribute;
+import com.sun.xml.txw2.annotation.XmlElement;
+
+/**
+ *
+ * @author WS Development Team
+ */
+@XmlElement("fault")
+public interface SOAPFault
+ extends TypedXmlWriter, BodyType
+{
+ @XmlAttribute
+ public SOAPFault name(String value);
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/SOAPFault.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/SOAPOperation.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/SOAPOperation.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/SOAPOperation.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,44 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.writer.document.soap;
+
+import com.sun.xml.txw2.TypedXmlWriter;
+import com.sun.xml.txw2.annotation.XmlAttribute;
+import com.sun.xml.txw2.annotation.XmlElement;
+
+/**
+ *
+ * @author WS Development Team
+ */
+@XmlElement("operation")
+public interface SOAPOperation
+ extends TypedXmlWriter
+{
+
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.soap.SOAPOperation
soapAction(String value);
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.soap.SOAPOperation style(String
value);
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/SOAPOperation.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/package-info.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/package-info.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/package-info.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,28 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+/**
+ *
+ * @author WS Development Team
+ */
+@com.sun.xml.txw2.annotation.XmlNamespace("http://schemas.xmlsoap.org/wsdl/soap/")
+package org.jboss.com.sun.xml.ws.wsdl.writer.document.soap;
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap/package-info.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/Body.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/Body.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/Body.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,37 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.writer.document.soap12;
+
+import com.sun.xml.txw2.TypedXmlWriter;
+import com.sun.xml.txw2.annotation.XmlElement;
+
+/**
+ *
+ * @author WS Development Team
+ */
+@XmlElement("body")
+public interface Body
+ extends TypedXmlWriter, BodyType
+{
+
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/Body.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/BodyType.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/BodyType.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/BodyType.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,48 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.writer.document.soap12;
+
+import com.sun.xml.txw2.TypedXmlWriter;
+import com.sun.xml.txw2.annotation.XmlAttribute;
+
+/**
+ *
+ * @author WS Development Team
+ */
+public interface BodyType
+ extends TypedXmlWriter
+{
+
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.soap12.BodyType
encodingStyle(String value);
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.soap12.BodyType namespace(String
value);
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.soap12.BodyType use(String
value);
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.soap12.BodyType parts(String
value);
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/BodyType.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/Header.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/Header.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/Header.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,48 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.writer.document.soap12;
+
+import javax.xml.namespace.QName;
+import com.sun.xml.txw2.TypedXmlWriter;
+import com.sun.xml.txw2.annotation.XmlAttribute;
+import com.sun.xml.txw2.annotation.XmlElement;
+
+/**
+ *
+ * @author WS Development Team
+ */
+@XmlElement("header")
+public interface Header
+ extends TypedXmlWriter, BodyType
+{
+
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.soap12.Header message(QName
value);
+
+ @XmlElement
+ public HeaderFault headerFault();
+
+ @XmlAttribute
+ public BodyType part(String value);
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/Header.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/HeaderFault.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/HeaderFault.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/HeaderFault.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,42 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.writer.document.soap12;
+
+import javax.xml.namespace.QName;
+import com.sun.xml.txw2.TypedXmlWriter;
+import com.sun.xml.txw2.annotation.XmlAttribute;
+import com.sun.xml.txw2.annotation.XmlElement;
+
+/**
+ *
+ * @author WS Development Team
+ */
+@XmlElement("headerFault")
+public interface HeaderFault
+ extends TypedXmlWriter, BodyType
+{
+
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.soap12.HeaderFault message(QName
value);
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/HeaderFault.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/SOAPAddress.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/SOAPAddress.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/SOAPAddress.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,41 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.writer.document.soap12;
+
+import com.sun.xml.txw2.TypedXmlWriter;
+import com.sun.xml.txw2.annotation.XmlAttribute;
+import com.sun.xml.txw2.annotation.XmlElement;
+
+/**
+ *
+ * @author WS Development Team
+ */
+@XmlElement("address")
+public interface SOAPAddress
+ extends TypedXmlWriter
+{
+
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.soap12.SOAPAddress
location(String value);
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/SOAPAddress.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/SOAPBinding.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/SOAPBinding.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/SOAPBinding.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,44 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.writer.document.soap12;
+
+import com.sun.xml.txw2.TypedXmlWriter;
+import com.sun.xml.txw2.annotation.XmlAttribute;
+import com.sun.xml.txw2.annotation.XmlElement;
+
+/**
+ *
+ * @author WS Development Team
+ */
+@XmlElement("binding")
+public interface SOAPBinding
+ extends TypedXmlWriter
+{
+
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.soap12.SOAPBinding
transport(String value);
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.soap12.SOAPBinding style(String
value);
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/SOAPBinding.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/SOAPFault.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/SOAPFault.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/SOAPFault.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,39 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.writer.document.soap12;
+
+import com.sun.xml.txw2.TypedXmlWriter;
+import com.sun.xml.txw2.annotation.XmlAttribute;
+import com.sun.xml.txw2.annotation.XmlElement;
+
+/**
+ *
+ * @author WS Development Team
+ */
+@XmlElement("fault")
+public interface SOAPFault
+ extends TypedXmlWriter, BodyType
+{
+ @XmlAttribute
+ public SOAPFault name(String value);
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/SOAPFault.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/SOAPOperation.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/SOAPOperation.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/SOAPOperation.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,44 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.writer.document.soap12;
+
+import com.sun.xml.txw2.TypedXmlWriter;
+import com.sun.xml.txw2.annotation.XmlAttribute;
+import com.sun.xml.txw2.annotation.XmlElement;
+
+/**
+ *
+ * @author WS Development Team
+ */
+@XmlElement("operation")
+public interface SOAPOperation
+ extends TypedXmlWriter
+{
+
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.soap12.SOAPOperation
soapAction(String value);
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.soap12.SOAPOperation
style(String value);
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/SOAPOperation.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/package-info.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/package-info.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/package-info.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,28 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+/**
+ *
+ * @author WS Development Team
+ */
+@com.sun.xml.txw2.annotation.XmlNamespace("http://schemas.xmlsoap.org/wsdl/soap12/")
+package org.jboss.com.sun.xml.ws.wsdl.writer.document.soap12;
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/soap12/package-info.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/xsd/Import.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/xsd/Import.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/xsd/Import.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,46 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.writer.document.xsd;
+
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.*;
+
+import com.sun.xml.txw2.TypedXmlWriter;
+import com.sun.xml.txw2.annotation.XmlAttribute;
+import com.sun.xml.txw2.annotation.XmlElement;
+
+/**
+ *
+ * @author WS Development Team
+ */
+@XmlElement("import")
+public interface Import
+ extends TypedXmlWriter, Documented
+{
+
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.xsd.Import schemaLocation(String
value);
+
+ @XmlAttribute
+ public org.jboss.com.sun.xml.ws.wsdl.writer.document.xsd.Import namespace(String
value);
+
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/xsd/Import.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/xsd/Schema.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/xsd/Schema.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/xsd/Schema.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,42 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+package org.jboss.com.sun.xml.ws.wsdl.writer.document.xsd;
+
+import org.jboss.com.sun.xml.ws.wsdl.writer.document.*;
+
+import com.sun.xml.txw2.TypedXmlWriter;
+import com.sun.xml.txw2.annotation.XmlAttribute;
+import com.sun.xml.txw2.annotation.XmlElement;
+
+/**
+ *
+ * @author WS Development Team
+ */
+@XmlElement("schema")
+public interface Schema
+ extends TypedXmlWriter, Documented
+{
+
+
+ @XmlElement("import")
+ public Import _import();
+}
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/xsd/Schema.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/xsd/package-info.java
===================================================================
---
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/xsd/package-info.java
(rev 0)
+++
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/xsd/package-info.java 2007-01-31
02:44:54 UTC (rev 2202)
@@ -0,0 +1,28 @@
+/*
+ * 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
+ *
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at
https://glassfish.dev.java.net/public/CDDLv1.0.html.
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * you own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
+ */
+
+/**
+ *
+ * @author WS Development Team
+ */
+@com.sun.xml.txw2.annotation.XmlNamespace("http://www.w3.org/2001/XMLSchema")
+package org.jboss.com.sun.xml.ws.wsdl.writer.document.xsd;
Property changes on:
subprojects/jbossws-sun-wsimport/sun/src/main/org/jboss/com/sun/xml/ws/wsdl/writer/document/xsd/package-info.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF