.gitattributes
@@ -76,6 +76,7 @@ xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/TypeCompLevelIdDispatchableFilter.java svneol=native#text/plain xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/TypeIdDispatchableFilter.java svneol=native#text/plain xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/AbstractOracleDatabaseJob.java svneol=native#text/plain xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/DataRepositoryStatus.java -text xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/DummyFeatureConvertJobContext.java svneol=native#text/plain xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2MySQLJob.java svneol=native#text/plain xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2OraSDOJob.java svneol=native#text/plain xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/ComplexChainElement.java
@@ -56,9 +56,14 @@ return list.toArray(); } public boolean add(Object o) public <T> T[] toArray(T[] ts) { return list.add((Element) o); return list.toArray(ts); } public boolean add(Element element) { return list.add(element); } public boolean remove(Object o) @@ -66,14 +71,29 @@ return list.remove(o); } public boolean addAll(Collection c) public boolean containsAll(Collection<?> objects) { return list.addAll(c); return list.containsAll(objects); } public boolean addAll(int index, Collection c) public boolean addAll(Collection<? extends Element> elements) { return list.addAll(index, c); return list.addAll(elements); } public boolean addAll(int i, Collection<? extends Element> elements) { return list.addAll(i, elements); } public boolean removeAll(Collection<?> objects) { return list.removeAll(objects); } public boolean retainAll(Collection<?> objects) { return list.retainAll(objects); } public void clear() @@ -81,22 +101,22 @@ list.clear(); } public Object get(int index) public Element get(int index) { return list.get(index); } public Object set(int index, Object element) public Element set(int i, Element element) { return list.set(index, (Element) element); return list.set(i, element); } public void add(int index, Object element) public void add(int i, Element element) { list.add(index, (Element) element); list.add(i, element); } public Object remove(int index) public Element remove(int index) { return list.remove(index); } @@ -124,26 +144,6 @@ public List subList(int fromIndex, int toIndex) { return list.subList(fromIndex, toIndex); } public boolean retainAll(Collection c) { return list.retainAll(c); } public boolean removeAll(Collection c) { return list.removeAll(c); } public boolean containsAll(Collection c) { return list.containsAll(c); } public Object[] toArray(Object[] a) { return list.toArray(a); } public Geometry toGeometry(GeometryFactory factory) xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/ComplexElement.java
@@ -11,6 +11,6 @@ * @version 0.1 * @since 2006/5/18 ¤U¤È 04:17:37 */ public interface ComplexElement extends List public interface ComplexElement extends List<Element> { } xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/ComplexShapeElement.java
@@ -57,9 +57,14 @@ return list.toArray(); } public boolean add(Object o) public <T> T[] toArray(T[] ts) { return list.add((Element) o); return list.toArray(ts); } public boolean add(Element element) { return list.add(element); } public boolean remove(Object o) @@ -67,14 +72,29 @@ return list.remove(o); } public boolean addAll(Collection c) public boolean containsAll(Collection<?> objects) { return list.addAll(c); return list.containsAll(objects); } public boolean addAll(int index, Collection c) public boolean addAll(Collection<? extends Element> elements) { return list.addAll(index, c); return list.addAll(elements); } public boolean addAll(int i, Collection<? extends Element> elements) { return list.addAll(i, elements); } public boolean removeAll(Collection<?> objects) { return list.removeAll(objects); } public boolean retainAll(Collection<?> objects) { return list.retainAll(objects); } public void clear() @@ -82,22 +102,22 @@ list.clear(); } public Object get(int index) public Element get(int index) { return list.get(index); } public Object set(int index, Object element) public Element set(int i, Element element) { return list.set(index, (Element) element); return list.set(i, element); } public void add(int index, Object element) public void add(int i, Element element) { list.add(index, (Element) element); list.add(i, element); } public Object remove(int index) public Element remove(int index) { return list.remove(index); } @@ -125,26 +145,6 @@ public List subList(int fromIndex, int toIndex) { return list.subList(fromIndex, toIndex); } public boolean retainAll(Collection c) { return list.retainAll(c); } public boolean removeAll(Collection c) { return list.removeAll(c); } public boolean containsAll(Collection c) { return list.containsAll(c); } public Object[] toArray(Object[] a) { return list.toArray(a); } public Geometry toGeometry(GeometryFactory factory) xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/TextNodeElement.java
@@ -28,7 +28,7 @@ { private static final Logger logger = Logger.getLogger(TextElement.class); private ArrayList list = new ArrayList(); private ArrayList<Element> list = new ArrayList<Element>(); public TextNodeElement(byte[] raw) { @@ -50,7 +50,7 @@ return list.contains(o); } public Iterator iterator() public Iterator<Element> iterator() { return list.iterator(); } @@ -60,9 +60,14 @@ return list.toArray(); } public boolean add(Object o) public <T> T[] toArray(T[] ts) { return list.add(o); return list.toArray(ts); } public boolean add(Element element) { return list.add(element); } public boolean remove(Object o) @@ -70,14 +75,29 @@ return list.remove(o); } public boolean addAll(Collection c) public boolean containsAll(Collection<?> objects) { return list.addAll(c); return list.containsAll(objects); } public boolean addAll(int index, Collection c) public boolean addAll(Collection<? extends Element> elements) { return list.addAll(index, c); return list.addAll(elements); } public boolean addAll(int i, Collection<? extends Element> elements) { return list.addAll(i, elements); } public boolean removeAll(Collection<?> objects) { return list.removeAll(objects); } public boolean retainAll(Collection<?> objects) { return list.retainAll(objects); } public void clear() @@ -85,22 +105,22 @@ list.clear(); } public Object get(int index) public Element get(int index) { return list.get(index); } public Object set(int index, Object element) public Element set(int index, Element element) { return list.set(index, element); } public void add(int index, Object element) public void add(int index, Element element) { list.add(index, element); } public Object remove(int index) public Element remove(int index) { return list.remove(index); } @@ -115,44 +135,29 @@ return list.lastIndexOf(o); } public ListIterator listIterator() public ListIterator<Element> listIterator() { return list.listIterator(); } public ListIterator listIterator(int index) public ListIterator<Element> listIterator(int index) { return list.listIterator(index); } public List subList(int fromIndex, int toIndex) public List<Element> subList(int fromIndex, int toIndex) { return list.subList(fromIndex, toIndex); } public boolean retainAll(Collection c) { return list.retainAll(c); } public boolean removeAll(Collection c) { return list.removeAll(c); } public boolean containsAll(Collection c) { return list.containsAll(c); } public Object[] toArray(Object[] a) public Element[] toArray(Element[] a) { return list.toArray(a); } public String[] getTextArray() { ArrayList list = new ArrayList(); ArrayList<String> list = new ArrayList<String>(); for (ListIterator it = listIterator(); it.hasNext();) { @@ -164,7 +169,7 @@ } } return (String[]) list.toArray(new String[list.size()]); return list.toArray(new String[list.size()]); } public Geometry toGeometry(GeometryFactory factory) @@ -366,7 +371,7 @@ for (Object o : this) { TextElement textElm = (TextElement) o; other.add(textElm.clone()); other.add((Element) textElm.clone()); } return other; xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/DataRepositoryStatus.java
New file @@ -0,0 +1,11 @@ package com.ximple.eofms.jobs; public interface DataRepositoryStatus { public static final short VSSTATUS_UNKNOWN = 0x0000; public static final short VSSTATUS_USING = 0x0100; public static final short VSSTATUS_CONFIG = 0x0020; public static final short VSSTATUS_LINKVIEW = 0x0010; public static final short VSSTATUS_READY = 0x0002; public static final short VSSTATUS_COVERT = 0x0001; } xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2PostGISJob.java
@@ -17,6 +17,7 @@ import java.util.Date; import java.util.Map; import java.util.TreeMap; import java.util.ArrayList; import org.apache.commons.collections.OrderedMap; import org.apache.commons.collections.OrderedMapIterator; @@ -270,6 +271,7 @@ logger.warn(ex.getMessage(), ex); throw new JobExecutionException("IO error. " + ex.getMessage(), ex); } updateRepoStatusToReady(targetSchemaName); logger.info(jobName + " end at " + new Date()); } @@ -1158,6 +1160,7 @@ { if (targetDataStore == null) return null; Connection connection = null; Statement stmt = null; ResultSet rs = null; String targetSchema = null; boolean needCreate = false; @@ -1168,12 +1171,58 @@ if (!rs.next()) needCreate = true; if (needCreate) createXGeosVersionTable(connection, _pgSchema); rs.close(); rs = null; StringBuilder sbSQL = new StringBuilder(); StringBuilder sbSQL = new StringBuilder("SELECT "); sbSQL.append("'vsschema', 'vsstatus' FROM "); sbSQL.append(encodeSchemaTableName(_pgSchema, XGVERSION_NAME)).append(' '); sbSQL.append("ORDER BY vsid"); stmt = connection.createStatement(); rs = stmt.executeQuery(sbSQL.toString()); ArrayList<Object[]> tmpSchemas = new ArrayList<Object[]>(); int i = 0; int current = 0; while (rs.next()) { Object[] values = new Object[2]; values[0] = rs.getObject(1); values[1] = rs.getObject(2); tmpSchemas.add(values); if ((((Short)values[1]) & DataRepositoryStatus.VSSTATUS_USING) != 0) { current = i; } i++; } if (current < (tmpSchemas.size() - 1)) { Object[] values = tmpSchemas.get(current + 1); targetSchema = (String) values[0]; } else { Object[] values = tmpSchemas.get(0); targetSchema = (String) values[0]; } sbSQL = new StringBuilder("UPDATE "); sbSQL.append(encodeSchemaTableName(_pgSchema, XGVERSION_NAME)).append(' '); sbSQL.append(" SET 'vsstatus' = "); sbSQL.append(DataRepositoryStatus.VSSTATUS_COVERT); sbSQL.append(" WHERE 'vsschema' = "); sbSQL.append(targetSchema); int count = stmt.executeUpdate(sbSQL.toString()); if (count != 1) { logger.info("update status for " + targetSchema + " update result count=" + count); } } catch (SQLException e) { logger.warn(e.getMessage(), e); } finally { if (connection != null) try { connection.close(); } catch (SQLException e) {}; if (rs != null) try { rs.close(); } catch (SQLException e) {}; if (stmt != null) try { stmt.close(); } catch (SQLException e) {}; if (connection != null) try { connection.close(); } catch (SQLException e) {}; } return targetSchema; } @@ -1210,16 +1259,54 @@ sql = new StringBuilder("INSERT INTO "); sql.append(encodeSchemaTableName(pgSchema, XGVERSION_NAME)); sql.append(" ('vsschema', 'vsstatus' ) VALUES ("); sql.append("'gisrepo1', 0 "); sql.append("'gisrepo1', "); sql.append(DataRepositoryStatus.VSSTATUS_UNKNOWN).append(" )"); stmt.executeUpdate(sql.toString()); sql = new StringBuilder("INSERT INTO "); sql.append(encodeSchemaTableName(pgSchema, XGVERSION_NAME)); sql.append(" ('vsschema', 'vsstatus' ) VALUES ("); sql.append("'gisrepo2', 0 "); sql.append("'gisrepo2', "); sql.append(DataRepositoryStatus.VSSTATUS_UNKNOWN).append(" )"); stmt.executeUpdate(sql.toString()); } finally { if (stmt != null) stmt.close(); } } private void updateRepoStatusToReady(String targetSchema) { if (targetDataStore == null) return; Connection connection = null; Statement stmt = null; ResultSet rs = null; boolean needCreate = false; try { StringBuilder sbSQL = new StringBuilder("UPDATE "); sbSQL.append(encodeSchemaTableName(_pgSchema, XGVERSION_NAME)).append(' '); sbSQL.append(" SET 'vsstatus' = "); sbSQL.append(DataRepositoryStatus.VSSTATUS_READY); sbSQL.append(" WHERE 'vsschema' = "); sbSQL.append(targetSchema); connection = targetDataStore.getConnection(Transaction.AUTO_COMMIT); stmt = connection.createStatement(); int count = stmt.executeUpdate(sbSQL.toString()); if (count != 1) { logger.info("update status for " + targetSchema + " update result count=" + count); } } catch (SQLException e) { logger.warn(e.getMessage(), e); } catch (IOException e) { logger.warn(e.getMessage(), e); } finally { if (rs != null) try { rs.close(); } catch (SQLException e) {}; if (stmt != null) try { stmt.close(); } catch (SQLException e) {}; if (connection != null) try { connection.close(); } catch (SQLException e) {}; } } }