List of usage examples for org.apache.ibatis.parsing XNode getStringAttribute
public String getStringAttribute(String name)
From source file:com.ibatis.sqlmap.engine.builder.XmlSqlMapConfigParser.java
License:Apache License
@NodeEvent("/sqlMapConfig/transactionManager/property") public void sqlMapConfigtransactionManagerproperty(XNode context) throws Exception { String name = context.getStringAttribute("name"); String value = context.getStringAttribute("value"); transactionManagerProps.setProperty(name, value); }
From source file:com.ibatis.sqlmap.engine.builder.XmlSqlMapConfigParser.java
License:Apache License
@NodeEvent("/sqlMapConfig/transactionManager/dataSource/property") public void sqlMapConfigtransactionManagerdataSourceproperty(XNode context) throws Exception { String name = context.getStringAttribute("name"); String value = context.getStringAttribute("value"); dataSourceProps.setProperty(name, value); }
From source file:com.ibatis.sqlmap.engine.builder.XmlSqlMapConfigParser.java
License:Apache License
@NodeEvent("/sqlMapConfig/transactionManager/dataSource/end()") public void sqlMapConfigtransactionManagerdataSourceend(XNode context) throws Exception { String type = context.getStringAttribute("type"); Class dataSourceClass = config.getTypeAliasRegistry().resolveAlias(type); DataSourceFactory dsFactory = (DataSourceFactory) dataSourceClass.newInstance(); dsFactory.initialize(dataSourceProps); config.setDataSource(dsFactory.getDataSource()); }
From source file:com.ibatis.sqlmap.engine.builder.XmlSqlMapConfigParser.java
License:Apache License
@NodeEvent("/sqlMapConfig/resultObjectFactory") public void sqlMapConfigresultObjectFactory(XNode context) throws Exception { String type = context.getStringAttribute("type"); Class factoryClass = Class.forName(type); ObjectFactory factory = (ObjectFactory) factoryClass.newInstance(); Properties props = context.getChildrenAsProperties(); factory.setProperties(props);/* w w w .ja va2s. c o m*/ config.setObjectFactory(factory); }
From source file:com.ibatis.sqlmap.engine.builder.XmlSqlMapConfigParser.java
License:Apache License
@NodeEvent("/sqlMapConfig/sqlMap") public void sqlMapConfigsqlMap(XNode context) throws Exception { String resource = context.getStringAttribute("resource"); String url = context.getStringAttribute("url"); Reader reader = null;/*www. j a v a 2 s . c o m*/ if (resource != null) { reader = Resources.getResourceAsReader(resource); } else if (url != null) { reader = Resources.getUrlAsReader(url); } else { throw new SqlMapException("The sqlMap element requires either a resource or a url attribute."); } new XmlSqlMapParser(this, reader).parse(); }
From source file:com.ibatis.sqlmap.engine.builder.XmlSqlMapParser.java
License:Apache License
@NodeEvent("/sqlMap") public void sqlMap(XNode context) throws Exception { this.namespace = context.getStringAttribute("namespace"); }
From source file:com.ibatis.sqlmap.engine.builder.XmlSqlMapParser.java
License:Apache License
@NodeEvent("/sqlMap/typeAlias") public void sqlMaptypeAlias(XNode context) throws Exception { String alias = context.getStringAttribute("alias"); String type = context.getStringAttribute("type"); config.getTypeAliasRegistry().registerAlias(alias, type); }
From source file:com.ibatis.sqlmap.engine.builder.XmlSqlMapParser.java
License:Apache License
@NodeEvent("/sqlMap/cacheModel") public void sqlMapcacheModel(XNode context) throws Exception { String id = applyNamespace(context.getStringAttribute("id")); String type = context.getStringAttribute("type"); Boolean readOnly = context.getBooleanAttribute("readOnly", true); Boolean serialize = context.getBooleanAttribute("serialize", true); Class clazz = config.getTypeAliasRegistry().resolveAlias(type); cacheBuilder = new CacheBuilder(id); cacheBuilder.addDecorator(clazz);/*from www . j a v a 2s . c om*/ //LOCAL_READ_WRITE (serializable=false, readOnly=false) //SHARED_READ_ONLY (serializable=false, readOnly=true) //SHARED_READ_WRITE (serializable=true, readOnly=false) if (serialize) { if (readOnly) { cacheBuilder.readWrite(false); } else { cacheBuilder.readWrite(true); } } else { if (readOnly) { cacheBuilder.readWrite(false); } else { cacheBuilder = null; } } }
From source file:com.ibatis.sqlmap.engine.builder.XmlSqlMapParser.java
License:Apache License
@NodeEvent("/sqlMap/cacheModel/property") public void sqlMapcacheModelproperty(XNode context) throws Exception { if (cacheBuilder != null) { String name = context.getStringAttribute("name"); String value = context.getStringAttribute("value"); if ("size".equals(name)) { cacheBuilder.size(Integer.parseInt(value)); }//from w ww. ja v a2s . c o m } }
From source file:com.ibatis.sqlmap.engine.builder.XmlSqlMapParser.java
License:Apache License
@NodeEvent("/sqlMap/cacheModel/flushOnExecute") public void sqlMapcacheModelflushOnExecute(XNode context) throws Exception { if (cacheBuilder != null) { String statement = context.getStringAttribute("statement"); flushCacheStatements.add(statement); }// ww w . java2 s .co m }