http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e8d71b55/modules/schema-import-ui/src/test/java/org/apache/ignite/schema/test/model/ObjectsKey.txt ---------------------------------------------------------------------- diff --git a/modules/schema-import-ui/src/test/java/org/apache/ignite/schema/test/model/ObjectsKey.txt b/modules/schema-import-ui/src/test/java/org/apache/ignite/schema/test/model/ObjectsKey.txt new file mode 100644 index 0000000..cad109c --- /dev/null +++ b/modules/schema-import-ui/src/test/java/org/apache/ignite/schema/test/model/ObjectsKey.txt @@ -0,0 +1,96 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.schema.test.model; + +import java.io.*; + +/** + * ObjectsKey definition. + * + * Code generated by Apache Ignite Schema Import utility: 01/27/2015. + */ +public class ObjectsKey implements Serializable { + /** */ + private static final long serialVersionUID = 0L; + + /** Value for pk. */ + private int pk; + + /** + * Empty constructor. + */ + public ObjectsKey() { + // No-op. + } + + /** + * Full constructor. + */ + public ObjectsKey( + int pk + ) { + this.pk = pk; + } + + /** + * Gets pk. + * + * @return Value for pk. + */ + public int getPk() { + return pk; + } + + /** + * Sets pk. + * + * @param pk New value for pk. + */ + public void setPk(int pk) { + this.pk = pk; + } + + /** {@inheritDoc} */ + @Override public boolean equals(Object o) { + if (this == o) + return true; + + if (!(o instanceof ObjectsKey)) + return false; + + ObjectsKey that = (ObjectsKey)o; + + if (pk != that.pk) + return false; + + return true; + } + + /** {@inheritDoc} */ + @Override public int hashCode() { + int res = pk; + + return res; + } + + /** {@inheritDoc} */ + @Override public String toString() { + return "ObjectsKey [pk=" + pk + + "]"; + } +}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e8d71b55/modules/schema-import-ui/src/test/java/org/apache/ignite/schema/test/model/Primitives.txt ---------------------------------------------------------------------- diff --git a/modules/schema-import-ui/src/test/java/org/apache/ignite/schema/test/model/Primitives.txt b/modules/schema-import-ui/src/test/java/org/apache/ignite/schema/test/model/Primitives.txt new file mode 100644 index 0000000..ef8f902 --- /dev/null +++ b/modules/schema-import-ui/src/test/java/org/apache/ignite/schema/test/model/Primitives.txt @@ -0,0 +1,506 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.schema.test.model; + +import java.io.*; + +/** + * Primitives definition. + * + * Code generated by Apache Ignite Schema Import utility: 01/27/2015. + */ +public class Primitives implements Serializable { + /** */ + private static final long serialVersionUID = 0L; + + /** Value for pk. */ + private int pk; + + /** Value for boolcol. */ + private boolean boolcol; + + /** Value for bytecol. */ + private byte bytecol; + + /** Value for shortcol. */ + private short shortcol; + + /** Value for intcol. */ + private int intcol; + + /** Value for longcol. */ + private long longcol; + + /** Value for floatcol. */ + private float floatcol; + + /** Value for doublecol. */ + private double doublecol; + + /** Value for doublecol2. */ + private double doublecol2; + + /** Value for bigdecimalcol. */ + private java.math.BigDecimal bigdecimalcol; + + /** Value for strcol. */ + private String strcol; + + /** Value for datecol. */ + private java.sql.Date datecol; + + /** Value for timecol. */ + private java.sql.Time timecol; + + /** Value for tscol. */ + private java.sql.Timestamp tscol; + + /** Value for arrcol. */ + private Object arrcol; + + /** + * Empty constructor. + */ + public Primitives() { + // No-op. + } + + /** + * Full constructor. + */ + public Primitives( + int pk, + boolean boolcol, + byte bytecol, + short shortcol, + int intcol, + long longcol, + float floatcol, + double doublecol, + double doublecol2, + java.math.BigDecimal bigdecimalcol, + String strcol, + java.sql.Date datecol, + java.sql.Time timecol, + java.sql.Timestamp tscol, + Object arrcol + ) { + this.pk = pk; + this.boolcol = boolcol; + this.bytecol = bytecol; + this.shortcol = shortcol; + this.intcol = intcol; + this.longcol = longcol; + this.floatcol = floatcol; + this.doublecol = doublecol; + this.doublecol2 = doublecol2; + this.bigdecimalcol = bigdecimalcol; + this.strcol = strcol; + this.datecol = datecol; + this.timecol = timecol; + this.tscol = tscol; + this.arrcol = arrcol; + } + + /** + * Gets pk. + * + * @return Value for pk. + */ + public int getPk() { + return pk; + } + + /** + * Sets pk. + * + * @param pk New value for pk. + */ + public void setPk(int pk) { + this.pk = pk; + } + + /** + * Gets boolcol. + * + * @return Value for boolcol. + */ + public boolean getBoolcol() { + return boolcol; + } + + /** + * Sets boolcol. + * + * @param boolcol New value for boolcol. + */ + public void setBoolcol(boolean boolcol) { + this.boolcol = boolcol; + } + + /** + * Gets bytecol. + * + * @return Value for bytecol. + */ + public byte getBytecol() { + return bytecol; + } + + /** + * Sets bytecol. + * + * @param bytecol New value for bytecol. + */ + public void setBytecol(byte bytecol) { + this.bytecol = bytecol; + } + + /** + * Gets shortcol. + * + * @return Value for shortcol. + */ + public short getShortcol() { + return shortcol; + } + + /** + * Sets shortcol. + * + * @param shortcol New value for shortcol. + */ + public void setShortcol(short shortcol) { + this.shortcol = shortcol; + } + + /** + * Gets intcol. + * + * @return Value for intcol. + */ + public int getIntcol() { + return intcol; + } + + /** + * Sets intcol. + * + * @param intcol New value for intcol. + */ + public void setIntcol(int intcol) { + this.intcol = intcol; + } + + /** + * Gets longcol. + * + * @return Value for longcol. + */ + public long getLongcol() { + return longcol; + } + + /** + * Sets longcol. + * + * @param longcol New value for longcol. + */ + public void setLongcol(long longcol) { + this.longcol = longcol; + } + + /** + * Gets floatcol. + * + * @return Value for floatcol. + */ + public float getFloatcol() { + return floatcol; + } + + /** + * Sets floatcol. + * + * @param floatcol New value for floatcol. + */ + public void setFloatcol(float floatcol) { + this.floatcol = floatcol; + } + + /** + * Gets doublecol. + * + * @return Value for doublecol. + */ + public double getDoublecol() { + return doublecol; + } + + /** + * Sets doublecol. + * + * @param doublecol New value for doublecol. + */ + public void setDoublecol(double doublecol) { + this.doublecol = doublecol; + } + + /** + * Gets doublecol2. + * + * @return Value for doublecol2. + */ + public double getDoublecol2() { + return doublecol2; + } + + /** + * Sets doublecol2. + * + * @param doublecol2 New value for doublecol2. + */ + public void setDoublecol2(double doublecol2) { + this.doublecol2 = doublecol2; + } + + /** + * Gets bigdecimalcol. + * + * @return Value for bigdecimalcol. + */ + public java.math.BigDecimal getBigdecimalcol() { + return bigdecimalcol; + } + + /** + * Sets bigdecimalcol. + * + * @param bigdecimalcol New value for bigdecimalcol. + */ + public void setBigdecimalcol(java.math.BigDecimal bigdecimalcol) { + this.bigdecimalcol = bigdecimalcol; + } + + /** + * Gets strcol. + * + * @return Value for strcol. + */ + public String getStrcol() { + return strcol; + } + + /** + * Sets strcol. + * + * @param strcol New value for strcol. + */ + public void setStrcol(String strcol) { + this.strcol = strcol; + } + + /** + * Gets datecol. + * + * @return Value for datecol. + */ + public java.sql.Date getDatecol() { + return datecol; + } + + /** + * Sets datecol. + * + * @param datecol New value for datecol. + */ + public void setDatecol(java.sql.Date datecol) { + this.datecol = datecol; + } + + /** + * Gets timecol. + * + * @return Value for timecol. + */ + public java.sql.Time getTimecol() { + return timecol; + } + + /** + * Sets timecol. + * + * @param timecol New value for timecol. + */ + public void setTimecol(java.sql.Time timecol) { + this.timecol = timecol; + } + + /** + * Gets tscol. + * + * @return Value for tscol. + */ + public java.sql.Timestamp getTscol() { + return tscol; + } + + /** + * Sets tscol. + * + * @param tscol New value for tscol. + */ + public void setTscol(java.sql.Timestamp tscol) { + this.tscol = tscol; + } + + /** + * Gets arrcol. + * + * @return Value for arrcol. + */ + public Object getArrcol() { + return arrcol; + } + + /** + * Sets arrcol. + * + * @param arrcol New value for arrcol. + */ + public void setArrcol(Object arrcol) { + this.arrcol = arrcol; + } + + /** {@inheritDoc} */ + @Override public boolean equals(Object o) { + if (this == o) + return true; + + if (!(o instanceof Primitives)) + return false; + + Primitives that = (Primitives)o; + + if (pk != that.pk) + return false; + + if (boolcol != that.boolcol) + return false; + + if (bytecol != that.bytecol) + return false; + + if (shortcol != that.shortcol) + return false; + + if (intcol != that.intcol) + return false; + + if (longcol != that.longcol) + return false; + + if (Float.compare(floatcol, that.floatcol) != 0) + return false; + + if (Double.compare(doublecol, that.doublecol) != 0) + return false; + + if (Double.compare(doublecol2, that.doublecol2) != 0) + return false; + + if (bigdecimalcol != null ? !bigdecimalcol.equals(that.bigdecimalcol) : that.bigdecimalcol != null) + return false; + + if (strcol != null ? !strcol.equals(that.strcol) : that.strcol != null) + return false; + + if (datecol != null ? !datecol.equals(that.datecol) : that.datecol != null) + return false; + + if (timecol != null ? !timecol.equals(that.timecol) : that.timecol != null) + return false; + + if (tscol != null ? !tscol.equals(that.tscol) : that.tscol != null) + return false; + + if (arrcol != null ? !arrcol.equals(that.arrcol) : that.arrcol != null) + return false; + + return true; + } + + /** {@inheritDoc} */ + @Override public int hashCode() { + int res = pk; + + res = 31 * res + (boolcol ? 1 : 0); + + res = 31 * res + (int)bytecol; + + res = 31 * res + (int)shortcol; + + res = 31 * res + intcol; + + res = 31 * res + (int)(longcol ^ (longcol >>> 32)); + + res = 31 * res + (floatcol != +0.0f ? Float.floatToIntBits(floatcol) : 0); + + long ig_hash_temp = Double.doubleToLongBits(doublecol); + + res = 31 * res + (int)(ig_hash_temp ^ (ig_hash_temp >>> 32)); + + ig_hash_temp = Double.doubleToLongBits(doublecol2); + + res = 31 * res + (int)(ig_hash_temp ^ (ig_hash_temp >>> 32)); + + res = 31 * res + (bigdecimalcol != null ? bigdecimalcol.hashCode() : 0); + + res = 31 * res + (strcol != null ? strcol.hashCode() : 0); + + res = 31 * res + (datecol != null ? datecol.hashCode() : 0); + + res = 31 * res + (timecol != null ? timecol.hashCode() : 0); + + res = 31 * res + (tscol != null ? tscol.hashCode() : 0); + + res = 31 * res + (arrcol != null ? arrcol.hashCode() : 0); + + return res; + } + + /** {@inheritDoc} */ + @Override public String toString() { + return "Primitives [pk=" + pk + + ", boolcol=" + boolcol + + ", bytecol=" + bytecol + + ", shortcol=" + shortcol + + ", intcol=" + intcol + + ", longcol=" + longcol + + ", floatcol=" + floatcol + + ", doublecol=" + doublecol + + ", doublecol2=" + doublecol2 + + ", bigdecimalcol=" + bigdecimalcol + + ", strcol=" + strcol + + ", datecol=" + datecol + + ", timecol=" + timecol + + ", tscol=" + tscol + + ", arrcol=" + arrcol + + "]"; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e8d71b55/modules/schema-import-ui/src/test/java/org/apache/ignite/schema/test/model/PrimitivesKey.txt ---------------------------------------------------------------------- diff --git a/modules/schema-import-ui/src/test/java/org/apache/ignite/schema/test/model/PrimitivesKey.txt b/modules/schema-import-ui/src/test/java/org/apache/ignite/schema/test/model/PrimitivesKey.txt new file mode 100644 index 0000000..0844e63 --- /dev/null +++ b/modules/schema-import-ui/src/test/java/org/apache/ignite/schema/test/model/PrimitivesKey.txt @@ -0,0 +1,96 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.schema.test.model; + +import java.io.*; + +/** + * PrimitivesKey definition. + * + * Code generated by Apache Ignite Schema Import utility: 01/27/2015. + */ +public class PrimitivesKey implements Serializable { + /** */ + private static final long serialVersionUID = 0L; + + /** Value for pk. */ + private int pk; + + /** + * Empty constructor. + */ + public PrimitivesKey() { + // No-op. + } + + /** + * Full constructor. + */ + public PrimitivesKey( + int pk + ) { + this.pk = pk; + } + + /** + * Gets pk. + * + * @return Value for pk. + */ + public int getPk() { + return pk; + } + + /** + * Sets pk. + * + * @param pk New value for pk. + */ + public void setPk(int pk) { + this.pk = pk; + } + + /** {@inheritDoc} */ + @Override public boolean equals(Object o) { + if (this == o) + return true; + + if (!(o instanceof PrimitivesKey)) + return false; + + PrimitivesKey that = (PrimitivesKey)o; + + if (pk != that.pk) + return false; + + return true; + } + + /** {@inheritDoc} */ + @Override public int hashCode() { + int res = pk; + + return res; + } + + /** {@inheritDoc} */ + @Override public String toString() { + return "PrimitivesKey [pk=" + pk + + "]"; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e8d71b55/modules/schema-import-ui/src/test/java/org/apache/ignite/schema/test/model/ignite-type-metadata.xml ---------------------------------------------------------------------- diff --git a/modules/schema-import-ui/src/test/java/org/apache/ignite/schema/test/model/ignite-type-metadata.xml b/modules/schema-import-ui/src/test/java/org/apache/ignite/schema/test/model/ignite-type-metadata.xml new file mode 100644 index 0000000..2de9c62 --- /dev/null +++ b/modules/schema-import-ui/src/test/java/org/apache/ignite/schema/test/model/ignite-type-metadata.xml @@ -0,0 +1,362 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<!-- + XML generated by Apache Ignite Schema Import utility: 02/05/2015 +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:util="http://www.springframework.org/schema/util" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/util + http://www.springframework.org/schema/util/spring-util.xsd"> + <bean class="org.apache.ignite.cache.CacheTypeMetadata"> + <property name="databaseSchema" value="PUBLIC"/> + <property name="databaseTable" value="OBJECTS"/> + <property name="keyType" value="org.apache.ignite.schema.test.model.ObjectsKey"/> + <property name="valueType" value="org.apache.ignite.schema.test.model.Objects"/> + <property name="keyFields"> + <list> + <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> + <property name="databaseName" value="PK"/> + <property name="databaseType"> + <util:constant static-field="java.sql.Types.INTEGER"/> + </property> + <property name="javaName" value="pk"/> + <property name="javaType" value="int"/> + </bean> + </list> + </property> + <property name="valueFields"> + <list> + <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> + <property name="databaseName" value="PK"/> + <property name="databaseType"> + <util:constant static-field="java.sql.Types.INTEGER"/> + </property> + <property name="javaName" value="pk"/> + <property name="javaType" value="int"/> + </bean> + <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> + <property name="databaseName" value="BOOLCOL"/> + <property name="databaseType"> + <util:constant static-field="java.sql.Types.BOOLEAN"/> + </property> + <property name="javaName" value="boolcol"/> + <property name="javaType" value="java.lang.Boolean"/> + </bean> + <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> + <property name="databaseName" value="BYTECOL"/> + <property name="databaseType"> + <util:constant static-field="java.sql.Types.TINYINT"/> + </property> + <property name="javaName" value="bytecol"/> + <property name="javaType" value="java.lang.Byte"/> + </bean> + <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> + <property name="databaseName" value="SHORTCOL"/> + <property name="databaseType"> + <util:constant static-field="java.sql.Types.SMALLINT"/> + </property> + <property name="javaName" value="shortcol"/> + <property name="javaType" value="java.lang.Short"/> + </bean> + <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> + <property name="databaseName" value="INTCOL"/> + <property name="databaseType"> + <util:constant static-field="java.sql.Types.INTEGER"/> + </property> + <property name="javaName" value="intcol"/> + <property name="javaType" value="java.lang.Integer"/> + </bean> + <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> + <property name="databaseName" value="LONGCOL"/> + <property name="databaseType"> + <util:constant static-field="java.sql.Types.BIGINT"/> + </property> + <property name="javaName" value="longcol"/> + <property name="javaType" value="java.lang.Long"/> + </bean> + <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> + <property name="databaseName" value="FLOATCOL"/> + <property name="databaseType"> + <util:constant static-field="java.sql.Types.REAL"/> + </property> + <property name="javaName" value="floatcol"/> + <property name="javaType" value="java.lang.Float"/> + </bean> + <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> + <property name="databaseName" value="DOUBLECOL"/> + <property name="databaseType"> + <util:constant static-field="java.sql.Types.DOUBLE"/> + </property> + <property name="javaName" value="doublecol"/> + <property name="javaType" value="java.lang.Double"/> + </bean> + <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> + <property name="databaseName" value="DOUBLECOL2"/> + <property name="databaseType"> + <util:constant static-field="java.sql.Types.DOUBLE"/> + </property> + <property name="javaName" value="doublecol2"/> + <property name="javaType" value="java.lang.Double"/> + </bean> + <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> + <property name="databaseName" value="BIGDECIMALCOL"/> + <property name="databaseType"> + <util:constant static-field="java.sql.Types.DECIMAL"/> + </property> + <property name="javaName" value="bigdecimalcol"/> + <property name="javaType" value="java.math.BigDecimal"/> + </bean> + <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> + <property name="databaseName" value="STRCOL"/> + <property name="databaseType"> + <util:constant static-field="java.sql.Types.VARCHAR"/> + </property> + <property name="javaName" value="strcol"/> + <property name="javaType" value="java.lang.String"/> + </bean> + <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> + <property name="databaseName" value="DATECOL"/> + <property name="databaseType"> + <util:constant static-field="java.sql.Types.DATE"/> + </property> + <property name="javaName" value="datecol"/> + <property name="javaType" value="java.sql.Date"/> + </bean> + <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> + <property name="databaseName" value="TIMECOL"/> + <property name="databaseType"> + <util:constant static-field="java.sql.Types.TIME"/> + </property> + <property name="javaName" value="timecol"/> + <property name="javaType" value="java.sql.Time"/> + </bean> + <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> + <property name="databaseName" value="TSCOL"/> + <property name="databaseType"> + <util:constant static-field="java.sql.Types.TIMESTAMP"/> + </property> + <property name="javaName" value="tscol"/> + <property name="javaType" value="java.sql.Timestamp"/> + </bean> + <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> + <property name="databaseName" value="ARRCOL"/> + <property name="databaseType"> + <util:constant static-field="java.sql.Types.VARBINARY"/> + </property> + <property name="javaName" value="arrcol"/> + <property name="javaType" value="java.lang.Object"/> + </bean> + </list> + </property> + <property name="queryFields"> + <map> + <entry key="pk" value="int"/> + <entry key="boolcol" value="java.lang.Boolean"/> + <entry key="bytecol" value="java.lang.Byte"/> + <entry key="shortcol" value="java.lang.Short"/> + <entry key="intcol" value="java.lang.Integer"/> + <entry key="longcol" value="java.lang.Long"/> + <entry key="floatcol" value="java.lang.Float"/> + <entry key="doublecol" value="java.lang.Double"/> + <entry key="doublecol2" value="java.lang.Double"/> + <entry key="bigdecimalcol" value="java.math.BigDecimal"/> + <entry key="strcol" value="java.lang.String"/> + <entry key="datecol" value="java.sql.Date"/> + <entry key="timecol" value="java.sql.Time"/> + <entry key="tscol" value="java.sql.Timestamp"/> + <entry key="arrcol" value="java.lang.Object"/> + </map> + </property> + <property name="ascendingFields"> + <map> + <entry key="pk" value="int"/> + </map> + </property> + </bean> + <bean class="org.apache.ignite.cache.CacheTypeMetadata"> + <property name="databaseSchema" value="PUBLIC"/> + <property name="databaseTable" value="PRIMITIVES"/> + <property name="keyType" value="org.apache.ignite.schema.test.model.PrimitivesKey"/> + <property name="valueType" value="org.apache.ignite.schema.test.model.Primitives"/> + <property name="keyFields"> + <list> + <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> + <property name="databaseName" value="PK"/> + <property name="databaseType"> + <util:constant static-field="java.sql.Types.INTEGER"/> + </property> + <property name="javaName" value="pk"/> + <property name="javaType" value="int"/> + </bean> + </list> + </property> + <property name="valueFields"> + <list> + <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> + <property name="databaseName" value="PK"/> + <property name="databaseType"> + <util:constant static-field="java.sql.Types.INTEGER"/> + </property> + <property name="javaName" value="pk"/> + <property name="javaType" value="int"/> + </bean> + <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> + <property name="databaseName" value="BOOLCOL"/> + <property name="databaseType"> + <util:constant static-field="java.sql.Types.BOOLEAN"/> + </property> + <property name="javaName" value="boolcol"/> + <property name="javaType" value="boolean"/> + </bean> + <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> + <property name="databaseName" value="BYTECOL"/> + <property name="databaseType"> + <util:constant static-field="java.sql.Types.TINYINT"/> + </property> + <property name="javaName" value="bytecol"/> + <property name="javaType" value="byte"/> + </bean> + <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> + <property name="databaseName" value="SHORTCOL"/> + <property name="databaseType"> + <util:constant static-field="java.sql.Types.SMALLINT"/> + </property> + <property name="javaName" value="shortcol"/> + <property name="javaType" value="short"/> + </bean> + <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> + <property name="databaseName" value="INTCOL"/> + <property name="databaseType"> + <util:constant static-field="java.sql.Types.INTEGER"/> + </property> + <property name="javaName" value="intcol"/> + <property name="javaType" value="int"/> + </bean> + <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> + <property name="databaseName" value="LONGCOL"/> + <property name="databaseType"> + <util:constant static-field="java.sql.Types.BIGINT"/> + </property> + <property name="javaName" value="longcol"/> + <property name="javaType" value="long"/> + </bean> + <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> + <property name="databaseName" value="FLOATCOL"/> + <property name="databaseType"> + <util:constant static-field="java.sql.Types.REAL"/> + </property> + <property name="javaName" value="floatcol"/> + <property name="javaType" value="float"/> + </bean> + <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> + <property name="databaseName" value="DOUBLECOL"/> + <property name="databaseType"> + <util:constant static-field="java.sql.Types.DOUBLE"/> + </property> + <property name="javaName" value="doublecol"/> + <property name="javaType" value="double"/> + </bean> + <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> + <property name="databaseName" value="DOUBLECOL2"/> + <property name="databaseType"> + <util:constant static-field="java.sql.Types.DOUBLE"/> + </property> + <property name="javaName" value="doublecol2"/> + <property name="javaType" value="double"/> + </bean> + <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> + <property name="databaseName" value="BIGDECIMALCOL"/> + <property name="databaseType"> + <util:constant static-field="java.sql.Types.DECIMAL"/> + </property> + <property name="javaName" value="bigdecimalcol"/> + <property name="javaType" value="java.math.BigDecimal"/> + </bean> + <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> + <property name="databaseName" value="STRCOL"/> + <property name="databaseType"> + <util:constant static-field="java.sql.Types.VARCHAR"/> + </property> + <property name="javaName" value="strcol"/> + <property name="javaType" value="java.lang.String"/> + </bean> + <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> + <property name="databaseName" value="DATECOL"/> + <property name="databaseType"> + <util:constant static-field="java.sql.Types.DATE"/> + </property> + <property name="javaName" value="datecol"/> + <property name="javaType" value="java.sql.Date"/> + </bean> + <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> + <property name="databaseName" value="TIMECOL"/> + <property name="databaseType"> + <util:constant static-field="java.sql.Types.TIME"/> + </property> + <property name="javaName" value="timecol"/> + <property name="javaType" value="java.sql.Time"/> + </bean> + <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> + <property name="databaseName" value="TSCOL"/> + <property name="databaseType"> + <util:constant static-field="java.sql.Types.TIMESTAMP"/> + </property> + <property name="javaName" value="tscol"/> + <property name="javaType" value="java.sql.Timestamp"/> + </bean> + <bean class="org.apache.ignite.cache.CacheTypeFieldMetadata"> + <property name="databaseName" value="ARRCOL"/> + <property name="databaseType"> + <util:constant static-field="java.sql.Types.VARBINARY"/> + </property> + <property name="javaName" value="arrcol"/> + <property name="javaType" value="java.lang.Object"/> + </bean> + </list> + </property> + <property name="queryFields"> + <map> + <entry key="pk" value="int"/> + <entry key="boolcol" value="boolean"/> + <entry key="bytecol" value="byte"/> + <entry key="shortcol" value="short"/> + <entry key="intcol" value="int"/> + <entry key="longcol" value="long"/> + <entry key="floatcol" value="float"/> + <entry key="doublecol" value="double"/> + <entry key="doublecol2" value="double"/> + <entry key="bigdecimalcol" value="java.math.BigDecimal"/> + <entry key="strcol" value="java.lang.String"/> + <entry key="datecol" value="java.sql.Date"/> + <entry key="timecol" value="java.sql.Time"/> + <entry key="tscol" value="java.sql.Timestamp"/> + <entry key="arrcol" value="java.lang.Object"/> + </map> + </property> + <property name="ascendingFields"> + <map> + <entry key="pk" value="int"/> + </map> + </property> + </bean> +</beans> http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e8d71b55/modules/schema-import-ui/src/test/java/org/apache/ignite/schema/test/parser/DbMetadataParserTest.java ---------------------------------------------------------------------- diff --git a/modules/schema-import-ui/src/test/java/org/apache/ignite/schema/test/parser/DbMetadataParserTest.java b/modules/schema-import-ui/src/test/java/org/apache/ignite/schema/test/parser/DbMetadataParserTest.java new file mode 100644 index 0000000..9fc12e7 --- /dev/null +++ b/modules/schema-import-ui/src/test/java/org/apache/ignite/schema/test/parser/DbMetadataParserTest.java @@ -0,0 +1,118 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.schema.test.parser; + +import org.apache.ignite.schema.model.*; +import org.apache.ignite.schema.test.*; + +import java.math.*; +import java.sql.Date; +import java.sql.*; +import java.util.*; + +/** + * Tests for metadata parsing. + */ +public class DbMetadataParserTest extends AbstractSchemaImportTest { + /** + * Check that field is correspond to expected. + * + * @param field Field descriptor. + * @param name Expected field name. + * @param primitive Expected field primitive type. + * @param cls Expected field type. + */ + private void checkField(PojoField field, String name, boolean primitive, Class<?> cls) { + assertEquals("Name of field should be " + name, name, field.javaName()); + + assertEquals("Type of field should be " + cls.getName(), cls.getName(), field.javaTypeName()); + + assertEquals("Field primitive should be " + primitive, primitive, field.primitive()); + } + + /** + * Check that type is correspond to expected. + * + * @param type Type descriptor. + */ + private void checkType(PojoDescriptor type) { + assertFalse("Type key class name should be defined", type.keyClassName().isEmpty()); + + assertFalse("Type value class name should be defined", type.valueClassName().isEmpty()); + + Collection<PojoField> keyFields = type.keyFields(); + + assertEquals("Key type should have 1 field", 1, keyFields.size()); + + checkField(keyFields.iterator().next(), "pk", true, int.class); + + List<PojoField> fields = type.fields(); + + assertEquals("Value type should have 15 fields", 15, fields.size()); + + Iterator<PojoField> fieldsIt = fields.iterator(); + + checkField(fieldsIt.next(), "pk", true, int.class); + + if ("Objects".equals(type.valueClassName())) { + checkField(fieldsIt.next(), "boolcol", false, Boolean.class); + checkField(fieldsIt.next(), "bytecol", false, Byte.class); + checkField(fieldsIt.next(), "shortcol", false, Short.class); + checkField(fieldsIt.next(), "intcol", false, Integer.class); + checkField(fieldsIt.next(), "longcol", false, Long.class); + checkField(fieldsIt.next(), "floatcol", false, Float.class); + checkField(fieldsIt.next(), "doublecol", false, Double.class); + checkField(fieldsIt.next(), "doublecol2", false, Double.class); + } + else { + checkField(fieldsIt.next(), "boolcol", true, boolean.class); + checkField(fieldsIt.next(), "bytecol", true, byte.class); + checkField(fieldsIt.next(), "shortcol", true, short.class); + checkField(fieldsIt.next(), "intcol", true, int.class); + checkField(fieldsIt.next(), "longcol", true, long.class); + checkField(fieldsIt.next(), "floatcol", true, float.class); + checkField(fieldsIt.next(), "doublecol", true, double.class); + checkField(fieldsIt.next(), "doublecol2", true, double.class); + } + + checkField(fieldsIt.next(), "bigdecimalcol", false, BigDecimal.class); + checkField(fieldsIt.next(), "strcol", false, String.class); + checkField(fieldsIt.next(), "datecol", false, Date.class); + checkField(fieldsIt.next(), "timecol", false, Time.class); + checkField(fieldsIt.next(), "tscol", false, Timestamp.class); + checkField(fieldsIt.next(), "arrcol", false, Object.class); + } + + /** + * Test that metadata generated correctly. + */ + public void testCheckMetadata() { + assertEquals("Metadata should contain 3 element", 3, pojos.size()); + + Iterator<PojoDescriptor> it = pojos.iterator(); + + PojoDescriptor schema = it.next(); + + assertTrue("First element is schema description. Its class name should be empty", + schema.valueClassName().isEmpty()); + + checkType(it.next()); + + checkType(it.next()); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e8d71b55/modules/schema-import-ui/src/test/java/org/apache/ignite/schema/test/testsuites/IgniteSchemaImportTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/schema-import-ui/src/test/java/org/apache/ignite/schema/test/testsuites/IgniteSchemaImportTestSuite.java b/modules/schema-import-ui/src/test/java/org/apache/ignite/schema/test/testsuites/IgniteSchemaImportTestSuite.java new file mode 100644 index 0000000..571264e --- /dev/null +++ b/modules/schema-import-ui/src/test/java/org/apache/ignite/schema/test/testsuites/IgniteSchemaImportTestSuite.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.schema.test.testsuites; + +import junit.framework.*; +import org.apache.ignite.schema.test.generator.*; +import org.apache.ignite.schema.test.parser.*; + +/** + * Ignite Schema Import Utility Tests. + */ +public class IgniteSchemaImportTestSuite { + /** + * @return Test suite. + * @throws Exception Thrown in case of the failure. + */ + public static TestSuite suite() throws Exception { + TestSuite suite = new TestSuite("Ignite Apache Schema Import Utility Test Suite"); + + suite.addTestSuite(CodeGeneratorTest.class); + suite.addTestSuite(XmlGeneratorTest.class); + suite.addTestSuite(DbMetadataParserTest.class); + + return suite; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e8d71b55/modules/schema-import/pom.xml ---------------------------------------------------------------------- diff --git a/modules/schema-import/pom.xml b/modules/schema-import/pom.xml index 7364e1e..9eb7971 100644 --- a/modules/schema-import/pom.xml +++ b/modules/schema-import/pom.xml @@ -66,39 +66,5 @@ </excludes> </testResource> </testResources> - - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-jar-plugin</artifactId> - <configuration> - <archive> - <manifest> - <mainClass>org.apache.ignite.schema.ui.SchemaImportApp</mainClass> - </manifest> - </archive> - </configuration> - </plugin> - </plugins> </build> - - <profiles> - <profile> - <id>schema-import</id> - <activation> - <file> - <exists>${java.home}/lib/jfxrt.jar</exists> - </file> - </activation> - <dependencies> - <dependency> - <groupId>javafx</groupId> - <artifactId>jfxrt</artifactId> - <version>${java.version}</version> - <scope>system</scope> - <systemPath>${java.home}/lib/jfxrt.jar</systemPath> - </dependency> - </dependencies> - </profile> - </profiles> </project> http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e8d71b55/modules/schema-import/src/main/java/media/data_connection_48x48.png ---------------------------------------------------------------------- diff --git a/modules/schema-import/src/main/java/media/data_connection_48x48.png b/modules/schema-import/src/main/java/media/data_connection_48x48.png deleted file mode 100644 index 475f219..0000000 Binary files a/modules/schema-import/src/main/java/media/data_connection_48x48.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e8d71b55/modules/schema-import/src/main/java/media/error_48x48.png ---------------------------------------------------------------------- diff --git a/modules/schema-import/src/main/java/media/error_48x48.png b/modules/schema-import/src/main/java/media/error_48x48.png deleted file mode 100644 index e341b8a..0000000 Binary files a/modules/schema-import/src/main/java/media/error_48x48.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e8d71b55/modules/schema-import/src/main/java/media/ignite_128x128.png ---------------------------------------------------------------------- diff --git a/modules/schema-import/src/main/java/media/ignite_128x128.png b/modules/schema-import/src/main/java/media/ignite_128x128.png deleted file mode 100644 index d99a83c..0000000 Binary files a/modules/schema-import/src/main/java/media/ignite_128x128.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e8d71b55/modules/schema-import/src/main/java/media/ignite_16x16.png ---------------------------------------------------------------------- diff --git a/modules/schema-import/src/main/java/media/ignite_16x16.png b/modules/schema-import/src/main/java/media/ignite_16x16.png deleted file mode 100644 index 3e07d33..0000000 Binary files a/modules/schema-import/src/main/java/media/ignite_16x16.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e8d71b55/modules/schema-import/src/main/java/media/ignite_24x24.png ---------------------------------------------------------------------- diff --git a/modules/schema-import/src/main/java/media/ignite_24x24.png b/modules/schema-import/src/main/java/media/ignite_24x24.png deleted file mode 100644 index 8da5c97..0000000 Binary files a/modules/schema-import/src/main/java/media/ignite_24x24.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e8d71b55/modules/schema-import/src/main/java/media/ignite_32x32.png ---------------------------------------------------------------------- diff --git a/modules/schema-import/src/main/java/media/ignite_32x32.png b/modules/schema-import/src/main/java/media/ignite_32x32.png deleted file mode 100644 index c6c6819..0000000 Binary files a/modules/schema-import/src/main/java/media/ignite_32x32.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e8d71b55/modules/schema-import/src/main/java/media/ignite_48x48.png ---------------------------------------------------------------------- diff --git a/modules/schema-import/src/main/java/media/ignite_48x48.png b/modules/schema-import/src/main/java/media/ignite_48x48.png deleted file mode 100644 index 5b684cc..0000000 Binary files a/modules/schema-import/src/main/java/media/ignite_48x48.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e8d71b55/modules/schema-import/src/main/java/media/ignite_64x64.png ---------------------------------------------------------------------- diff --git a/modules/schema-import/src/main/java/media/ignite_64x64.png b/modules/schema-import/src/main/java/media/ignite_64x64.png deleted file mode 100644 index c1d348b..0000000 Binary files a/modules/schema-import/src/main/java/media/ignite_64x64.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e8d71b55/modules/schema-import/src/main/java/media/information_48x48.png ---------------------------------------------------------------------- diff --git a/modules/schema-import/src/main/java/media/information_48x48.png b/modules/schema-import/src/main/java/media/information_48x48.png deleted file mode 100644 index 8712a1b..0000000 Binary files a/modules/schema-import/src/main/java/media/information_48x48.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e8d71b55/modules/schema-import/src/main/java/media/question_48x48.png ---------------------------------------------------------------------- diff --git a/modules/schema-import/src/main/java/media/question_48x48.png b/modules/schema-import/src/main/java/media/question_48x48.png deleted file mode 100644 index 84683f9..0000000 Binary files a/modules/schema-import/src/main/java/media/question_48x48.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e8d71b55/modules/schema-import/src/main/java/media/sign_warning_48x48.png ---------------------------------------------------------------------- diff --git a/modules/schema-import/src/main/java/media/sign_warning_48x48.png b/modules/schema-import/src/main/java/media/sign_warning_48x48.png deleted file mode 100644 index 5e7cccd..0000000 Binary files a/modules/schema-import/src/main/java/media/sign_warning_48x48.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e8d71b55/modules/schema-import/src/main/java/media/style.css ---------------------------------------------------------------------- diff --git a/modules/schema-import/src/main/java/media/style.css b/modules/schema-import/src/main/java/media/style.css deleted file mode 100644 index 6eee5f9..0000000 --- a/modules/schema-import/src/main/java/media/style.css +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -.root { - -fx-background-color: eeeeee; -} - -.button { - -fx-font-size: 14; - -fx-focus-color: gray; -} - -.label { - -fx-font-size: 14; -} - -.check-box { - -fx-font-size: 14; - -fx-focus-color: gray; -} - -.combo-box-base { - -fx-font-size: 14; - -fx-focus-color: gray; -} - -.combo-box-popup .list-view { - -fx-font-size : 14; -} - -.text-area { - -fx-font-size: 14; - -fx-background-color: transparent, transparent, transparent; -} - -.text-area .scroll-pane { - -fx-background-color: transparent; -} - -.text-area .scroll-pane .viewport{ - -fx-background-color: transparent; -} - -.text-area .scroll-pane .content{ - -fx-background-color: transparent; -} - -.text-area .scroll-bar:vertical:disabled { - -fx-opacity: 0; -} - -.text-field { - -fx-font-size: 14; - -fx-background-color: -fx-text-box-border, -fx-control-inner-background, -fx-control-inner-background; -} - -.text-field:focused { - -fx-background-color: -fx-text-box-border, -fx-control-inner-background, -fx-control-inner-background; -} - -.table-view { - -fx-focus-color: gray; - -fx-font-size: 14; -} - -.table-view .table-row-cell:selected { - -fx-background-color: -fx-table-cell-border-color, -fx-cell-hover-color; - -fx-background-insets: 0, 0 0 1 0; -} - -.table-view:focused .table-row-cell:selected { - -fx-background-color: -fx-focus-color, -fx-cell-focus-inner-border, -fx-selection-bar; -} - -.table-row-cell:empty { - -fx-background-color: white; -} - -.table-row-cell:empty .table-cell { - -fx-border-width: 0px; -} - -.tooltip { - -fx-font-size: 14; - -fx-background-radius: 0 0 0 0; -} - -.page-corner { - -fx-shape: " "; -} - -.progress-indicator { - -fx-progress-color: gray -} - -.split-pane { - -fx-background-color: -fx-box-border, eeeeee; -} - -.titled-pane { - -fx-font-size: 14; -} - -.titled-pane:focused { - -fx-text-fill: -fx-text-base-color; -} - -.titled-pane:focused > .title { - -fx-color: eeeeee; -} - -.titled-pane:focused > .title > .arrow-button .arrow { - -fx-background-color: black; -} - -#banner { - -fx-font-size: 20px; - -fx-font-weight: bold; - -fx-background-color: white -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e8d71b55/modules/schema-import/src/main/java/media/text_tree_48x48.png ---------------------------------------------------------------------- diff --git a/modules/schema-import/src/main/java/media/text_tree_48x48.png b/modules/schema-import/src/main/java/media/text_tree_48x48.png deleted file mode 100644 index 6ca9e65..0000000 Binary files a/modules/schema-import/src/main/java/media/text_tree_48x48.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e8d71b55/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/CodeGenerator.java ---------------------------------------------------------------------- diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/CodeGenerator.java b/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/CodeGenerator.java index b92d84b..66b45cc 100644 --- a/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/CodeGenerator.java +++ b/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/CodeGenerator.java @@ -18,14 +18,13 @@ package org.apache.ignite.schema.generator; import org.apache.ignite.schema.model.*; -import org.apache.ignite.schema.ui.*; import java.io.*; import java.text.*; import java.util.*; import java.util.regex.*; -import static org.apache.ignite.schema.ui.MessageBox.Result.*; +import static org.apache.ignite.schema.generator.ConfirmOverride.Result.*; /** * Code generator of POJOs for key and value classes and configuration snippet. @@ -259,7 +258,7 @@ public class CodeGenerator { * @throws IOException If failed to write generated code into file. */ private static void generateCode(PojoDescriptor pojo, boolean key, String pkg, File pkgFolder, - boolean constructor, boolean includeKeys, ConfirmCallable askOverwrite) throws IOException { + boolean constructor, boolean includeKeys, ConfirmOverride askOverwrite) throws IOException { String type = key ? pojo.keyClassName() : pojo.valueClassName(); File out = new File(pkgFolder, type + ".java"); @@ -268,12 +267,12 @@ public class CodeGenerator { checkValidJavaIdentifier(type, false, "Type", type); if (out.exists()) { - MessageBox.Result choice = askOverwrite.confirm(out.getName()); + ConfirmOverride.Result choice = askOverwrite.confirm(out.getName()); if (CANCEL == choice) throw new IllegalStateException("POJO generation was canceled!"); - if (NO == choice || NO_TO_ALL == choice) + if (NO == choice) return; } @@ -510,7 +509,7 @@ public class CodeGenerator { * @throws IOException If failed to write generated code into file. */ public static void pojos(PojoDescriptor pojo, String outFolder, String pkg, boolean constructor, - boolean includeKeys, ConfirmCallable askOverwrite) throws IOException { + boolean includeKeys, ConfirmOverride askOverwrite) throws IOException { File pkgFolder = new File(outFolder, pkg.replace('.', File.separatorChar)); if (!pkgFolder.exists() && !pkgFolder.mkdirs()) @@ -582,18 +581,18 @@ public class CodeGenerator { * @throws IOException If generation failed. */ public static void snippet(Collection<PojoDescriptor> pojos, String pkg, boolean includeKeys, - String outFolder, ConfirmCallable askOverwrite) throws IOException { + String outFolder, ConfirmOverride askOverwrite) throws IOException { File pkgFolder = new File(outFolder, pkg.replace('.', File.separatorChar)); File cacheCfg = new File(pkgFolder, "CacheConfig.java"); if (cacheCfg.exists()) { - MessageBox.Result choice = askOverwrite.confirm(cacheCfg.getName()); + ConfirmOverride.Result choice = askOverwrite.confirm(cacheCfg.getName()); if (CANCEL == choice) throw new IllegalStateException("Java snippet generation was canceled!"); - if (NO == choice || NO_TO_ALL == choice) + if (NO == choice) return; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e8d71b55/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/ConfirmOverride.java ---------------------------------------------------------------------- diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/ConfirmOverride.java b/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/ConfirmOverride.java new file mode 100644 index 0000000..5e56a0f --- /dev/null +++ b/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/ConfirmOverride.java @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.schema.generator; + +/** + * + */ +public interface ConfirmOverride { + /** + * @param msg Message. + */ + public Result confirm(String msg); + + /** + * + */ + enum Result { + /** */ + OVERRIDE, + + /** */ + CANCEL, + + /** */ + NO + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e8d71b55/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/XmlGenerator.java ---------------------------------------------------------------------- diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/XmlGenerator.java b/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/XmlGenerator.java index 6ab04dd..48513db 100644 --- a/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/XmlGenerator.java +++ b/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/XmlGenerator.java @@ -20,7 +20,6 @@ package org.apache.ignite.schema.generator; import org.apache.ignite.cache.*; import org.apache.ignite.lang.*; import org.apache.ignite.schema.model.*; -import org.apache.ignite.schema.ui.*; import org.w3c.dom.*; import javax.xml.parsers.*; @@ -32,8 +31,6 @@ import java.nio.file.*; import java.text.*; import java.util.*; -import static org.apache.ignite.schema.ui.MessageBox.Result.*; - /** * Generator of XML files for type metadata. */ @@ -263,7 +260,7 @@ public class XmlGenerator { * @param askOverwrite Callback to ask user to confirm file overwrite. */ public static void generate(String pkg, PojoDescriptor pojo, boolean includeKeys, File out, - ConfirmCallable askOverwrite) { + ConfirmOverride askOverwrite) { generate(pkg, Collections.singleton(pojo), includeKeys, out, askOverwrite); } @@ -276,7 +273,7 @@ public class XmlGenerator { * @param askOverwrite Callback to ask user to confirm file overwrite. */ public static void generate(String pkg, Collection<PojoDescriptor> pojos, boolean includeKeys, File out, - ConfirmCallable askOverwrite) { + ConfirmOverride askOverwrite) { File outFolder = out.getParentFile(); @@ -288,12 +285,12 @@ public class XmlGenerator { try { if (out.exists()) { - MessageBox.Result choice = askOverwrite.confirm(out.getName()); + ConfirmOverride.Result choice = askOverwrite.confirm(out.getName()); - if (CANCEL == choice) + if (ConfirmOverride.Result.CANCEL == choice) throw new IllegalStateException("XML generation was canceled!"); - if (NO == choice || NO_TO_ALL == choice) + if (ConfirmOverride.Result.NO == choice) return; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e8d71b55/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoDescriptor.java ---------------------------------------------------------------------- diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoDescriptor.java b/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoDescriptor.java index 5e1da06..1c5d059 100644 --- a/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoDescriptor.java +++ b/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoDescriptor.java @@ -17,10 +17,8 @@ package org.apache.ignite.schema.model; -import javafx.beans.property.*; -import javafx.beans.value.*; -import javafx.collections.*; import org.apache.ignite.schema.parser.*; +import org.apache.ignite.schema.utils.*; import java.math.*; import java.util.*; @@ -35,19 +33,19 @@ public class PojoDescriptor { private final DbTable tbl; /** Selected property. */ - private final BooleanProperty useProp; + private final Property<Boolean> useProp; /** Previous name for key class. */ private final String keyClsNamePrev; /** Key class name to show on screen. */ - private final StringProperty keyClsNameProp; + private final Property<String> keyClsNameProp; /** Previous name for value class. */ private final String valClsNamePrev; /** Value class name to show on screen. */ - private final StringProperty valClsNameProp; + private final Property<String> valClsNameProp; /** Parent item (schema name). */ private final PojoDescriptor parent; @@ -56,13 +54,13 @@ public class PojoDescriptor { private Collection<PojoDescriptor> children = Collections.emptyList(); /** Indeterminate state of parent. */ - private final BooleanProperty indeterminateProp = new SimpleBooleanProperty(false); + private final Property<Boolean> indeterminateProp = new Property<>(false); /** Full database name: schema + table. */ private final String fullDbName; /** Java class fields. */ - private final ObservableList<PojoField> fields; + private final List<PojoField> fields; /** Fields map for quick access. */ private final Map<String, PojoField> fieldsMap; @@ -81,10 +79,10 @@ public class PojoDescriptor { fullDbName = tbl.schema() + "." + tbl.table(); valClsNamePrev = toJavaClassName(tbl.table()); - valClsNameProp = new SimpleStringProperty(valClsNamePrev); + valClsNameProp = new Property<>(valClsNamePrev); keyClsNamePrev = valClsNamePrev.isEmpty() ? "" : valClsNamePrev + "Key"; - keyClsNameProp = new SimpleStringProperty(keyClsNamePrev); + keyClsNameProp = new Property<>(keyClsNamePrev); Collection<DbColumn> cols = tbl.columns(); @@ -106,19 +104,19 @@ public class PojoDescriptor { fieldsMap.put(colName, fld); } - fields = FXCollections.observableList(flds); + fields = flds; boolean isTbl = parent != null; boolean hasKeys = !isTbl || !keyFields().isEmpty(); - useProp = new SimpleBooleanProperty(hasKeys); + useProp = new Property<>(hasKeys); if (isTbl && !hasKeys && !parent.indeterminateProp.get()) parent.indeterminateProp.set(true); useProp.addListener(new ChangeListener<Boolean>() { - @Override public void changed(ObservableValue<? extends Boolean> val, Boolean oldVal, Boolean newVal) { + @Override public void changed(Property<? extends Boolean> val, Boolean oldVal, Boolean newVal) { for (PojoDescriptor child : children) child.useProp.set(newVal); @@ -169,14 +167,14 @@ public class PojoDescriptor { /** * @return Boolean property support for {@code use} property. */ - public BooleanProperty useProperty() { + public Property<Boolean> useProperty() { return useProp; } /** * @return Boolean property support for parent {@code indeterminate} property. */ - public BooleanProperty indeterminate() { + public Property<Boolean> indeterminate() { return indeterminateProp; } @@ -336,14 +334,14 @@ public class PojoDescriptor { /** * @return Key class name property. */ - public StringProperty keyClassNameProperty() { + public Property<String> keyClassNameProperty() { return keyClsNameProp; } /** * @return Value class name property. */ - public StringProperty valueClassNameProperty() { + public Property<String> valueClassNameProperty() { return valClsNameProp; } @@ -409,7 +407,7 @@ public class PojoDescriptor { /** * @return Java class fields. */ - public ObservableList<PojoField> fields() { + public List<PojoField> fields() { return fields; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e8d71b55/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoField.java ---------------------------------------------------------------------- diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoField.java b/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoField.java index 88e4008..48b520f 100644 --- a/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoField.java +++ b/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoField.java @@ -17,9 +17,7 @@ package org.apache.ignite.schema.model; -import javafx.beans.property.*; -import javafx.beans.value.*; -import javafx.collections.*; +import org.apache.ignite.schema.utils.*; import java.math.*; import java.util.*; @@ -31,31 +29,31 @@ import static java.sql.Types.*; */ public class PojoField { /** If this field should be used for code generation. */ - private final BooleanProperty useProp; + private final Property<Boolean> useProp; /** If this field belongs to primary key. */ - private final BooleanProperty keyProp; + private final Property<Boolean> keyProp; /** If this field is an affinity key. */ - private final BooleanProperty akProp; + private final Property<Boolean> akProp; /** If this field initially belongs to primary key. */ private final boolean keyPrev; /** Field name in database. */ - private final StringProperty dbNameProp; + private final Property<String> dbNameProp; /** Field type in database. */ - private final StringProperty dbTypeNameProp; + private final Property<String> dbTypeNameProp; /** Field name in POJO. */ - private final StringProperty javaNameProp; + private final Property<String> javaNameProp; /** Initial field name in POJO. */ private final String javaNamePrev; /** Field type in POJO. */ - private final StringProperty javaTypeNameProp; + private final Property<String> javaTypeNameProp; /** Initial field type in POJO. */ private final String javaTypeNamePrev; @@ -64,7 +62,7 @@ public class PojoField { private final boolean nullable; /** List of possible java type conversions. */ - private final ObservableList<String> conversions; + private final List<String> conversions; /** Field owner. */ private PojoDescriptor owner; @@ -83,10 +81,10 @@ public class PojoField { } /** Null number conversions. */ - private static final ObservableList<String> NULL_NUM_CONVERSIONS = FXCollections.observableArrayList(); + private static final List<String> NULL_NUM_CONVERSIONS = new ArrayList<>(); /** Not null number conversions. */ - private static final ObservableList<String> NOT_NULL_NUM_CONVERSIONS = FXCollections.observableArrayList(); + private static final List<String> NOT_NULL_NUM_CONVERSIONS = new ArrayList<>(); /** Primitive types. */ private static final List<String> PRIMITIVES = classNames(boolean.class, byte.class, short.class, @@ -109,7 +107,7 @@ public class PojoField { * @param dflt Default. * @return List of possible type conversions. */ - private static ObservableList<String> conversions(int dbType, boolean nullable, String dflt) { + private static List<String> conversions(int dbType, boolean nullable, String dflt) { switch (dbType) { case TINYINT: case SMALLINT: @@ -121,7 +119,7 @@ public class PojoField { return nullable ? NULL_NUM_CONVERSIONS : NOT_NULL_NUM_CONVERSIONS; default: - return FXCollections.singletonObservableList(dflt); + return Collections.singletonList(dflt); } } @@ -134,32 +132,32 @@ public class PojoField { * @param nullable {@code true} if {@code NULL} allowed for field in database. */ public PojoField(String dbName, int dbType, String javaName, String javaTypeName, boolean key, boolean nullable) { - dbNameProp = new SimpleStringProperty(dbName); + dbNameProp = new Property<>(dbName); - dbTypeNameProp = new SimpleStringProperty(jdbcTypeName(dbType)); + dbTypeNameProp = new Property<>(jdbcTypeName(dbType)); javaNamePrev = javaName; - javaNameProp = new SimpleStringProperty(javaNamePrev); + javaNameProp = new Property<>(javaNamePrev); javaTypeNamePrev = javaTypeName; - javaTypeNameProp = new SimpleStringProperty(javaTypeNamePrev); + javaTypeNameProp = new Property<>(javaTypeNamePrev); - useProp = new SimpleBooleanProperty(true); + useProp = new Property<>(true); keyPrev = key; - keyProp = new SimpleBooleanProperty(keyPrev); + keyProp = new Property<>(keyPrev); this.nullable = nullable; - akProp = new SimpleBooleanProperty(false); + akProp = new Property<>(false); conversions = conversions(dbType, nullable, javaNamePrev); keyProp.addListener(new ChangeListener<Boolean>() { - @Override public void changed(ObservableValue<? extends Boolean> val, Boolean oldVal, Boolean newVal) { + @Override public void changed(Property<? extends Boolean> val, Boolean oldVal, Boolean newVal) { if (newVal) { if (!use()) useProp.set(true); @@ -170,7 +168,7 @@ public class PojoField { }); akProp.addListener(new ChangeListener<Boolean>() { - @Override public void changed(ObservableValue<? extends Boolean> val, Boolean oldVal, Boolean newVal) { + @Override public void changed(Property<? extends Boolean> val, Boolean oldVal, Boolean newVal) { if (newVal && owner != null) { keyProperty().set(true); @@ -352,7 +350,7 @@ public class PojoField { /** * @return List of possible java type conversions. */ - public ObservableList<String> conversions() { + public List<String> conversions() { return conversions; } @@ -373,49 +371,49 @@ public class PojoField { /** * @return Boolean property support for {@code use} property. */ - public BooleanProperty useProperty() { + public Property<Boolean> useProperty() { return useProp; } /** * @return Boolean property support for {@code key} property. */ - public BooleanProperty keyProperty() { + public Property<Boolean> keyProperty() { return keyProp; } /** * @return Boolean property support for {@code affinityKey} property. */ - public BooleanProperty affinityKeyProperty() { + public Property<Boolean> affinityKeyProperty() { return akProp; } /** * @return String property support for {@code javaName} property. */ - public StringProperty javaNameProperty() { + public Property<String> javaNameProperty() { return javaNameProp; } /** * @return String property support for {@code javaTypeName} property. */ - public StringProperty javaTypeNameProperty() { + public Property<String> javaTypeNameProperty() { return javaTypeNameProp; } /** * @return String property support for {@code dbName} property. */ - public StringProperty dbNameProperty() { + public Property<String> dbNameProperty() { return dbNameProp; } /** * @return String property support for {@code dbName} property. */ - public StringProperty dbTypeNameProperty() { + public Property<String> dbTypeNameProperty() { return dbTypeNameProp; } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e8d71b55/modules/schema-import/src/main/java/org/apache/ignite/schema/parser/DatabaseMetadataParser.java ---------------------------------------------------------------------- diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/parser/DatabaseMetadataParser.java b/modules/schema-import/src/main/java/org/apache/ignite/schema/parser/DatabaseMetadataParser.java index 696ca62..1c2eedb 100644 --- a/modules/schema-import/src/main/java/org/apache/ignite/schema/parser/DatabaseMetadataParser.java +++ b/modules/schema-import/src/main/java/org/apache/ignite/schema/parser/DatabaseMetadataParser.java @@ -17,7 +17,6 @@ package org.apache.ignite.schema.parser; -import javafx.collections.*; import org.apache.ignite.schema.model.*; import org.apache.ignite.schema.parser.dialect.*; @@ -40,7 +39,7 @@ public class DatabaseMetadataParser { * @return Collection of POJO descriptors. * @throws SQLException If parsing failed. */ - public static ObservableList<PojoDescriptor> parse(Connection conn, boolean tblsOnly) throws SQLException { + public static List<PojoDescriptor> parse(Connection conn, boolean tblsOnly) throws SQLException { DatabaseMetadataDialect dialect; try { @@ -103,6 +102,6 @@ public class DatabaseMetadataParser { } }); - return FXCollections.observableList(res); + return res; } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e8d71b55/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/ConfirmCallable.java ---------------------------------------------------------------------- diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/ConfirmCallable.java b/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/ConfirmCallable.java deleted file mode 100644 index 8321d96..0000000 --- a/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/ConfirmCallable.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.schema.ui; - -import javafx.application.*; -import javafx.stage.*; - -import java.util.concurrent.*; - -import static org.apache.ignite.schema.ui.MessageBox.Result.*; - -/** - * Callable to ask user for confirmation from non EDT thread. - */ -public class ConfirmCallable implements Callable<MessageBox.Result> { - /** Owner window. */ - private final Stage owner; - - /** Message template. */ - private final String template; - - /** Message to show in confirmation dialog. */ - private String msg; - - /** User choice. */ - private MessageBox.Result choice = NO; - - /** - * @param owner Owner window. - * @param template Message template. - */ - public ConfirmCallable(Stage owner, String template) { - this.owner = owner; - this.template = template; - } - - /** {@inheritDoc} */ - @Override public MessageBox.Result call() throws Exception { - choice = MessageBox.applyToAllChoiceDialog(owner, String.format(template, msg)); - - return choice; - } - - /** - * Execute confirmation in EDT thread. - * - * @return Confirm result. - */ - public MessageBox.Result confirm(String msg) { - this.msg = msg; - - if (choice == YES_TO_ALL || choice == NO_TO_ALL) - return choice; - - FutureTask<MessageBox.Result> fut = new FutureTask<>(this); - - Platform.runLater(fut); - - try { - return fut.get(); - } - catch (Exception ignored) { - return NO; - } - } -}