BUG 2412 - Restconf migration - marking deprecated classes
[controller.git] / opendaylight / md-sal / sal-rest-connector / src / main / java / org / opendaylight / controller / sal / rest / impl / StructuredDataToXmlProvider.java
index 3a235ced858a4be9af6dc24d9152602ff806bc09..fcb7b1de913fd95faab60c60f0ca28e869056e88 100644 (file)
@@ -37,9 +37,12 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.w3c.dom.Document;
 
+/**
+ * @deprecated class will be removed in Lithium release
+ */
 @Provider
 @Produces({ Draft02.MediaTypes.API + RestconfService.XML, Draft02.MediaTypes.DATA + RestconfService.XML,
-    Draft02.MediaTypes.OPERATION + RestconfService.XML, MediaType.APPLICATION_XML, MediaType.TEXT_XML })
+        Draft02.MediaTypes.OPERATION + RestconfService.XML, MediaType.APPLICATION_XML, MediaType.TEXT_XML })
 public enum StructuredDataToXmlProvider implements MessageBodyWriter<StructuredData> {
     INSTANCE;
 
@@ -51,7 +54,7 @@ public enum StructuredDataToXmlProvider implements MessageBodyWriter<StructuredD
             final Transformer ret;
             try {
                 ret = FACTORY.newTransformer();
-            } catch (TransformerConfigurationException e) {
+            } catch (final TransformerConfigurationException e) {
                 LOG.error("Failed to instantiate XML transformer", e);
                 throw new IllegalStateException("XML encoding currently unavailable", e);
             }
@@ -67,20 +70,23 @@ public enum StructuredDataToXmlProvider implements MessageBodyWriter<StructuredD
     };
 
     @Override
-    public boolean isWriteable(final Class<?> type, final Type genericType, final Annotation[] annotations, final MediaType mediaType) {
+    public boolean isWriteable(final Class<?> type, final Type genericType, final Annotation[] annotations,
+            final MediaType mediaType) {
         return type.equals(StructuredData.class);
     }
 
     @Override
-    public long getSize(final StructuredData t, final Class<?> type, final Type genericType, final Annotation[] annotations, final MediaType mediaType) {
+    public long getSize(final StructuredData t, final Class<?> type, final Type genericType,
+            final Annotation[] annotations, final MediaType mediaType) {
         return -1;
     }
 
     @Override
-    public void writeTo(final StructuredData t, final Class<?> type, final Type genericType, final Annotation[] annotations,
-            final MediaType mediaType, final MultivaluedMap<String, Object> httpHeaders, final OutputStream entityStream)
-                    throws IOException, WebApplicationException {
-        CompositeNode data = t.getData();
+    public void writeTo(final StructuredData t, final Class<?> type, final Type genericType,
+            final Annotation[] annotations, final MediaType mediaType,
+            final MultivaluedMap<String, Object> httpHeaders, final OutputStream entityStream) throws IOException,
+            WebApplicationException {
+        final CompositeNode data = t.getData();
         if (data == null) {
             throw new RestconfDocumentedException(Response.Status.NOT_FOUND);
         }
@@ -93,19 +99,17 @@ public enum StructuredDataToXmlProvider implements MessageBodyWriter<StructuredD
             } else {
                 trans.setOutputProperty(OutputKeys.INDENT, "no");
             }
-        } catch (RuntimeException e) {
-            throw new RestconfDocumentedException(e.getMessage(), ErrorType.TRANSPORT,
-                    ErrorTag.OPERATION_FAILED);
+        } catch (final RuntimeException e) {
+            throw new RestconfDocumentedException(e.getMessage(), ErrorType.TRANSPORT, ErrorTag.OPERATION_FAILED);
         }
 
         // FIXME: BUG-1281: eliminate the intermediate Document
         final Document domTree = new XmlMapper().write(data, (DataNodeContainer) t.getSchema());
         try {
             trans.transform(new DOMSource(domTree), new StreamResult(entityStream));
-        } catch (TransformerException e) {
+        } catch (final TransformerException e) {
             LOG.error("Error during translation of Document to OutputStream", e);
-            throw new RestconfDocumentedException(e.getMessage(), ErrorType.TRANSPORT,
-                    ErrorTag.OPERATION_FAILED);
+            throw new RestconfDocumentedException(e.getMessage(), ErrorType.TRANSPORT, ErrorTag.OPERATION_FAILED);
         }
     }