Package org.apache.camel.xml.jaxb
Class JaxbHelper
java.lang.Object
org.apache.camel.xml.jaxb.JaxbHelper
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
applyNamespaces
(org.apache.camel.model.RouteConfigurationDefinition config, Map<String, String> namespaces) static void
applyNamespaces
(org.apache.camel.model.RouteDefinition route, Map<String, String> namespaces) static void
extractNamespaces
(org.apache.camel.model.RouteDefinition route, Map<String, String> namespaces) Extract all XML namespaces from the expressions in the routestatic void
extractNamespaces
(Document document, Map<String, String> namespaces) Extract all XML namespaces from the root element in a DOM Documentstatic void
extractSourceLocations
(org.apache.camel.model.RouteDefinition route, Map<String, org.apache.camel.util.KeyValueHolder<Integer, String>> locations) Extract all source locations from the routestatic jakarta.xml.bind.JAXBContext
getJAXBContext
(org.apache.camel.CamelContext context) static org.apache.camel.spi.NamespaceAware
getNamespaceAwareFromExpression
(org.apache.camel.model.ExpressionNode expressionNode) static org.apache.camel.model.rest.RestsDefinition
loadRestsDefinition
(org.apache.camel.CamelContext context, InputStream inputStream) static org.apache.camel.model.RouteConfigurationsDefinition
loadRouteConfigurationsDefinition
(org.apache.camel.CamelContext context, InputStream inputStream) static org.apache.camel.model.RoutesDefinition
loadRoutesDefinition
(org.apache.camel.CamelContext context, InputStream inputStream) static org.apache.camel.model.RouteTemplatesDefinition
loadRouteTemplatesDefinition
(org.apache.camel.CamelContext context, InputStream inputStream) static org.apache.camel.model.TemplatedRoutesDefinition
loadTemplatedRoutesDefinition
(org.apache.camel.CamelContext context, InputStream inputStream) Un-marshals the content of the input stream to an instance ofTemplatedRoutesDefinition
.static <T extends org.apache.camel.NamedNode>
TmodelToXml
(org.apache.camel.CamelContext context, String xml, Class<T> type) static org.apache.camel.converter.jaxp.XmlConverter
newXmlConverter
(org.apache.camel.CamelContext context) Creates a newXmlConverter
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
-
Method Details
-
getJAXBContext
public static jakarta.xml.bind.JAXBContext getJAXBContext(org.apache.camel.CamelContext context) throws Exception - Throws:
Exception
-
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 routenamespaces
- 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 routelocations
- 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 newXmlConverter
- Parameters:
context
- CamelContext if provided- Returns:
- a new XmlConverter instance
-
extractNamespaces
Extract all XML namespaces from the root element in a DOM Document- Parameters:
document
- the DOM documentnamespaces
- the map of namespaces to add new found XML namespaces
-
applyNamespaces
-
applyNamespaces
-
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
-
loadRouteConfigurationsDefinition
public static org.apache.camel.model.RouteConfigurationsDefinition loadRouteConfigurationsDefinition(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 ofTemplatedRoutesDefinition
.- Parameters:
context
- the Camel context from which the JAXBContext is extractedinputStream
- 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
-