public static void main(String[] argv){
  ArgParser ap=new ArgParser("EsriShapeExport");
  ap.add("shp","A URL to a shape file (.shp).",1);
  if (argv.length < 1) {
    ap.bail("",true);
  }
  ap.parse(argv);
  String[] files=ap.getArgValues("shp");
  if (files != null && files[0] != null) {
    String shp=files[0];
    String dbf=null;
    try {
      dbf=shp.substring(0,shp.lastIndexOf('.') + 1) + PARAM_DBF;
      DbfTableModel model=DbfTableModel.getDbfTableModel(PropUtils.getResourceOrFileOrURL(dbf));
      EsriGraphicList list=EsriGraphicList.getEsriGraphicList(PropUtils.getResourceOrFileOrURL(shp),null,null);
      logger.info(list.getDescription());
      EsriShapeExport ese=new EsriShapeExport(list,model,null);
      ese.export();
    }
 catch (    MalformedURLException murle) {
      logger.warning("EsriShapeExport: Malformed URL Exception\n" + murle.getMessage());
    }
catch (    NullPointerException npe) {
      logger.warning("EsriShapeExport: Path to shape file isn't good enough to find .dbf file and .shx file.");
    }
catch (    Exception exception) {
      logger.warning("EsriShapeExport: Exception\n" + exception.getMessage());
      exception.printStackTrace();
    }
  }
 else {
    ap.bail("Need a path to a Shape file (.shp)",true);
  }
  System.exit(0);
}

public static void main ( String [ ] argv ) { ArgParser ap = new ArgParser ( "EsriShapeExport" ) ; ap . add ( "shp" , "A URL to a shape file (.shp)." , 1 ) ; if ( argv . length < 1 ) { ap . bail ( "" , true ) ; } ap . parse ( argv ) ; String [ ] files = ap . getArgValues ( "shp" ) ; if ( files != null && files [ 0 ] != null ) { String shp = files [ 0 ] ; String dbf = null ; try { dbf = shp . substring ( 0 , shp . lastIndexOf ( '.' ) + 1 ) + PARAM_DBF ; DbfTableModel model = DbfTableModel . getDbfTableModel ( PropUtils . getResourceOrFileOrURL ( dbf ) ) ; EsriGraphicList list = EsriGraphicList . getEsriGraphicList ( PropUtils . getResourceOrFileOrURL ( shp ) , null , null ) ; logger . info ( list . getDescription ( ) ) ; EsriShapeExport ese = new EsriShapeExport ( list , model , null ) ; ese . export ( ) ; } catch ( MalformedURLException murle ) { logger . warning ( "EsriShapeExport: Malformed URL Exception\n" + murle . getMessage ( ) ) ; } catch ( NullPointerException npe ) { logger . warning ( "EsriShapeExport: Path to shape file isn't good enough to find .dbf file and .shx file." ) ; } catch ( Exception exception ) { logger . warning ( "EsriShapeExport: Exception\n" + exception . getMessage ( ) ) ; exception . printStackTrace ( ) ; } } else { ap . bail ( "Need a path to a Shape file (.shp)" , true ) ; } System . exit ( 0 ) ; }
the main function is a test , reads in a shape file ( with the . shx and . dbf files ) and writes them back out .
