forked from geodmms/xdgnjobs

?? ?
2008-06-16 aa92e40672e9ea2a6b55f528d5b986314d652a40
xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleElementLogger.java
@@ -11,6 +11,7 @@
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Types;
import java.util.ArrayList;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -45,6 +46,7 @@
    private FileOutputStream fos = null;
    private FileChannel fch = null;
    private int logCount = 0;
    private ArrayList<byte[]> dgnFileHeader = null;
    public OracleElementLogger(Connection connection)
    {
@@ -226,6 +228,17 @@
            logger.warn("connection is null");
            return;
        }
        if (dgnFileHeader != null)
        {
            for (byte[] raw : dgnFileHeader)
            {
                putElementIntoStream(raw);
            }
            return;
        }
        dgnFileHeader = new ArrayList<byte[]>();
        String fetchSrcStmtFmt = "SELECT IGDSELM FROM \"%s\".\"%s\" ORDER BY ROWID";
        PrintfFormat spf = new PrintfFormat(fetchSrcStmtFmt);
        String fetchSrcStmt = spf.sprintf(new Object[]{currentSchema, TAB_IGDSSEED});
@@ -249,9 +262,12 @@
            if (raw != null)
            {
                dgnFileHeader.add(raw);
                putElementIntoStream(raw);
            }
        }
        rsSrc.close();
        stmtSrc.close();
    }
    private void putElementIntoStream(byte[] raw) throws IOException
@@ -268,7 +284,7 @@
        byte[] chunk = new byte[optimalSize];
        InputStream is = blob.getBinaryStream(0);
        ByteBuffer buffer = null;    // ByteBuffer.allocate(optimalSize);
        int len = 0;
        int len;
        try
        {
@@ -312,4 +328,9 @@
            fch = null;
        }
    }
    public boolean isSchemaChanged()
    {
        return schemaChanged;
    }
}