Package org.apache.camel.xml.jaxb
Class JaxbHelper
- java.lang.Object
-
- org.apache.camel.xml.jaxb.JaxbHelper
-
public final class JaxbHelper extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidapplyNamespaces(org.apache.camel.model.RouteDefinition route, Map<String,String> namespaces)static voidextractNamespaces(org.apache.camel.model.RouteDefinition route, Map<String,String> namespaces)Extract all XML namespaces from the expressions in the routestatic voidextractNamespaces(Document document, Map<String,String> namespaces)Extract all XML namespaces from the root element in a DOM Documentstatic voidextractSourceLocations(org.apache.camel.model.RouteDefinition route, Map<String,org.apache.camel.util.KeyValueHolder<Integer,String>> locations)Extract all source locations from the routestatic JAXBContextgetJAXBContext(org.apache.camel.CamelContext context)static org.apache.camel.spi.NamespaceAwaregetNamespaceAwareFromExpression(org.apache.camel.model.ExpressionNode expressionNode)static org.apache.camel.model.rest.RestsDefinitionloadRestsDefinition(org.apache.camel.CamelContext context, InputStream inputStream)static org.apache.camel.model.RoutesDefinitionloadRoutesDefinition(org.apache.camel.CamelContext context, InputStream inputStream)static org.apache.camel.model.RouteTemplatesDefinitionloadRouteTemplatesDefinition(org.apache.camel.CamelContext context, InputStream inputStream)static org.apache.camel.model.TemplatedRoutesDefinitionloadTemplatedRoutesDefinition(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.XmlConverternewXmlConverter(org.apache.camel.CamelContext context)Creates a newXmlConverterstatic voidresolveEndpointDslUris(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 Detail
-
getJAXBContext
public static 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
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 documentnamespaces- 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 ExceptionUn-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
-
-