List of usage examples for javax.xml.stream XMLStreamWriter flush
public void flush() throws XMLStreamException;
From source file:org.apache.nifi.authorization.StandardManagedAuthorizer.java
@Override public String getFingerprint() throws AuthorizationAccessException { XMLStreamWriter writer = null; final StringWriter out = new StringWriter(); try {//from w w w .j a v a 2 s .c om writer = XML_OUTPUT_FACTORY.createXMLStreamWriter(out); writer.writeStartDocument(); writer.writeStartElement("managedAuthorizations"); writer.writeStartElement(ACCESS_POLICY_PROVIDER_ELEMENT); if (accessPolicyProvider instanceof ConfigurableAccessPolicyProvider) { writer.writeCharacters(((ConfigurableAccessPolicyProvider) accessPolicyProvider).getFingerprint()); } writer.writeEndElement(); writer.writeStartElement(USER_GROUP_PROVIDER_ELEMENT); if (userGroupProvider instanceof ConfigurableUserGroupProvider) { writer.writeCharacters(((ConfigurableUserGroupProvider) userGroupProvider).getFingerprint()); } writer.writeEndElement(); writer.writeEndElement(); writer.writeEndDocument(); writer.flush(); } catch (XMLStreamException e) { throw new AuthorizationAccessException("Unable to generate fingerprint", e); } finally { if (writer != null) { try { writer.close(); } catch (XMLStreamException e) { // nothing to do here } } } return out.toString(); }
From source file:org.apache.olingo.client.core.serialization.AtomSerializer.java
private void property(final Writer outWriter, final Property property) throws XMLStreamException, EdmPrimitiveTypeException { final XMLStreamWriter writer = FACTORY.createXMLStreamWriter(outWriter); writer.writeStartDocument();//from w w w . java2 s . c om property(writer, property); writer.writeEndDocument(); writer.flush(); }
From source file:org.apache.olingo.client.core.serialization.AtomSerializer.java
private void entity(final Writer outWriter, final Entity entity) throws XMLStreamException, EdmPrimitiveTypeException { final XMLStreamWriter writer = FACTORY.createXMLStreamWriter(outWriter); if (entity.getType() == null && entity.getProperties().isEmpty()) { writer.writeStartDocument();//from w w w . java 2s . com writer.setDefaultNamespace(namespaceMetadata); entityRef(writer, entity); } else { startDocument(writer, Constants.ATOM_ELEM_ENTRY); entity(writer, entity); } writer.writeEndDocument(); writer.flush(); }
From source file:org.apache.olingo.client.core.serialization.AtomSerializer.java
private void entity(final Writer outWriter, final ResWrap<Entity> container) throws XMLStreamException, EdmPrimitiveTypeException { final Entity entity = container.getPayload(); final XMLStreamWriter writer = FACTORY.createXMLStreamWriter(outWriter); if (entity.getType() == null && entity.getProperties().isEmpty()) { writer.writeStartDocument();// w ww .ja v a 2s. c om writer.setDefaultNamespace(namespaceMetadata); entityRef(writer, container); } else { startDocument(writer, Constants.ATOM_ELEM_ENTRY); addContextInfo(writer, container); entity(writer, entity); } writer.writeEndElement(); writer.writeEndDocument(); writer.flush(); }
From source file:org.apache.olingo.client.core.serialization.AtomSerializer.java
private void entitySet(final Writer outWriter, final EntityCollection entitySet) throws XMLStreamException, EdmPrimitiveTypeException { final XMLStreamWriter writer = FACTORY.createXMLStreamWriter(outWriter); startDocument(writer, Constants.ATOM_ELEM_FEED); entitySet(writer, entitySet);/* w w w . j a va 2s . c om*/ writer.writeEndElement(); writer.writeEndDocument(); writer.flush(); }
From source file:org.apache.olingo.client.core.serialization.AtomSerializer.java
private void entitySet(final Writer outWriter, final ResWrap<EntityCollection> entitySet) throws XMLStreamException, EdmPrimitiveTypeException { final XMLStreamWriter writer = FACTORY.createXMLStreamWriter(outWriter); startDocument(writer, Constants.ATOM_ELEM_FEED); addContextInfo(writer, entitySet);//from www . j a v a 2 s .c o m entitySet(writer, entitySet.getPayload()); writer.writeEndElement(); writer.writeEndDocument(); writer.flush(); }
From source file:org.apache.olingo.client.core.serialization.AtomSerializer.java
private void link(final Writer outWriter, final Link link) throws XMLStreamException { final XMLStreamWriter writer = FACTORY.createXMLStreamWriter(outWriter); writer.writeStartDocument();//from w w w . j a v a2 s.com writer.writeStartElement(Constants.ELEM_LINKS); writer.writeDefaultNamespace(namespaceData); writer.writeStartElement(Constants.ELEM_URI); writer.writeCharacters(link.getHref()); writer.writeEndElement(); writer.writeEndElement(); writer.writeEndDocument(); writer.flush(); }
From source file:org.apache.olingo.commons.core.data.AtomSerializer.java
private void property(final Writer outWriter, final Property property) throws XMLStreamException { final XMLStreamWriter writer = FACTORY.createXMLStreamWriter(outWriter); writer.writeStartDocument();//from w ww. jav a 2s . com propSerializer.property(writer, property); writer.writeEndDocument(); writer.flush(); }
From source file:org.apache.olingo.commons.core.data.AtomSerializer.java
private void entry(final Writer outWriter, final Entry entry) throws XMLStreamException { final XMLStreamWriter writer = FACTORY.createXMLStreamWriter(outWriter); startDocument(writer, Constants.ATOM_ELEM_ENTRY); entry(writer, entry);/*from ww w .j a va2 s . c om*/ writer.writeEndElement(); writer.writeEndDocument(); writer.flush(); }
From source file:org.apache.olingo.commons.core.data.AtomSerializer.java
private void feed(final Writer outWriter, final Feed feed) throws XMLStreamException { final XMLStreamWriter writer = FACTORY.createXMLStreamWriter(outWriter); startDocument(writer, Constants.ATOM_ELEM_FEED); feed(writer, feed);// w w w. j ava 2s .c om writer.writeEndElement(); writer.writeEndDocument(); writer.flush(); }