forked from geodmms/xdgnjobs

?? ?
2008-06-12 d2986858ad69383e3b06188b4cebe9c2f714f2dd
xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2PostGISJob.java
@@ -13,6 +13,7 @@
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Types;
import java.sql.Connection;
import java.util.Calendar;
import java.util.Date;
import java.util.Map;
@@ -98,36 +99,7 @@
    protected Map<String, String> pgProperties;
    protected PostgisDataStore targetDataStore;
    /*
       PostgisDataStore pg = new PostgisDataStore(pool, f.schema, getName(),
               PostgisDataStore.OPTIMIZE_SQL);
       pg.setWKBEnabled(WKB_ENABLED);
       pg.setEstimatedExtent(true);
       pg.setFIDMapper("road", new TypedFIDMapper(new BasicFIDMapper("fid", 255, false), "road"));
       pg.setFIDMapper("river", new TypedFIDMapper(new BasicFIDMapper("fid", 255, false), "river"));
       pg.setFIDMapper("testset",
           new TypedFIDMapper(new BasicFIDMapper("gid", 255, true), "testset"));
    */
    /*
        Transaction transaction = new DefaultTransaction("attemptWriteFW");
        FeatureWriter writer = ds.getFeatureWriter(table, transaction);
        Feature feature;
        while (writer.hasNext()) {
            feature = (Feature) writer.next();
        }
        feature = (Feature) writer.next();
        feature.setAttribute(0, "test");
        writer.write();
        String id = feature.getID();
        transaction.commit();
        transaction.close();
     */
    // protected OracleConvertPostGISJobContext oracleJobContext;
    public Log getLogger()
    {
@@ -136,6 +108,13 @@
    protected AbstractOracleJobContext prepareJobContext(String filterPath)
    {
        /*
        if (oracleJobContext == null)
        {
            oracleJobContext = new OracleConvertPostGISJobContext(getDataPath(), getTargetDataStore(), filterPath);
        }
        return oracleJobContext;
        */
        return new OracleConvertPostGISJobContext(getDataPath(), getTargetDataStore(), filterPath);
    }
@@ -235,7 +214,7 @@
        {
            logger.info("-- step:clearOutputDatabase --");
            clearOutputDatabase();
            boolean bFirst = true;
            boolean bFirst = isCopyConnectivityMode();
            if (checkConvertDB())
            {
                logger.info("-- step:convertOracleDB --");
@@ -308,7 +287,7 @@
     */
    private void copyConnectivity(OracleConvertPostGISJobContext jobContext) throws SQLException
    {
        OracleConnection connection = jobContext.getOracleConnection();
        Connection connection = jobContext.getOracleConnection();
        Statement stmt = connection.createStatement();
        stmt.execute(AbstractOracleJobContext.TRUNCATE_CONNECTIVITY_WEBCHECK);
        stmt.execute(AbstractOracleJobContext.COPY_CONNECTIVITY_TO_WEBCHECK);
@@ -318,8 +297,8 @@
                                 String querySchema, String dataPath) throws SQLException
    {
        int order = 0;
        OrderedMap map = getBlobStorageList(jobContext.getOracleConnection(), querySchema, "SD$SPACENODES"
                , null);
        OrderedMap map = getBlobStorageList(jobContext.getOracleConnection(),
                querySchema, "SD$SPACENODES" , null);
        logger.info("begin convert job:[" + map.size() + "]:testmode=" + _testMode);
@@ -368,12 +347,12 @@
        jobContext.getExecutionContext().put("ConvertDgn2PostGISJobProgress", 100);
        jobContext.commitTransaction();
        jobContext.resetFeatureContext();
        logger.info("end convert job:[" + order + "]");
        System.gc();
    }
    protected OrderedMap getBlobStorageList(OracleConnection connection, String schemaSrc, String tableSrc,
    protected OrderedMap getBlobStorageList(Connection connection, String schemaSrc, String tableSrc,
                                            OrderedMap orderedMap) throws SQLException
    {
        if (orderedMap == null)
@@ -466,7 +445,7 @@
    protected void queryIgsetElement(OracleConvertPostGISJobContext jobContext,
                                     String srcschema, String srctable) throws SQLException
    {
        OracleConnection connection = jobContext.getOracleConnection();
        Connection connection = jobContext.getOracleConnection();
        String fetchSrcStmtFmt = "SELECT IGDSELM FROM \"%s\".\"%s\" ORDER BY ROWID";
        PrintfFormat spf = new PrintfFormat(fetchSrcStmtFmt);
        String fetchSrcStmt = spf.sprintf(new Object[]{srcschema, srctable});
@@ -508,7 +487,7 @@
    protected void queryRawElement(OracleConvertPostGISJobContext jobContext,
                                   String srcschema, String srctable) throws SQLException
    {
        OracleConnection connection = jobContext.getOracleConnection();
        Connection connection = jobContext.getOracleConnection();
        String fetchDestStmtFmt = "SELECT ELEMENT FROM \"%s\".\"%s\" ORDER BY ROWID";
        PrintfFormat spf = new PrintfFormat(fetchDestStmtFmt);
        String fetchDestStmt = spf.sprintf(new Object[]{srcschema, srctable});