Package org.geotools.data

Examples of org.geotools.data.DataStore


  }

  private void jButtonMysqlListLayersActionPerformed(ActionEvent evt) {
    try {
      jListMysqlLayers.removeAll();
      DataStore ds = this.getSelectedDataStore(jPanelMySQL.getName());
      String[] typeNames = ds.getTypeNames();
      final DefaultComboBoxModel model = new DefaultComboBoxModel(
          typeNames);
      jListMysqlLayers.setModel(model);
    } catch (Exception ex) {
      JOptionPane.showMessageDialog(this, ex.getMessage());
View Full Code Here


  }

  private void jButtonArcsdeListLayersActionPerformed(ActionEvent evt) {
    try {
      jListArcsdeLayers.removeAll();
      DataStore ds = this.getSelectedDataStore(jPanelArcSDE.getName());
      String[] typeNames = ds.getTypeNames();
      final DefaultComboBoxModel model = new DefaultComboBoxModel(
          typeNames);
      jListArcsdeLayers.setModel(model);
    } catch (Exception ex) {
      JOptionPane.showMessageDialog(this, ex.getMessage());
View Full Code Here

  }

  private void jButtonOracleListLayersActionPerformed(ActionEvent evt) {
    try {
      jListOracleLayers.removeAll();
      DataStore ds = this.getSelectedDataStore(jPanelOracle.getName());
      String[] typeNames = ds.getTypeNames();
      final DefaultComboBoxModel model = new DefaultComboBoxModel(
          typeNames);
      jListOracleLayers.setModel(model);
    } catch (Exception ex) {
      JOptionPane.showMessageDialog(this, ex.getMessage());
View Full Code Here

        logger.info(lc.toString());

        try {
            _applicationContext.getBean(DataStore.class);
        } catch (NoSuchBeanDefinitionException e) {
            DataStore dataStore = createShapefileDatastore(luceneDir);
            _applicationContext.getBeanFactory().registerSingleton("dataStore", dataStore);
            //--- no datastore for spatial indexing means that we can't continue
            if (dataStore == null) {
                throw new IllegalArgumentException("GeoTools datastore creation failed - check logs for more info/exceptions");
            }
View Full Code Here

            LOGGER.info("Source LayerUpdate found [" + layerName + ", " + year + "," + month + "]");

       
        boolean isVector = request.getFormat().equals(UNREDDFormat.VECTOR);
        DataStore srcDS=null,destDS=null;
        try {
          srcDS=PostGISUtils.createDatastore(conf.getSrcPostGisConfig());
          destDS=PostGISUtils.createDatastore(conf.getDstPostGisConfig());
         
          if (isVector) {
View Full Code Here

    public final static String DATEATTRIBUTENAME = "unredd_date";


    public static DataStore createDatastore(PostGisConfig cfg) throws PostGisException {

        DataStore ret = null;
        try {
            ret = (DataStore)DataStoreFinder.getDataStore(cfg.buildGeoToolsMap());
        } catch (IOException ex) {
            throw new PostGisException("Can't create PostGIS datastore ["+cfg+"]", ex);
        }
View Full Code Here

            String month,
            String day,
            boolean forceCreation)
                throws PostGisException {

      DataStore dstDs=null;
        SimpleFeatureSource fsLayer = null;
        Transaction tx = new DefaultTransaction();

        //== check schema: create new or check they are aligned
        try {
          // craete destination store
            dstDs = createDatastore(dstPg);
           
            // check if destinationlayer exists
            boolean layerExists = existFeatureTable(dstDs, layer);
            if( ! layerExists ) {
                if(forceCreation) {
                    fsLayer = createEnrichedSchema(dstDs, (SimpleFeatureType) sourceFC.getSchema(), layer);
                } else {
                    throw new PostGisException("The layer " + layer + " does not exist");
                }
            } else {
                fsLayer =  dstDs.getFeatureSource(layer);
                checkAttributesMatch(sourceFC, ((JDBCFeatureStore)dstDs.getFeatureSource(layer)).getFeatureSource());
            }

          //== schemas are ok: transfer data
 
          int iYear = Integer.parseInt(year);
          int iMonth = month==null? -1 : Integer.parseInt(month);
          int iDay = day==null? -1 : Integer.parseInt(day);
          Date date = new Date(iYear-1900, iMonth==-1?0:iMonth-1, iDay==-1?1:iDay);
 
          SimpleFeatureStore featureStoreData = (SimpleFeatureStore) fsLayer;
 
          // update the layer store with the new SimpleFeature coming from the shape file
          // data are saved itemsForPage elements at time

            SimpleFeatureType dstSchema = dstDs.getSchema(layer);
            featureStoreData.setTransaction(tx);
            SimpleFeatureType srcSchema = sourceFC.getSchema();
            List<AttributeDescriptor> srcAttributeDescriptor = srcSchema.getAttributeDescriptors();

            SimpleFeatureBuilder featureBuilderData = new SimpleFeatureBuilder(dstSchema);
View Full Code Here

            LOGGER.info("Exception properly trapped: " + e.getMessage());
        }
    }

    private void clearTable(PostGisConfig cfg, String table) throws PostGisException, IOException, SQLException {
        DataStore ds_ = PostGISUtils.createDatastore(cfg);
        assertTrue(ds_ instanceof JDBCDataStore);
       
        JDBCDataStore ds= (JDBCDataStore) ds_;
        Connection connection = ds.getConnection(Transaction.AUTO_COMMIT);
        connection.commit();
View Full Code Here

        connection.commit();
        ds.dispose();
    }

    private long count(PostGisConfig cfg, String table) throws PostGisException, IOException, SQLException {
        DataStore ds_ = PostGISUtils.createDatastore(cfg);
        assertTrue(ds_ instanceof JDBCDataStore);
       
        JDBCDataStore ds= (JDBCDataStore) ds_;

        Connection connection = ds.getConnection(Transaction.AUTO_COMMIT);
View Full Code Here

    }


    private void clearTable(PostGisConfig cfg, String table) throws PostGisException, IOException, SQLException {
        DataStore ds_ = PostGISUtils.createDatastore(cfg);
        assertTrue(ds_ instanceof JDBCDataStore);
       
        JDBCDataStore ds= (JDBCDataStore) ds_;

        Connection connection = ds.getConnection(Transaction.AUTO_COMMIT);
View Full Code Here

TOP

Related Classes of org.geotools.data.DataStore

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.