use of io.atlasmap.xml.v2.InspectionType in project atlasmap by atlasmap.
the class XmlService method getClass.
@GET
@Path("/inspect")
@Produces(MediaType.APPLICATION_JSON)
public Response getClass(@QueryParam("uri") String uri, @QueryParam("type") String type) {
XmlDocument d = null;
try {
if (type == null) {
throw new Exception("uri and type parameters must be specified");
}
InspectionType inspectType = InspectionType.valueOf(type);
XmlInspectionService s = new XmlInspectionService();
switch(inspectType) {
case INSTANCE:
d = s.inspectXmlDocument(new File(uri));
break;
case SCHEMA:
d = s.inspectSchema(new File(uri));
break;
default:
throw new Exception("Unknown type specified: " + type);
}
} catch (Exception e) {
LOG.error("Error inspecting xml: " + e.getMessage(), e);
}
return Response.ok().entity(toJson(d)).build();
}
Aggregations