From: Tony Tkacik Date: Mon, 15 Dec 2014 07:51:25 +0000 (+0000) Subject: Merge "Mark DomBrokerImplModule.createLegacyDataService() as deprecated" X-Git-Tag: release/lithium~771 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=5834d6db8a5b2f56ec469ceafd899a94a69f7b91;hp=a5b8ee5326c6ad9c601c4107246ca8b59212912c Merge "Mark DomBrokerImplModule.createLegacyDataService() as deprecated" --- diff --git a/opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/InMemoryDOMDataStore.java b/opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/InMemoryDOMDataStore.java index 85134f1fd4..deddd6938a 100644 --- a/opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/InMemoryDOMDataStore.java +++ b/opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/InMemoryDOMDataStore.java @@ -244,7 +244,7 @@ public class InMemoryDOMDataStore extends TransactionReadyPrototype implements D // For debugging purposes, allow dumping of the modification. Coupled with the above // precondition log, it should allow us to understand what went on. - LOG.trace("Store Tx: {} modifications: {}", modification); + LOG.trace("Store Tx: {} modifications: {} tree: {}", modification, dataTree); return Futures.immediateFailedFuture(new TransactionCommitFailedException("Data did not pass validation.", e)); } catch (Exception e) { diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/RestconfDocumentedExceptionMapper.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/RestconfDocumentedExceptionMapper.java index 10201ab6f5..d564d4cbd4 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/RestconfDocumentedExceptionMapper.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/RestconfDocumentedExceptionMapper.java @@ -16,7 +16,6 @@ import static org.opendaylight.controller.sal.rest.api.Draft02.RestConfModule.ER import static org.opendaylight.controller.sal.rest.api.Draft02.RestConfModule.ERROR_TAG_QNAME; import static org.opendaylight.controller.sal.rest.api.Draft02.RestConfModule.ERROR_TYPE_QNAME; import static org.opendaylight.controller.sal.rest.api.Draft02.RestConfModule.NAMESPACE; - import com.google.common.base.Charsets; import com.google.common.base.Strings; import com.google.common.collect.ImmutableList; @@ -69,6 +68,7 @@ import org.xml.sax.InputSource; public class RestconfDocumentedExceptionMapper implements ExceptionMapper { private final static Logger LOG = LoggerFactory.getLogger(RestconfDocumentedExceptionMapper.class); + private static final TransformerFactory TRANSFORMER_FACTORY = TransformerFactory.newInstance(); @Context private HttpHeaders headers; @@ -178,8 +178,7 @@ public class RestconfDocumentedExceptionMapper implements ExceptionMapper namespaceURI) { + public static Element createElement(final Document document, final String qName, final Optional namespaceURI) { if(namespaceURI.isPresent()) { final Element element = document.createElementNS(namespaceURI.get(), qName); String name = XMLNS_ATTRIBUTE_KEY; @@ -112,20 +116,20 @@ public final class XmlUtil { return document.createElement(qName); } - public static Element createTextElement(Document document, String qName, String content, Optional namespaceURI) { + public static Element createTextElement(final Document document, final String qName, final String content, final Optional namespaceURI) { Element typeElement = createElement(document, qName, namespaceURI); typeElement.appendChild(document.createTextNode(content)); return typeElement; } - public static Element createTextElementWithNamespacedContent(Document document, String qName, String prefix, - String namespace, String contentWithoutPrefix) { + public static Element createTextElementWithNamespacedContent(final Document document, final String qName, final String prefix, + final String namespace, final String contentWithoutPrefix) { return createTextElementWithNamespacedContent(document, qName, prefix, namespace, contentWithoutPrefix, Optional.absent()); } - public static Element createTextElementWithNamespacedContent(Document document, String qName, String prefix, - String namespace, String contentWithoutPrefix, Optional namespaceURI) { + public static Element createTextElementWithNamespacedContent(final Document document, final String qName, final String prefix, + final String namespace, final String contentWithoutPrefix, final Optional namespaceURI) { String content = createPrefixedValue(XmlNetconfConstants.PREFIX, contentWithoutPrefix); Element element = createTextElement(document, qName, content, namespaceURI); @@ -134,25 +138,25 @@ public final class XmlUtil { return element; } - public static String createPrefixedValue(String prefix, String value) { + public static String createPrefixedValue(final String prefix, final String value) { return prefix + ":" + value; } - public static String toString(Document document) { + public static String toString(final Document document) { return toString(document.getDocumentElement()); } - public static String toString(Element xml) { + public static String toString(final Element xml) { return toString(xml, false); } - public static String toString(XmlElement xmlElement) { + public static String toString(final XmlElement xmlElement) { return toString(xmlElement.getDomElement(), false); } - public static String toString(Element xml, boolean addXmlDeclaration) { + public static String toString(final Element xml, final boolean addXmlDeclaration) { try { - Transformer transformer = TransformerFactory.newInstance().newTransformer(); + Transformer transformer = TRANSFORMER_FACTORY.newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, addXmlDeclaration ? "no" : "yes"); @@ -166,26 +170,25 @@ public final class XmlUtil { } } - public static String toString(Document doc, boolean addXmlDeclaration) { + public static String toString(final Document doc, final boolean addXmlDeclaration) { return toString(doc.getDocumentElement(), addXmlDeclaration); } - public static Schema loadSchema(InputStream... fromStreams) { + public static Schema loadSchema(final InputStream... fromStreams) { Source[] sources = new Source[fromStreams.length]; int i = 0; for (InputStream stream : fromStreams) { sources[i++] = new StreamSource(stream); } - final SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); try { - return schemaFactory.newSchema(sources); + return SCHEMA_FACTORY.newSchema(sources); } catch (SAXException e) { throw new IllegalStateException("Failed to instantiate XML schema", e); } } - public static Object evaluateXPath(XPathExpression expr, Object rootNode, QName returnType) { + public static Object evaluateXPath(final XPathExpression expr, final Object rootNode, final QName returnType) { try { return expr.evaluate(rootNode, returnType); } catch (XPathExpressionException e) { @@ -193,7 +196,7 @@ public final class XmlUtil { } } - public static Document createDocumentCopy(Document original) { + public static Document createDocumentCopy(final Document original) { final Document copiedDocument = newDocument(); final Node copiedRoot = copiedDocument.importNode(original.getDocumentElement(), true); copiedDocument.appendChild(copiedRoot);