29
29
import org .apache .ibatis .builder .xml .XMLConfigBuilder ;
30
30
import org .apache .ibatis .builder .xml .XMLMapperBuilder ;
31
31
import org .apache .ibatis .executor .ErrorContext ;
32
+ import org .apache .ibatis .io .VFS ;
32
33
import org .apache .ibatis .logging .Log ;
33
34
import org .apache .ibatis .logging .LogFactory ;
34
35
import org .apache .ibatis .mapping .DatabaseIdProvider ;
64
65
* @author Putthibong Boonbong
65
66
* @author Hunter Presnall
66
67
* @author Eduardo Macarron
67
- *
68
+ * @author Eddú Meléndez
69
+ *
68
70
* @see #setConfigLocation
69
71
* @see #setDataSource
70
72
* @version $Id$
@@ -107,13 +109,15 @@ public class SqlSessionFactoryBean implements FactoryBean<SqlSessionFactory>, In
107
109
//issue #19. No default provider.
108
110
private DatabaseIdProvider databaseIdProvider ;
109
111
112
+ private Class <? extends VFS > vfs ;
113
+
110
114
private ObjectFactory objectFactory ;
111
115
112
116
private ObjectWrapperFactory objectWrapperFactory ;
113
117
114
118
/**
115
119
* Sets the ObjectFactory.
116
- *
120
+ *
117
121
* @since 1.1.2
118
122
* @param objectFactory
119
123
*/
@@ -123,7 +127,7 @@ public void setObjectFactory(ObjectFactory objectFactory) {
123
127
124
128
/**
125
129
* Sets the ObjectWrapperFactory.
126
- *
130
+ *
127
131
* @since 1.1.2
128
132
* @param objectWrapperFactory
129
133
*/
@@ -143,7 +147,7 @@ public DatabaseIdProvider getDatabaseIdProvider() {
143
147
144
148
/**
145
149
* Sets the DatabaseIdProvider.
146
- * As of version 1.2.2 this variable is not initialized by default.
150
+ * As of version 1.2.2 this variable is not initialized by default.
147
151
*
148
152
* @since 1.1.0
149
153
* @param databaseIdProvider
@@ -152,6 +156,14 @@ public void setDatabaseIdProvider(DatabaseIdProvider databaseIdProvider) {
152
156
this .databaseIdProvider = databaseIdProvider ;
153
157
}
154
158
159
+ public Class <? extends VFS > getVfs () {
160
+ return this .vfs ;
161
+ }
162
+
163
+ public void setVfs (Class <? extends VFS > vfs ) {
164
+ this .vfs = vfs ;
165
+ }
166
+
155
167
/**
156
168
* Mybatis plugin list.
157
169
*
@@ -425,15 +437,19 @@ protected SqlSessionFactory buildSqlSessionFactory() throws IOException {
425
437
}
426
438
}
427
439
}
428
-
440
+
429
441
if (this .databaseIdProvider != null ) {//fix #64 set databaseId before parse mapper xmls
430
442
try {
431
443
configuration .setDatabaseId (this .databaseIdProvider .getDatabaseId (this .dataSource ));
432
444
} catch (SQLException e ) {
433
445
throw new NestedIOException ("Failed getting a databaseId" , e );
434
446
}
435
447
}
436
-
448
+
449
+ if (this .vfs != null ) {
450
+ configuration .setVfsImpl (this .vfs );
451
+ }
452
+
437
453
if (xmlConfigBuilder != null ) {
438
454
try {
439
455
xmlConfigBuilder .parse ();
0 commit comments