protected static MappingScript getMapping(XMLSchema source, XMLSchema target, String url) throws IOException { MappingScript mapping = new XMLMappingReader(new MappingFactoryImpl(ModelUtils.getRegistry())) .parse(new InputSource(url)); mapping.setSource(source); mapping.setTarget(target); new MappingResolver(ModelUtils.getRegistry()).resolveTemplate(mapping); return mapping; }
protected static MappingScript getEmptyMapping( XMLSchema source, XMLSchema target, String newMapID) throws IOException { MappingScript mapping; if (newMapID != null) mapping = new MappingModelImpl(newMapID, source, target); else { newMapID = "http://" + source.getID() + target.getID() + UUID.randomUUID().toString(); // Not incremental but semi-random... mapping = new MappingModelImpl(newMapID, source, target); } mapping.setSource(source); mapping.setTarget(target); new MappingResolver(ModelUtils.getRegistry()).resolveTemplate(mapping); return mapping; }