List of usage examples for org.apache.ibatis.parsing XPathParser XPathParser
public XPathParser(Document document, boolean validation, Properties variables, EntityResolver entityResolver)
From source file:cc.oit.dao.impl.mybatis.session.XMLConfigBuilder.java
License:Apache License
public XMLConfigBuilder(Reader reader, String environment, Properties props) { this(new XPathParser(reader, true, props, new XMLMapperEntityResolver()), environment, props); }
From source file:cc.oit.dao.impl.mybatis.session.XMLConfigBuilder.java
License:Apache License
public XMLConfigBuilder(InputStream inputStream, String environment, Properties props) { this(new XPathParser(inputStream, true, props, new XMLMapperEntityResolver()), environment, props); }
From source file:com.baomidou.mybatisplus.MybatisXMLConfigBuilder.java
License:Apache License
public MybatisXMLConfigBuilder(Reader reader, String environment, Properties props) { this(new XPathParser(reader, true, props, new XMLMapperEntityResolver()), environment, props); }
From source file:com.baomidou.mybatisplus.MybatisXMLConfigBuilder.java
License:Apache License
public MybatisXMLConfigBuilder(InputStream inputStream, String environment, Properties props) { this(new XPathParser(inputStream, true, props, new XMLMapperEntityResolver()), environment, props); }
From source file:com.baomidou.mybatisplus.MybatisXMLMapperBuilder.java
License:Apache License
@Deprecated public MybatisXMLMapperBuilder(Reader reader, Configuration configuration, String resource, Map<String, XNode> sqlFragments) { this(new XPathParser(reader, true, configuration.getVariables(), new XMLMapperEntityResolver()), configuration, resource, sqlFragments); }
From source file:com.baomidou.mybatisplus.MybatisXMLMapperBuilder.java
License:Apache License
public MybatisXMLMapperBuilder(InputStream inputStream, Configuration configuration, String resource, Map<String, XNode> sqlFragments) { this(new XPathParser(inputStream, true, configuration.getVariables(), new XMLMapperEntityResolver()), configuration, resource, sqlFragments); }
From source file:com.baomidou.mybatisplus.spring.MybatisMapperRefresh.java
License:Apache License
/** * mapper// ww w . jav a2s . com * * @throws Exception */ @SuppressWarnings("rawtypes") private void refresh(Resource resource) throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException { this.configuration = sqlSessionFactory.getConfiguration(); boolean isSupper = configuration.getClass().getSuperclass() == Configuration.class; try { Field loadedResourcesField = isSupper ? configuration.getClass().getSuperclass().getDeclaredField("loadedResources") : configuration.getClass().getDeclaredField("loadedResources"); loadedResourcesField.setAccessible(true); Set loadedResourcesSet = ((Set) loadedResourcesField.get(configuration)); XPathParser xPathParser = new XPathParser(resource.getInputStream(), true, configuration.getVariables(), new XMLMapperEntityResolver()); XNode context = xPathParser.evalNode("/mapper"); String namespace = context.getStringAttribute("namespace"); Field field = MapperRegistry.class.getDeclaredField("knownMappers"); field.setAccessible(true); Map mapConfig = (Map) field.get(configuration.getMapperRegistry()); mapConfig.remove(Resources.classForName(namespace)); loadedResourcesSet.remove(resource.toString()); configuration.getCacheNames().remove(namespace); cleanParameterMap(context.evalNodes("/mapper/parameterMap"), namespace); cleanResultMap(context.evalNodes("/mapper/resultMap"), namespace); cleanKeyGenerators(context.evalNodes("insert|update"), namespace); cleanSqlElement(context.evalNodes("/mapper/sql"), namespace); XMLMapperBuilder xmlMapperBuilder = new XMLMapperBuilder(resource.getInputStream(), sqlSessionFactory.getConfiguration(), // sql?? resource.toString(), sqlSessionFactory.getConfiguration().getSqlFragments()); xmlMapperBuilder.parse(); logger.debug("refresh: '" + resource + "', success!"); } catch (IOException e) { logger.error("Refresh IOException :" + e.getMessage()); } finally { ErrorContext.instance().reset(); } }
From source file:com.dmm.framework.basedb.apache.ibatis.builder.xml.XMLMapperBuilder.java
License:Apache License
@Deprecated public XMLMapperBuilder(Reader reader, Configuration configuration, String resource, Map<String, XNode> sqlFragments) { this(new XPathParser(reader, true, configuration.getVariables(), new XMLMapperEntityResolver()), configuration, resource, sqlFragments); }
From source file:com.dmm.framework.basedb.apache.ibatis.builder.xml.XMLMapperBuilder.java
License:Apache License
public XMLMapperBuilder(InputStream inputStream, Configuration configuration, String resource, Map<String, XNode> sqlFragments) { this(new XPathParser(inputStream, true, configuration.getVariables(), new XMLMapperEntityResolver()), configuration, resource, sqlFragments); }
From source file:com.ibatis.common.util.NodeEventParser.java
License:Apache License
public void parse(Reader reader) throws ParsingException { try {//from w w w . j a va 2s . co m Document doc = createDocument(reader); xpathParser = new XPathParser(doc, validation, variables, entityResolver); parse(doc.getLastChild()); } catch (Exception e) { throw new ParsingException("Error parsing XML. Cause: " + e, e); } }