public static OMElement getPolicyComponentAsOMElement(
PolicyComponent policyComponent,
ExternalPolicySerializer externalPolicySerializer)
throws XMLStreamException, FactoryConfigurationError {
if (policyComponent instanceof Policy) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
externalPolicySerializer.serialize((Policy) policyComponent, baos);
ByteArrayInputStream bais = new ByteArrayInputStream(baos
.toByteArray());
return (OMElement) XMLUtils.toOM(bais);
} else {
OMFactory fac = OMAbstractFactory.getOMFactory();
OMElement elem = fac.createOMElement(Constants.ELEM_POLICY_REF,
Constants.URI_POLICY_NS, Constants.ATTR_WSP);
elem.addAttribute(Constants.ATTR_URI,
((PolicyReference) policyComponent).getURI(), null);
return elem;
}
}
PolicyUtil.java 文件源码
java
阅读 21
收藏 0
点赞 0
评论 0
项目:wso2-axis2
作者:
评论列表
文章目录