Author: cbegin Date: Sat Aug 15 04:45:24 2009 New Revision: 804433 URL: http://svn.apache.org/viewvc?rev=804433&view=rev Log: JIRA-625 Mapper interfaces cannot have the class name as the XML file mapped to them. -- Fixed.
Modified: ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/builder/annotation/MapperAnnotationBuilder.java ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/builder/xml/XMLMapperBuilder.java ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/mapping/Configuration.java ibatis/trunk/java/ibatis-3/version.properties Modified: ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/builder/annotation/MapperAnnotationBuilder.java URL: http://svn.apache.org/viewvc/ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/builder/annotation/MapperAnnotationBuilder.java?rev=804433&r1=804432&r2=804433&view=diff ============================================================================== --- ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/builder/annotation/MapperAnnotationBuilder.java (original) +++ ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/builder/annotation/MapperAnnotationBuilder.java Sat Aug 15 04:45:24 2009 @@ -16,24 +16,30 @@ public class MapperAnnotationBuilder { + private Configuration configuration; private MapperBuilderAssistant assistant; private Class type; - public MapperAnnotationBuilder(Configuration config, Class type) { + public MapperAnnotationBuilder(Configuration configuration, Class type) { String resource = type.getName().replace('.', '/') + ".java (best guess)"; - this.assistant = new MapperBuilderAssistant(config, resource); + this.assistant = new MapperBuilderAssistant(configuration, resource); + this.configuration = configuration; this.type = type; } public void parse() { - loadXmlResource(); - assistant.setCurrentNamespace(type.getName()); - parseCache(); - parseCacheRef(); - Method[] methods = type.getMethods(); - for (Method method : methods) { - parseResultsAndConstructorArgs(method); - parseStatement(method); + String resource = type.toString(); + if (!configuration.isResourceLoaded(resource)) { + configuration.addLoadedResource(resource); + loadXmlResource(); + assistant.setCurrentNamespace(type.getName()); + parseCache(); + parseCacheRef(); + Method[] methods = type.getMethods(); + for (Method method : methods) { + parseResultsAndConstructorArgs(method); + parseStatement(method); + } } } Modified: ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/builder/xml/XMLMapperBuilder.java URL: http://svn.apache.org/viewvc/ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/builder/xml/XMLMapperBuilder.java?rev=804433&r1=804432&r2=804433&view=diff ============================================================================== --- ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/builder/xml/XMLMapperBuilder.java (original) +++ ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/builder/xml/XMLMapperBuilder.java Sat Aug 15 04:45:24 2009 @@ -14,6 +14,7 @@ private XPathParser parser; private MapperBuilderAssistant builderAssistant; private Map<String, XNode> sqlFragments; + private String resource; public XMLMapperBuilder(Reader reader, Configuration configuration, String resource, Map<String, XNode> sqlFragments, String namespace) { this(reader, configuration, resource,sqlFragments); @@ -25,11 +26,15 @@ this.builderAssistant = new MapperBuilderAssistant(configuration, resource); this.parser = new XPathParser(reader, true, new XMLMapperEntityResolver(), configuration.getVariables()); this.sqlFragments = sqlFragments; + this.resource = resource; } public void parse() { - configurationElement(parser.evalNode("/mapper")); - bindMapperForNamespace(); + if (!configuration.isResourceLoaded(resource)) { + configuration.addLoadedResource(resource); + configurationElement(parser.evalNode("/mapper")); + bindMapperForNamespace(); + } } public XNode getSqlFragment(String refid) { Modified: ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/mapping/Configuration.java URL: http://svn.apache.org/viewvc/ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/mapping/Configuration.java?rev=804433&r1=804432&r2=804433&view=diff ============================================================================== --- ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/mapping/Configuration.java (original) +++ ibatis/trunk/java/ibatis-3/ibatis-3-core/src/main/java/org/apache/ibatis/mapping/Configuration.java Sat Aug 15 04:45:24 2009 @@ -50,6 +50,8 @@ private final Map<String, ParameterMap> parameterMaps = new StrictMap<String, ParameterMap>("Parameter Maps collection"); private final Map<String, KeyGenerator> keyGenerators = new StrictMap<String, KeyGenerator>("Key Generators collection"); + private final Set<String> loadedResources = new HashSet<String>(); + public Configuration(Environment environment) { this(); this.environment = environment; @@ -69,6 +71,14 @@ typeAliasRegistry.registerAlias("WEAK", WeakCache.class.getName()); } + public void addLoadedResource(String resource) { + loadedResources.add(resource); + } + + public boolean isResourceLoaded(String resource) { + return loadedResources.contains(resource); + } + public Environment getEnvironment() { return environment; } Modified: ibatis/trunk/java/ibatis-3/version.properties URL: http://svn.apache.org/viewvc/ibatis/trunk/java/ibatis-3/version.properties?rev=804433&r1=804432&r2=804433&view=diff ============================================================================== --- ibatis/trunk/java/ibatis-3/version.properties (original) +++ ibatis/trunk/java/ibatis-3/version.properties Sat Aug 15 04:45:24 2009 @@ -1,5 +1,5 @@ #Build version info -#Wed Aug 12 21:42:50 MDT 2009 +#Fri Aug 14 21:57:15 MDT 2009 version=3.0.0 -buildDate=2009/08/12 21\:42 -buildNum=193 +buildDate=2009/08/14 21\:57 +buildNum=195