Revision 46126

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/impl/DefaultDatabaseWorkspaceManager.java
276 276
        }
277 277
    }
278 278
    
279
    @Override
279 280
    public void createTableResources(String tableName) throws RuntimeException {
280 281
        // H2Spatial crea esta table a mano. 
281 282
        // Si tocamos algo aqu? hay que modificar 
......
304 305
        createTableResources(TABLE_RESOURCES_NAME);
305 306
    }
306 307
    
308
    @Override
307 309
    public void createTableRepository(String tableName) throws RuntimeException {
308 310
        DataServerExplorer server = null;
309 311
        try {
......
337 339
        // la creacion de esta tabla en el helper de H2
338 340
        String tableName = TABLE_CONFIGURATION_NAME;
339 341
        DataServerExplorer server = null;
342
        FeatureStore store = null;
340 343
        try {
341 344
            server = this.getServerExplorer();
342 345
            NewFeatureStoreParameters params = (NewFeatureStoreParameters) server.getAddParameters(tableName);
......
347 350
            ft.add(FIELD_CONFIGURATION_VALUE, DataTypes.STRING, 10240)
348 351
                    .setAllowNull(true);
349 352
            server.add(tableName, params, false);
353
            
354
            DataStoreParameters openParams = server.get(TABLE_CONFIGURATION_NAME);
355
            store = (FeatureStore) DALLocator.getDataManager().openStore(
356
                    openParams.getProviderName(), openParams
357
            );
358
            store.edit();
359
            EditableFeature efeature = store.createNewFeature();
360
            efeature.set(FIELD_CONFIGURATION_NAME, CONFIG_NAME_ALTERNATIVE_RESOURCES_PATH);
361
            efeature.set(FIELD_CONFIGURATION_VALUE, null);
362
            store.insert(efeature);
363
            store.finishEditing();                    
364
                    
350 365
            this.existsConfiguration = null;
351 366
        } catch (Exception ex) {
352 367
            LOGGER.warn("Can't create table '"+tableName+"'.",ex);
368
            FeatureStore.cancelEditingQuietly(store);
353 369
        } finally {
354 370
            DisposeUtils.disposeQuietly(server);
371
            DisposeUtils.disposeQuietly(store);
355 372
        }
356 373
    }
357 374
    

Also available in: Unified diff