Resource policyResource = registry.newResource();
policyResource.setProperty(RegistryResources.ServiceProperties.POLICY_UUID, policy.getId());
// do a performance improvement
ByteArrayOutputStream baos = new ByteArrayOutputStream();
XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(baos);
policy.serialize(writer);
writer.flush();
policyResource.setContent(baos.toString());
policyResource.setProperty(RegistryResources.ServiceProperties.POLICY_TYPE,
"" + PolicyInclude.AXIS_OPERATION_POLICY);
String policyResourcePath = servicePath + RegistryResources.POLICIES + policy.getId();