} else { boolean unique = !indexInfo.getBoolean("NON_UNIQUE"); index = new Index(typeName, indexName, unique, columnName); indexes.put(indexName, index);
private SimpleFeatureStore getTargetFeatureStore( SimpleFeatureType sourceSchema, DataStore targetStore, String coverage) throws IOException { // do we have to create it? List<String> existingTypeNames = Arrays.asList(targetStore.getTypeNames()); if (!existingTypeNames.contains(coverage)) { synchronized (coverage) { existingTypeNames = Arrays.asList(targetStore.getTypeNames()); if (!existingTypeNames.contains(coverage)) { final SimpleFeatureType schema = buildTargetSchema(sourceSchema); targetStore.createSchema(schema); // create indexes if we can if (targetStore instanceof JDBCDataStore) { ((JDBCDataStore) targetStore) .createIndex( new Index( schema.getTypeName(), schema.getTypeName() + "_loc_idx", true, "location", CoverageSlicesCatalog.IMAGE_INDEX_ATTR)); } } } } // TODO: handle Oracle casing issue? return (SimpleFeatureStore) targetStore.getFeatureSource(coverage); }
new Index( ft1TypeName, indexName,
Index stringIndex = new Index(ft1TypeName, indexName, false, aname("stringProperty")); dataStore.createIndex(stringIndex);
private void initialize(Map<String, Object> manualParameters) throws DaoException { try { PostGISVersionChecker versionChecker = new PostGISVersionChecker(); versionChecker.verifyVersion(manualParameters); store = (JDBCDataStore)DataStoreFinder.getDataStore(manualParameters); if (needsToBeInitialized()){ // needs to be initialized LOG.info("Initializing spatial database tables"); try { SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder(); builder.setName(SPATIAL_DB_NAME); builder.add(ITEM_ID_FIELD_NAME, Integer.class); builder.add(LAYER_FIELD_NAME, String.class); builder.add(REF_SYS_FIELD_NAME, String.class); builder.add(GEOM_FIELD_NAME, Geometry.class); SimpleFeatureType featureType = builder.buildFeatureType(); store.createSchema(featureType); // note: gist index is created automatically above Index regIndex = new Index(SPATIAL_DB_NAME, "rs_layer_type", true, ITEM_ID_FIELD_NAME,LAYER_FIELD_NAME,REF_SYS_FIELD_NAME); Index itemIdIndex = new Index(SPATIAL_DB_NAME, "geometries_item_id", false, ITEM_ID_FIELD_NAME); store.createIndex(itemIdIndex); }catch(Exception e){ throw new DaoException(e); } }else{ LOG.info("Spatial database tables have already been initialized"); } }catch(Exception e){ throw new DaoException(e); } }
private void initialize(Map<String, Object> manualParameters) throws DaoException { try { PostGISVersionChecker versionChecker = new PostGISVersionChecker(); versionChecker.verifyVersion(manualParameters); store = (JDBCDataStore)DataStoreFinder.getDataStore(manualParameters); if (needsToBeInitialized()){ // needs to be initialized LOG.info("Initializing spatial database tables"); try { SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder(); builder.setName(SPATIAL_DB_NAME); builder.add(ITEM_ID_FIELD_NAME, Integer.class); builder.add(LAYER_FIELD_NAME, String.class); builder.add(REF_SYS_FIELD_NAME, String.class); builder.add(GEOM_FIELD_NAME, Geometry.class); SimpleFeatureType featureType = builder.buildFeatureType(); store.createSchema(featureType); // note: gist index is created automatically above Index regIndex = new Index(SPATIAL_DB_NAME, "rs_layer_type", true, ITEM_ID_FIELD_NAME,LAYER_FIELD_NAME,REF_SYS_FIELD_NAME); Index itemIdIndex = new Index(SPATIAL_DB_NAME, "geometries_item_id", false, ITEM_ID_FIELD_NAME); store.createIndex(itemIdIndex); }catch(Exception e){ throw new DaoException(e); } }else{ LOG.info("Spatial database tables have already been initialized"); } }catch(Exception e){ throw new DaoException(e); } }