• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java TypedXmlWriter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.sun.xml.internal.txw2.TypedXmlWriter的典型用法代码示例。如果您正苦于以下问题:Java TypedXmlWriter类的具体用法?Java TypedXmlWriter怎么用?Java TypedXmlWriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TypedXmlWriter类属于com.sun.xml.internal.txw2包,在下文中一共展示了TypedXmlWriter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: selectAndProcessSubject

import com.sun.xml.internal.txw2.TypedXmlWriter; //导入依赖的package包/类
/**
 * This method should only be invoked by interface methods that deal with WSDL binding because they
 * may use the QName of the WSDL binding element as PolicySubject instead of a WSDL object.
 *
 * @param xmlWriter A TypedXmlWriter.
 * @param clazz The policy subject.
 * @param scopeType The WSDL scope.
 * @param bindingName The WSDL binding name.
 */
private void selectAndProcessSubject(final TypedXmlWriter xmlWriter, final Class clazz, final ScopeType scopeType, final QName bindingName) {
    LOGGER.entering(xmlWriter, clazz, scopeType, bindingName);
    if (bindingName == null) {
        selectAndProcessSubject(xmlWriter, clazz, scopeType, (String) null);
    } else {
        if (subjects != null) {
            for (PolicySubject subject : subjects) {
                if (bindingName.equals(subject.getSubject())) {
                    writePolicyOrReferenceIt(subject, xmlWriter);
                }
            }
        }
        selectAndProcessSubject(xmlWriter, clazz, scopeType, bindingName.getLocalPart());
    }
    LOGGER.exiting();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:PolicyWSDLGeneratorExtension.java


示例2: writePolicyOrReferenceIt

import com.sun.xml.internal.txw2.TypedXmlWriter; //导入依赖的package包/类
/**
 * Adds a PolicyReference element that points to the policy of the element,
 * if the policy does not have any id or name. Writes policy inside the element otherwise.
 *
 * @param subject
 *      PolicySubject to be referenced or marshalled
 * @param writer
 *      A TXW on to which we shall add the PolicyReference
 */
private void writePolicyOrReferenceIt(final PolicySubject subject, final TypedXmlWriter writer) {
    final Policy policy;
    try {
        policy = subject.getEffectivePolicy(merger);
    } catch (PolicyException e) {
        throw LOGGER.logSevereException(new WebServiceException(PolicyMessages.WSP_1011_FAILED_TO_RETRIEVE_EFFECTIVE_POLICY_FOR_SUBJECT(subject.toString()), e));
    }
    if (policy != null) {
        if (null == policy.getIdOrName()) {
            final PolicyModelGenerator generator = ModelGenerator.getGenerator();
            try {
                final PolicySourceModel policyInfoset = generator.translate(policy);
                marshaller.marshal(policyInfoset, writer);
            } catch (PolicyException pe) {
                throw LOGGER.logSevereException(new WebServiceException(PolicyMessages.WSP_1002_UNABLE_TO_MARSHALL_POLICY_OR_POLICY_REFERENCE(), pe));
            }
        } else {
            final TypedXmlWriter policyReference = writer._element(policy.getNamespaceVersion().asQName(XmlToken.PolicyReference), TypedXmlWriter.class);
            policyReference._attribute(XmlToken.Uri.toString(), '#' + policy.getIdOrName());
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:32,代码来源:PolicyWSDLGeneratorExtension.java


示例3: startElement

import com.sun.xml.internal.txw2.TypedXmlWriter; //导入依赖的package包/类
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
    TypedXmlWriter txw = stack.peek()._element(uri, localName, TypedXmlWriter.class);
    stack.push(txw);
    if (atts != null) {
        for(int i = 0; i < atts.getLength(); i++)  {
            String auri = atts.getURI(i);
            if ("http://www.w3.org/2000/xmlns/".equals(auri)) {
                if ("xmlns".equals(atts.getLocalName(i)))
                    txw._namespace(atts.getValue(i), "");
                else
                    txw._namespace(atts.getValue(i),atts.getLocalName(i));
            } else {
                if ("schemaLocation".equals(atts.getLocalName(i))
                        && "".equals(atts.getValue(i)))
                    continue;
                txw._attribute(auri, atts.getLocalName(i), atts.getValue(i));
            }
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:TXWContentHandler.java


示例4: addOperationInputExtension

import com.sun.xml.internal.txw2.TypedXmlWriter; //导入依赖的package包/类
@Override
public void addOperationInputExtension(TypedXmlWriter input, JavaMethod method) {
    if (!enabled)
        return;

    Action a = method.getSEIMethod().getAnnotation(Action.class);
    if (a != null && !a.input().equals("")) {
        addAttribute(input, a.input());
    } else {

        String soapAction = method.getBinding().getSOAPAction();
        // in SOAP 1.2 soapAction is optional ...
        if (soapAction == null || soapAction.equals("")) {
            //hack: generate default action for interop with .Net3.0 when soapAction is non-empty
            String defaultAction = getDefaultAction(method);
            addAttribute(input, defaultAction);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:W3CAddressingWSDLGeneratorExtension.java


示例5: addBindingExtension

import com.sun.xml.internal.txw2.TypedXmlWriter; //导入依赖的package包/类
@Override
public void addBindingExtension(TypedXmlWriter binding) {
    if (!enabled)
        return;
    binding._element(AddressingVersion.W3C.wsdlExtensionTag, UsingAddressing.class);
    /*
    Do not generate wsdl:required=true
    if(required) {
        ua.required(true);
    }
    */
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:W3CAddressingWSDLGeneratorExtension.java


示例6: addServiceExtension

import com.sun.xml.internal.txw2.TypedXmlWriter; //导入依赖的package包/类
@Override
public void addServiceExtension(final TypedXmlWriter service) {
    LOGGER.entering();
    final String serviceName = (null == seiModel) ? null : seiModel.getServiceQName().getLocalPart();
    selectAndProcessSubject(service, WSDLService.class, ScopeType.SERVICE, serviceName);
    LOGGER.exiting();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:PolicyWSDLGeneratorExtension.java


示例7: marshal

import com.sun.xml.internal.txw2.TypedXmlWriter; //导入依赖的package包/类
public void marshal(final PolicySourceModel model, final Object storage) throws PolicyException {
    if (storage instanceof StaxSerializer) {
        marshal(model, (StaxSerializer) storage);
    } else if (storage instanceof TypedXmlWriter) {
        marshal(model, (TypedXmlWriter) storage);
    } else if (storage instanceof XMLStreamWriter) {
        marshal(model, (XMLStreamWriter) storage);
    } else {
        throw LOGGER.logSevereException(new PolicyException(LocalizationMessages.WSP_0022_STORAGE_TYPE_NOT_SUPPORTED(storage.getClass().getName())));
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:XmlPolicyModelMarshaller.java


示例8: addBindingOperationFaultExtension

import com.sun.xml.internal.txw2.TypedXmlWriter; //导入依赖的package包/类
@Override
public void addBindingOperationFaultExtension(final TypedXmlWriter writer, final JavaMethod method, final CheckedException exception) {
    LOGGER.entering(writer, method, exception);
    if (subjects != null) {
        for (PolicySubject subject : subjects) { // iterate over all subjects in policy map
            if (this.policyMap.isFaultMessageSubject(subject)) {
                final Object concreteSubject = subject.getSubject();
                if (concreteSubject != null) {
                    final String exceptionName = exception == null ? null : exception.getMessageName();
                    if (exceptionName == null) { // no name provided to check
                        writePolicyOrReferenceIt(subject, writer);
                    }
                    if (WSDLBoundFaultContainer.class.isInstance(concreteSubject)) { // is it our class?
                        WSDLBoundFaultContainer faultContainer = (WSDLBoundFaultContainer) concreteSubject;
                        WSDLBoundFault fault = faultContainer.getBoundFault();
                        WSDLBoundOperation operation = faultContainer.getBoundOperation();
                        if (exceptionName.equals(fault.getName()) &&
                                operation.getName().getLocalPart().equals(method.getOperationName())) {
                            writePolicyOrReferenceIt(subject, writer);
                        }
                    }
                    else if (WsdlBindingSubject.class.isInstance(concreteSubject)) {
                        WsdlBindingSubject wsdlSubject = (WsdlBindingSubject) concreteSubject;
                        if ((wsdlSubject.getMessageType() == WsdlBindingSubject.WsdlMessageType.FAULT) &&
                            exception.getOwner().getTargetNamespace().equals(wsdlSubject.getName().getNamespaceURI()) &&
                            exceptionName.equals(wsdlSubject.getName().getLocalPart())) {
                            writePolicyOrReferenceIt(subject, writer);
                        }
                    }
                }
            }
        }
    }
    LOGGER.exiting();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:36,代码来源:PolicyWSDLGeneratorExtension.java


示例9: marshalPolicyAttributes

import com.sun.xml.internal.txw2.TypedXmlWriter; //导入依赖的package包/类
/**
 * Marshal the Policy root element attributes onto the TypedXmlWriter.
 *
 * @param model The policy source model.
 * @param writer The typed XML writer.
 */
private static void marshalPolicyAttributes(final PolicySourceModel model, final TypedXmlWriter writer) {
    final String policyId = model.getPolicyId();
    if (policyId != null) {
        writer._attribute(PolicyConstants.WSU_ID, policyId);
    }

    final String policyName = model.getPolicyName();
    if (policyName != null) {
        writer._attribute(model.getNamespaceVersion().asQName(XmlToken.Name), policyName);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:XmlPolicyModelMarshaller.java


示例10: addPortExtension

import com.sun.xml.internal.txw2.TypedXmlWriter; //导入依赖的package包/类
@Override
public void addPortExtension(final TypedXmlWriter port) {
    LOGGER.entering();
    final String portName = (null == seiModel) ? null : seiModel.getPortName().getLocalPart();
    selectAndProcessSubject(port, WSDLPort.class, ScopeType.ENDPOINT, portName);
    LOGGER.exiting();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:PolicyWSDLGeneratorExtension.java


示例11: start

import com.sun.xml.internal.txw2.TypedXmlWriter; //导入依赖的package包/类
@Override
public void start(final WSDLGenExtnContext context) {
    LOGGER.entering();
    try {
        this.seiModel = context.getModel();

        final PolicyMapConfigurator[] policyMapConfigurators = loadConfigurators();
        final PolicyMapExtender[] extenders = new PolicyMapExtender[policyMapConfigurators.length];
        for (int i = 0; i < policyMapConfigurators.length; i++) {
            extenders[i] = PolicyMapExtender.createPolicyMapExtender();
        }
        // Read policy config file
        policyMap = PolicyResolverFactory.create().resolve(
                new PolicyResolver.ServerContext(policyMap, context.getContainer(), context.getEndpointClass(), false, extenders));

        if (policyMap == null) {
            LOGGER.fine(PolicyMessages.WSP_1019_CREATE_EMPTY_POLICY_MAP());
            policyMap = PolicyMap.createPolicyMap(Arrays.asList(extenders));
        }

        final WSBinding binding = context.getBinding();
        try {
            final Collection<PolicySubject> policySubjects = new LinkedList<PolicySubject>();
            for (int i = 0; i < policyMapConfigurators.length; i++) {
                policySubjects.addAll(policyMapConfigurators[i].update(policyMap, seiModel, binding));
                extenders[i].disconnect();
            }
            PolicyMapUtil.insertPolicies(policyMap, policySubjects, this.seiModel.getServiceQName(), this.seiModel.getPortName());
        } catch (PolicyException e) {
            throw LOGGER.logSevereException(new WebServiceException(PolicyMessages.WSP_1017_MAP_UPDATE_FAILED(), e));
        }
        final TypedXmlWriter root = context.getRoot();
        root._namespace(NamespaceVersion.v1_2.toString(), NamespaceVersion.v1_2.getDefaultNamespacePrefix());
        root._namespace(NamespaceVersion.v1_5.toString(), NamespaceVersion.v1_5.getDefaultNamespacePrefix());
        root._namespace(PolicyConstants.WSU_NAMESPACE_URI, PolicyConstants.WSU_NAMESPACE_PREFIX);

    } finally {
        LOGGER.exiting();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:41,代码来源:PolicyWSDLGeneratorExtension.java


示例12: addPortTypeExtension

import com.sun.xml.internal.txw2.TypedXmlWriter; //导入依赖的package包/类
@Override
public void addPortTypeExtension(final TypedXmlWriter portType) {
    LOGGER.entering();
    final String portTypeName = (null == seiModel) ? null : seiModel.getPortTypeName().getLocalPart();
    selectAndProcessSubject(portType, WSDLPortType.class, ScopeType.ENDPOINT, portTypeName);
    LOGGER.exiting();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:PolicyWSDLGeneratorExtension.java


示例13: addBindingOperationExtension

import com.sun.xml.internal.txw2.TypedXmlWriter; //导入依赖的package包/类
@Override
public void addBindingOperationExtension(final TypedXmlWriter operation, final JavaMethod method) {
    LOGGER.entering();
    final QName operationName = (method == null) ? null : new QName(method.getOwner().getTargetNamespace(), method.getOperationName());
    selectAndProcessBindingSubject(operation, WSDLBoundOperation.class, ScopeType.OPERATION, operationName);
    LOGGER.exiting();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:PolicyWSDLGeneratorExtension.java


示例14: addOperationFaultExtension

import com.sun.xml.internal.txw2.TypedXmlWriter; //导入依赖的package包/类
@Override
public void addOperationFaultExtension(final TypedXmlWriter fault, final JavaMethod method, final CheckedException exception) {
    LOGGER.entering();
    final String messageName = (null == exception) ? null : exception.getMessageName();
    selectAndProcessSubject(fault, WSDLFault.class, ScopeType.FAULT_MESSAGE, messageName);
    LOGGER.exiting();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:PolicyWSDLGeneratorExtension.java


示例15: addFaultMessageExtension

import com.sun.xml.internal.txw2.TypedXmlWriter; //导入依赖的package包/类
@Override
public void addFaultMessageExtension(final TypedXmlWriter message, final JavaMethod method, final CheckedException exception) {
    LOGGER.entering();
    final String messageName = (null == exception) ? null : exception.getMessageName();
    selectAndProcessSubject(message, WSDLMessage.class, ScopeType.FAULT_MESSAGE, messageName);
    LOGGER.exiting();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:PolicyWSDLGeneratorExtension.java


示例16: selectAndProcessBindingSubject

import com.sun.xml.internal.txw2.TypedXmlWriter; //导入依赖的package包/类
private void selectAndProcessBindingSubject(final TypedXmlWriter xmlWriter, final Class clazz, final ScopeType scopeType, final QName bindingName) {
    LOGGER.entering(xmlWriter, clazz, scopeType, bindingName);
    if ((subjects != null) && (bindingName != null)) {
        for (PolicySubject subject : subjects) {
            if (subject.getSubject() instanceof WsdlBindingSubject) {
                final WsdlBindingSubject wsdlSubject = (WsdlBindingSubject) subject.getSubject();
                if (bindingName.equals(wsdlSubject.getName())) {
                    writePolicyOrReferenceIt(subject, xmlWriter);
                }
            }
        }
    }
    selectAndProcessSubject(xmlWriter, clazz, scopeType, bindingName);
    LOGGER.exiting();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:PolicyWSDLGeneratorExtension.java


示例17: addOperationOutputExtension

import com.sun.xml.internal.txw2.TypedXmlWriter; //导入依赖的package包/类
@Override
public void addOperationOutputExtension(final TypedXmlWriter output, final JavaMethod method) {
    LOGGER.entering();
    final String messageName = (null == method) ? null : method.getResponseMessageName();
    selectAndProcessSubject(output, WSDLOutput.class, ScopeType.OUTPUT_MESSAGE, messageName);
    LOGGER.exiting();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:PolicyWSDLGeneratorExtension.java


示例18: addBindingOperationInputExtension

import com.sun.xml.internal.txw2.TypedXmlWriter; //导入依赖的package包/类
@Override
public void addBindingOperationInputExtension(final TypedXmlWriter input, final JavaMethod method) {
    LOGGER.entering();
    final QName operationName = new QName(method.getOwner().getTargetNamespace(), method.getOperationName());
    selectAndProcessBindingSubject(input, WSDLBoundOperation.class, ScopeType.INPUT_MESSAGE, operationName);
    LOGGER.exiting();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:PolicyWSDLGeneratorExtension.java


示例19: marshal

import com.sun.xml.internal.txw2.TypedXmlWriter; //导入依赖的package包/类
/**
 * Marshal a policy onto the given XMLStreamWriter.
 *
 * @param model A policy source model.
 * @param writer An XML stream writer.
 * @throws PolicyException If marshalling failed.
 */
private void marshal(final PolicySourceModel model, final XMLStreamWriter writer) throws PolicyException {
    final StaxSerializer serializer = new StaxSerializer(writer);
    final TypedXmlWriter policy = TXW.create(model.getNamespaceVersion().asQName(XmlToken.Policy), TypedXmlWriter.class, serializer);

    marshalDefaultPrefixes(model, policy);
    marshalPolicyAttributes(model, policy);
    marshal(model.getNamespaceVersion(), model.getRootNode(), policy);
    policy.commit();
    serializer.flush();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:XmlPolicyModelMarshaller.java


示例20: generateSOAP12Headers

import com.sun.xml.internal.txw2.TypedXmlWriter; //导入依赖的package包/类
protected void generateSOAP12Headers(TypedXmlWriter writer, List<ParameterImpl> parameters, QName message) {

        for (ParameterImpl headerParam : parameters) {
            com.sun.xml.internal.ws.wsdl.writer.document.soap12.Header header = writer._element(com.sun.xml.internal.ws.wsdl.writer.document.soap12.Header.class);
            header.message(message);


            header.part(headerParam.getPartName());
            header.use(LITERAL);
        }
    }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:WSDLGenerator.java



注:本文中的com.sun.xml.internal.txw2.TypedXmlWriter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java WaitContainerResultCallback类代码示例发布时间:2022-05-23
下一篇:
Java TimedRotationPolicy类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap