protected void init(DBFStoreParameters params, DataStoreProviderServices storeServices)
      throws InitializeException {

    SHPStoreParameters shpParams = (SHPStoreParameters) params;
    shpResource = this.createResource(FileResource.NAME, new Object[] {shpParams.getSHPFileName()});
    shpResource.addConsumer(this);

    shxResource = this.createResource(FileResource.NAME, new Object[] {shpParams.getSHXFileName()});
    shxResource.addConsumer(this);

    this.shpFile = new SHPFile(shpParams);
    super.init(params, storeServices);
  }
  public void performChanges(
      Iterator deleteds,
      Iterator inserteds,
      Iterator updateds,
      Iterator originalFeatureTypesUpdated)
      throws PerformEditingException {
    FeatureType fType;
    try {
      fType = this.getStoreServices().getDefaultFeatureType();
    } catch (DataException e) {
      throw new PerformEditingException(this.getName(), e);
    }
    // TODO Comprobar el campo de geometria

    EditableFeatureType dbfFtype = fType.getEditable();

    removeGeometryColumn(dbfFtype);

    try {
      this.resourcesBegin();
    } catch (ResourceBeginException e1) {
      throw new PerformEditingException(this.getName(), e1);
    }

    try {

      FeatureSet set = this.getFeatureStore().getFeatureSet();
      writer = new SHPFeatureWriter(this.getName());

      SHPStoreParameters shpParams = this.getShpParameters();
      SHPStoreParameters tmpParams = (SHPStoreParameters) shpParams.getCopy();
      tmpParams.setDBFFileName(tmpParams.getDBFFileName() + ".tmp");
      tmpParams.setSHPFileName(tmpParams.getSHPFileName() + ".tmp");
      tmpParams.setSHXFileName(tmpParams.getSHXFileName() + ".tmp");

      writer.begin(tmpParams, fType, dbfFtype, set.getSize());

      DisposableIterator iter = set.fastIterator();
      while (iter.hasNext()) {
        Feature feature = (Feature) iter.next();
        writer.append(feature);
      }

      writer.end();

      this.close();
      this.resourceCloseRequest();

      if (!shpParams.getDBFFile().delete()) {
        throw new PerformEditingException(
            this.getName(), new IOException(shpParams.getDBFFileName()));
      }
      if (!shpParams.getSHPFile().delete()) {
        throw new PerformEditingException(
            this.getName(), new IOException(shpParams.getSHPFileName()));
      }
      if (!shpParams.getSHXFile().delete()) {
        throw new PerformEditingException(
            this.getName(), new IOException(shpParams.getSHXFileName()));
      }
      if (!tmpParams.getDBFFile().renameTo(shpParams.getDBFFile())) {
        throw new PerformEditingException(
            this.getName(), new IOException(shpParams.getSHPFileName()));
      }
      if (!tmpParams.getSHPFile().renameTo(shpParams.getSHPFile())) {
        throw new PerformEditingException(
            this.getName(), new IOException(shpParams.getSHPFileName()));
      }
      if (!tmpParams.getSHXFile().renameTo(shpParams.getSHXFile())) {
        throw new PerformEditingException(
            this.getName(), new IOException(shpParams.getSHXFileName()));
      }

      this.resourcesNotifyChanges();
      this.initFeatureType();

    } catch (Exception e) {
      throw new PerformEditingException(this.getName(), e);
    } finally {
      this.resourcesEnd();
    }
  }