forked from geodmms/xdgnjobs

?? ?
2008-08-12 0d0e3da78dfdb4cd34b0e85ee22d2de61c0863a7
xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleElementLogger.java
@@ -49,6 +49,9 @@
    private FileOutputStream fos = null;
    private FileChannel fch = null;
    private int logCount = 0;
    private int elmCount = 0;
    private int maxElmCount = 3000;
    private boolean useElementCount = true;
    private ArrayList<byte[]> dgnFileHeader = null;
    private String elmOutPath;
@@ -249,6 +252,7 @@
            }
        }
        elmCount++;
        if ((subBuffers.size() != 0) && (fch != null))
        {
            for (ByteBuffer buf : subBuffers)
@@ -290,9 +294,9 @@
        logger.warn("Create Dgn Logging File:" + logFile.toString());
        fos = new FileOutputStream(logFile);
        fch = fos.getChannel();
        prepareOutputElementStream();
        schemaChanged = false;
        elmCount = 0;
    }
    private void putEndOfFileElement() throws IOException
@@ -399,10 +403,16 @@
    public void flashLogging()
    {
        if ((useElementCount) && (elmCount < maxElmCount))
        {
            return;
        }
        if (fos != null)
        {
            try
            {
                putEndOfFileElement();
                fos.close();
            } catch (IOException e)
            {
@@ -410,6 +420,7 @@
            }
            fos = null;
            fch = null;
            elmCount = 0;
        }
    }
@@ -417,4 +428,29 @@
    {
        return schemaChanged;
    }
    public boolean isUseElementCount()
    {
        return useElementCount;
    }
    public void setUseElementCount(boolean useElementCount)
    {
        this.useElementCount = useElementCount;
    }
    public int getElmCount()
    {
        return elmCount;
    }
    public int getMaxElmCount()
    {
        return maxElmCount;
    }
    public void setMaxElmCount(int maxElmCount)
    {
        this.maxElmCount = maxElmCount;
    }
}