Class JaxbHelper


  • public final class JaxbHelper
    extends Object
    • Method Detail

      • extractNamespaces

        public static void extractNamespaces​(org.apache.camel.model.RouteDefinition route,
                                             Map<String,​String> namespaces)
        Extract all XML namespaces from the expressions in the route
        Parameters:
        route - the route
        namespaces - the map of namespaces to add discovered XML namespaces into
      • extractSourceLocations

        public static void extractSourceLocations​(org.apache.camel.model.RouteDefinition route,
                                                  Map<String,​org.apache.camel.util.KeyValueHolder<Integer,​String>> locations)
        Extract all source locations from the route
        Parameters:
        route - the route
        locations - the map of source locations for EIPs in the route
      • resolveEndpointDslUris

        public static void resolveEndpointDslUris​(org.apache.camel.model.RouteDefinition route)
        If the route has been built with endpoint-dsl, then the model will not have uri set which then cannot be included in the JAXB model dump
      • getNamespaceAwareFromExpression

        public static org.apache.camel.spi.NamespaceAware getNamespaceAwareFromExpression​(org.apache.camel.model.ExpressionNode expressionNode)
      • newXmlConverter

        public static org.apache.camel.converter.jaxp.XmlConverter newXmlConverter​(org.apache.camel.CamelContext context)
        Creates a new XmlConverter
        Parameters:
        context - CamelContext if provided
        Returns:
        a new XmlConverter instance
      • extractNamespaces

        public static void extractNamespaces​(Document document,
                                             Map<String,​String> namespaces)
        Extract all XML namespaces from the root element in a DOM Document
        Parameters:
        document - the DOM document
        namespaces - the map of namespaces to add new found XML namespaces
      • applyNamespaces

        public static void applyNamespaces​(org.apache.camel.model.RouteDefinition route,
                                           Map<String,​String> namespaces)
      • modelToXml

        public static <T extends org.apache.camel.NamedNode> T modelToXml​(org.apache.camel.CamelContext context,
                                                                          String xml,
                                                                          Class<T> type)
                                                                   throws Exception
        Throws:
        Exception
      • loadRoutesDefinition

        public static org.apache.camel.model.RoutesDefinition loadRoutesDefinition​(org.apache.camel.CamelContext context,
                                                                                   InputStream inputStream)
                                                                            throws Exception
        Throws:
        Exception
      • loadRouteTemplatesDefinition

        public static org.apache.camel.model.RouteTemplatesDefinition loadRouteTemplatesDefinition​(org.apache.camel.CamelContext context,
                                                                                                   InputStream inputStream)
                                                                                            throws Exception
        Throws:
        Exception
      • loadTemplatedRoutesDefinition

        public static org.apache.camel.model.TemplatedRoutesDefinition loadTemplatedRoutesDefinition​(org.apache.camel.CamelContext context,
                                                                                                     InputStream inputStream)
                                                                                              throws Exception
        Un-marshals the content of the input stream to an instance of TemplatedRoutesDefinition.
        Parameters:
        context - the Camel context from which the JAXBContext is extracted
        inputStream - the input stream to unmarshal
        Returns:
        the content unmarshalled as a TemplatedRoutesDefinition.
        Throws:
        Exception - if an exception occurs while unmarshalling
      • loadRestsDefinition

        public static org.apache.camel.model.rest.RestsDefinition loadRestsDefinition​(org.apache.camel.CamelContext context,
                                                                                      InputStream inputStream)
                                                                               throws Exception
        Throws:
        Exception