Skip to content

Commit

Permalink
[#7747] Rename jooq-codegen.xsd Schema, Schemata, Catalog, Catalogs t…
Browse files Browse the repository at this point in the history
…ypes to have a Type suffix
  • Loading branch information
lukaseder committed Aug 10, 2018
1 parent 69ae589 commit 7373ad1
Show file tree
Hide file tree
Showing 12 changed files with 91 additions and 136 deletions.
16 changes: 8 additions & 8 deletions jOOQ-codegen/src/main/java/org/jooq/codegen/GenerationTool.java
Expand Up @@ -76,14 +76,14 @@
import org.jooq.meta.Databases; import org.jooq.meta.Databases;
import org.jooq.meta.Definition; import org.jooq.meta.Definition;
import org.jooq.meta.SchemaVersionProvider; import org.jooq.meta.SchemaVersionProvider;
import org.jooq.meta.jaxb.Catalog; import org.jooq.meta.jaxb.CatalogMappingType;
import org.jooq.meta.jaxb.Configuration; import org.jooq.meta.jaxb.Configuration;
import org.jooq.meta.jaxb.Generate; import org.jooq.meta.jaxb.Generate;
import org.jooq.meta.jaxb.Jdbc; import org.jooq.meta.jaxb.Jdbc;
import org.jooq.meta.jaxb.Logging; import org.jooq.meta.jaxb.Logging;
import org.jooq.meta.jaxb.Matchers; import org.jooq.meta.jaxb.Matchers;
import org.jooq.meta.jaxb.Property; import org.jooq.meta.jaxb.Property;
import org.jooq.meta.jaxb.Schema; import org.jooq.meta.jaxb.SchemaMappingType;
import org.jooq.meta.jaxb.Strategy; import org.jooq.meta.jaxb.Strategy;
import org.jooq.meta.jaxb.Target; import org.jooq.meta.jaxb.Target;
// ... // ...
Expand Down Expand Up @@ -368,15 +368,15 @@ public void run(Configuration configuration) throws Exception {
database = databaseClass.newInstance(); database = databaseClass.newInstance();
database.setProperties(properties(d.getProperties())); database.setProperties(properties(d.getProperties()));


List<Catalog> catalogs = d.getCatalogs(); List<CatalogMappingType> catalogs = d.getCatalogs();
List<Schema> schemata = d.getSchemata(); List<SchemaMappingType> schemata = d.getSchemata();


boolean catalogsEmpty = catalogs.isEmpty(); boolean catalogsEmpty = catalogs.isEmpty();
boolean schemataEmpty = schemata.isEmpty(); boolean schemataEmpty = schemata.isEmpty();


// For convenience, the catalog configuration can be set also directly in the <database/> element // For convenience, the catalog configuration can be set also directly in the <database/> element
if (catalogsEmpty) { if (catalogsEmpty) {
Catalog catalog = new Catalog(); CatalogMappingType catalog = new CatalogMappingType();
catalog.setInputCatalog(trim(d.getInputCatalog())); catalog.setInputCatalog(trim(d.getInputCatalog()));
catalog.setOutputCatalog(trim(d.getOutputCatalog())); catalog.setOutputCatalog(trim(d.getOutputCatalog()));
catalog.setOutputCatalogToDefault(d.isOutputCatalogToDefault()); catalog.setOutputCatalogToDefault(d.isOutputCatalogToDefault());
Expand All @@ -388,7 +388,7 @@ public void run(Configuration configuration) throws Exception {
// For convenience and backwards-compatibility, the schema configuration can be set also directly // For convenience and backwards-compatibility, the schema configuration can be set also directly
// in the <database/> element // in the <database/> element
if (schemataEmpty) { if (schemataEmpty) {
Schema schema = new Schema(); SchemaMappingType schema = new SchemaMappingType();
schema.setInputSchema(trim(d.getInputSchema())); schema.setInputSchema(trim(d.getInputSchema()));
schema.setOutputSchema(trim(d.getOutputSchema())); schema.setOutputSchema(trim(d.getOutputSchema()));
schema.setOutputSchemaToDefault(d.isOutputSchemaToDefault()); schema.setOutputSchemaToDefault(d.isOutputSchemaToDefault());
Expand Down Expand Up @@ -419,7 +419,7 @@ public void run(Configuration configuration) throws Exception {
log.warn("WARNING: Cannot combine configuration properties /configuration/generator/database/catalogs and /configuration/generator/database/schemata"); log.warn("WARNING: Cannot combine configuration properties /configuration/generator/database/catalogs and /configuration/generator/database/schemata");
} }


for (Catalog catalog : catalogs) { for (CatalogMappingType catalog : catalogs) {
if ("".equals(catalog.getOutputCatalog())) if ("".equals(catalog.getOutputCatalog()))
log.warn("WARNING: Empty <outputCatalog/> should not be used to model default outputCatalogs. Use <outputCatalogToDefault>true</outputCatalogToDefault>, instead. See also: https://github.com/jOOQ/jOOQ/issues/3018"); log.warn("WARNING: Empty <outputCatalog/> should not be used to model default outputCatalogs. Use <outputCatalogToDefault>true</outputCatalogToDefault>, instead. See also: https://github.com/jOOQ/jOOQ/issues/3018");


Expand All @@ -434,7 +434,7 @@ else if (catalog.getOutputCatalog() == null)






for (Schema schema : catalog.getSchemata()) { for (SchemaMappingType schema : catalog.getSchemata()) {
if (catalogsEmpty && schemataEmpty && StringUtils.isBlank(schema.getInputSchema())) { if (catalogsEmpty && schemataEmpty && StringUtils.isBlank(schema.getInputSchema())) {
if (!StringUtils.isBlank(j.getSchema())) if (!StringUtils.isBlank(j.getSchema()))
log.warn("WARNING: The configuration property jdbc.Schema is deprecated and will be removed in the future. Use /configuration/generator/database/inputSchema instead"); log.warn("WARNING: The configuration property jdbc.Schema is deprecated and will be removed in the future. Use /configuration/generator/database/inputSchema instead");
Expand Down
16 changes: 8 additions & 8 deletions jOOQ-meta/src/main/java/META-INF/sun-jaxb.episode
Expand Up @@ -137,27 +137,27 @@


</bindings> </bindings>


<bindings if-exists="true" scd="~tns:Catalogs"> <bindings if-exists="true" scd="~tns:CatalogMappingsType">


<class ref="org.jooq.meta.jaxb.Catalogs"/> <class ref="org.jooq.meta.jaxb.CatalogMappingsType"/>


</bindings> </bindings>


<bindings if-exists="true" scd="~tns:Catalog"> <bindings if-exists="true" scd="~tns:CatalogMappingType">


<class ref="org.jooq.meta.jaxb.Catalog"/> <class ref="org.jooq.meta.jaxb.CatalogMappingType"/>


</bindings> </bindings>


<bindings if-exists="true" scd="~tns:Schemata"> <bindings if-exists="true" scd="~tns:SchemaMappingsType">


<class ref="org.jooq.meta.jaxb.Schemata"/> <class ref="org.jooq.meta.jaxb.SchemaMappingsType"/>


</bindings> </bindings>


<bindings if-exists="true" scd="~tns:Schema"> <bindings if-exists="true" scd="~tns:SchemaMappingType">


<class ref="org.jooq.meta.jaxb.Schema"/> <class ref="org.jooq.meta.jaxb.SchemaMappingType"/>


</bindings> </bindings>


Expand Down
28 changes: 14 additions & 14 deletions jOOQ-meta/src/main/java/org/jooq/meta/AbstractDatabase.java
Expand Up @@ -73,13 +73,13 @@
import org.jooq.impl.DefaultExecuteListener; import org.jooq.impl.DefaultExecuteListener;
import org.jooq.impl.DefaultExecuteListenerProvider; import org.jooq.impl.DefaultExecuteListenerProvider;
import org.jooq.impl.SQLDataType; import org.jooq.impl.SQLDataType;
import org.jooq.meta.jaxb.Catalog; import org.jooq.meta.jaxb.CatalogMappingType;
import org.jooq.meta.jaxb.CustomType; import org.jooq.meta.jaxb.CustomType;
import org.jooq.meta.jaxb.EnumType; import org.jooq.meta.jaxb.EnumType;
import org.jooq.meta.jaxb.ForcedType; import org.jooq.meta.jaxb.ForcedType;
import org.jooq.meta.jaxb.Nullability; import org.jooq.meta.jaxb.Nullability;
import org.jooq.meta.jaxb.RegexFlag; import org.jooq.meta.jaxb.RegexFlag;
import org.jooq.meta.jaxb.Schema; import org.jooq.meta.jaxb.SchemaMappingType;
// ... // ...
import org.jooq.tools.JooqLogger; import org.jooq.tools.JooqLogger;
import org.jooq.tools.StopWatch; import org.jooq.tools.StopWatch;
Expand Down Expand Up @@ -129,8 +129,8 @@ public abstract class AbstractDatabase implements Database {
private boolean supportsUnsignedTypes; private boolean supportsUnsignedTypes;
private boolean ignoreProcedureReturnValues; private boolean ignoreProcedureReturnValues;
private boolean dateAsTimestamp; private boolean dateAsTimestamp;
private List<Catalog> configuredCatalogs = new ArrayList<Catalog>(); private List<CatalogMappingType> configuredCatalogs = new ArrayList<CatalogMappingType>();
private List<Schema> configuredSchemata = new ArrayList<Schema>(); private List<SchemaMappingType> configuredSchemata = new ArrayList<SchemaMappingType>();
private List<CustomType> configuredCustomTypes; private List<CustomType> configuredCustomTypes;
private List<EnumType> configuredEnumTypes; private List<EnumType> configuredEnumTypes;
private List<ForcedType> configuredForcedTypes; private List<ForcedType> configuredForcedTypes;
Expand Down Expand Up @@ -504,7 +504,7 @@ public final List<String> getInputCatalogs() {
} }
} }
else { else {
for (Catalog catalog : configuredCatalogs) { for (CatalogMappingType catalog : configuredCatalogs) {






Expand Down Expand Up @@ -535,7 +535,7 @@ else if (configuredCatalogs.size() == 1 && StringUtils.isBlank(configuredCatalog
else if (configuredCatalogs.isEmpty()) { else if (configuredCatalogs.isEmpty()) {
inputSchemataPerCatalog.put("", inputSchemata); inputSchemataPerCatalog.put("", inputSchemata);


for (Schema schema : configuredSchemata) { for (SchemaMappingType schema : configuredSchemata) {






Expand All @@ -550,8 +550,8 @@ else if (configuredCatalogs.isEmpty()) {
} }
} }
else { else {
for (Catalog catalog : configuredCatalogs) { for (CatalogMappingType catalog : configuredCatalogs) {
for (Schema schema : catalog.getSchemata()) { for (SchemaMappingType schema : catalog.getSchemata()) {
String inputSchema; String inputSchema;




Expand Down Expand Up @@ -628,7 +628,7 @@ public final List<String> getInputSchemata(String catalog) {
@Override @Override
@Deprecated @Deprecated
public String getOutputCatalog(String inputCatalog) { public String getOutputCatalog(String inputCatalog) {
for (Catalog catalog : configuredCatalogs) for (CatalogMappingType catalog : configuredCatalogs)
if (inputCatalog.equals(catalog.getInputCatalog())) if (inputCatalog.equals(catalog.getInputCatalog()))
return catalog.getOutputCatalog(); return catalog.getOutputCatalog();


Expand All @@ -638,7 +638,7 @@ public String getOutputCatalog(String inputCatalog) {
@Override @Override
@Deprecated @Deprecated
public String getOutputSchema(String inputSchema) { public String getOutputSchema(String inputSchema) {
for (Schema schema : configuredSchemata) for (SchemaMappingType schema : configuredSchemata)
if (inputSchema.equals(schema.getInputSchema())) if (inputSchema.equals(schema.getInputSchema()))
return schema.getOutputSchema(); return schema.getOutputSchema();


Expand All @@ -647,22 +647,22 @@ public String getOutputSchema(String inputSchema) {


@Override @Override
public String getOutputSchema(String inputCatalog, String inputSchema) { public String getOutputSchema(String inputCatalog, String inputSchema) {
for (Catalog catalog : configuredCatalogs) for (CatalogMappingType catalog : configuredCatalogs)
if (inputCatalog.equals(catalog.getInputCatalog())) if (inputCatalog.equals(catalog.getInputCatalog()))
for (Schema schema : catalog.getSchemata()) for (SchemaMappingType schema : catalog.getSchemata())
if (inputSchema.equals(schema.getInputSchema())) if (inputSchema.equals(schema.getInputSchema()))
return schema.getOutputSchema(); return schema.getOutputSchema();


return inputSchema; return inputSchema;
} }


@Override @Override
public final void setConfiguredCatalogs(List<Catalog> catalogs) { public final void setConfiguredCatalogs(List<CatalogMappingType> catalogs) {
this.configuredCatalogs = catalogs; this.configuredCatalogs = catalogs;
} }


@Override @Override
public final void setConfiguredSchemata(List<Schema> schemata) { public final void setConfiguredSchemata(List<SchemaMappingType> schemata) {
this.configuredSchemata = schemata; this.configuredSchemata = schemata;
} }


Expand Down
8 changes: 4 additions & 4 deletions jOOQ-meta/src/main/java/org/jooq/meta/Database.java
Expand Up @@ -47,12 +47,12 @@
import org.jooq.Name; import org.jooq.Name;
import org.jooq.SQLDialect; import org.jooq.SQLDialect;
import org.jooq.Table; import org.jooq.Table;
import org.jooq.meta.jaxb.Catalog; import org.jooq.meta.jaxb.CatalogMappingType;
import org.jooq.meta.jaxb.CustomType; import org.jooq.meta.jaxb.CustomType;
import org.jooq.meta.jaxb.EnumType; import org.jooq.meta.jaxb.EnumType;
import org.jooq.meta.jaxb.ForcedType; import org.jooq.meta.jaxb.ForcedType;
import org.jooq.meta.jaxb.RegexFlag; import org.jooq.meta.jaxb.RegexFlag;
import org.jooq.meta.jaxb.Schema; import org.jooq.meta.jaxb.SchemaMappingType;


/** /**
* A general database model. * A general database model.
Expand Down Expand Up @@ -338,12 +338,12 @@ public interface Database extends AutoCloseable {
/** /**
* The input and output catalogs. * The input and output catalogs.
*/ */
void setConfiguredCatalogs(List<Catalog> catalogs); void setConfiguredCatalogs(List<CatalogMappingType> catalogs);


/** /**
* The input and output schemata. * The input and output schemata.
*/ */
void setConfiguredSchemata(List<Schema> schemata); void setConfiguredSchemata(List<SchemaMappingType> schemata);


/** /**
* Database objects matching any of these regular expressions will not be * Database objects matching any of these regular expressions will not be
Expand Down
Expand Up @@ -82,7 +82,7 @@
import org.jooq.meta.firebird.rdb.tables.Rdb$indexSegments; import org.jooq.meta.firebird.rdb.tables.Rdb$indexSegments;
import org.jooq.meta.firebird.rdb.tables.Rdb$refConstraints; import org.jooq.meta.firebird.rdb.tables.Rdb$refConstraints;
import org.jooq.meta.firebird.rdb.tables.Rdb$relationConstraints; import org.jooq.meta.firebird.rdb.tables.Rdb$relationConstraints;
import org.jooq.meta.jaxb.Schema; import org.jooq.meta.jaxb.SchemaMappingType;
import org.jooq.util.firebird.FirebirdDataType; import org.jooq.util.firebird.FirebirdDataType;


/** /**
Expand All @@ -93,11 +93,11 @@ public class FirebirdDatabase extends AbstractDatabase {
public FirebirdDatabase() { public FirebirdDatabase() {


// Firebird doesn't know schemata // Firebird doesn't know schemata
Schema schema = new Schema(); SchemaMappingType schema = new SchemaMappingType();
schema.setInputSchema(""); schema.setInputSchema("");
schema.setOutputSchema(""); schema.setOutputSchema("");


List<Schema> schemata = new ArrayList<Schema>(); List<SchemaMappingType> schemata = new ArrayList<SchemaMappingType>();
schemata.add(schema); schemata.add(schema);


setConfiguredSchemata(schemata); setConfiguredSchemata(schemata);
Expand Down
Expand Up @@ -28,13 +28,13 @@
* *
*/ */
@XmlAccessorType(XmlAccessType.FIELD) @XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Catalog", propOrder = { @XmlType(name = "CatalogMappingType", propOrder = {


}) })
@SuppressWarnings({ @SuppressWarnings({
"all" "all"
}) })
public class Catalog implements Serializable public class CatalogMappingType implements Serializable
{ {


private final static long serialVersionUID = 31200L; private final static long serialVersionUID = 31200L;
Expand All @@ -47,7 +47,7 @@ public class Catalog implements Serializable
protected Boolean outputCatalogToDefault = false; protected Boolean outputCatalogToDefault = false;
@XmlElementWrapper(name = "schemata") @XmlElementWrapper(name = "schemata")
@XmlElement(name = "schema") @XmlElement(name = "schema")
protected List<Schema> schemata; protected List<SchemaMappingType> schemata;


/** /**
* See also {@link Database#getInputCatalog()} * See also {@link Database#getInputCatalog()}
Expand Down Expand Up @@ -121,49 +121,49 @@ public void setOutputCatalogToDefault(Boolean value) {
this.outputCatalogToDefault = value; this.outputCatalogToDefault = value;
} }


public List<Schema> getSchemata() { public List<SchemaMappingType> getSchemata() {
if (schemata == null) { if (schemata == null) {
schemata = new ArrayList<Schema>(); schemata = new ArrayList<SchemaMappingType>();
} }
return schemata; return schemata;
} }


public void setSchemata(List<Schema> schemata) { public void setSchemata(List<SchemaMappingType> schemata) {
this.schemata = schemata; this.schemata = schemata;
} }


public Catalog withInputCatalog(String value) { public CatalogMappingType withInputCatalog(String value) {
setInputCatalog(value); setInputCatalog(value);
return this; return this;
} }


public Catalog withOutputCatalog(String value) { public CatalogMappingType withOutputCatalog(String value) {
setOutputCatalog(value); setOutputCatalog(value);
return this; return this;
} }


public Catalog withOutputCatalogToDefault(Boolean value) { public CatalogMappingType withOutputCatalogToDefault(Boolean value) {
setOutputCatalogToDefault(value); setOutputCatalogToDefault(value);
return this; return this;
} }


public Catalog withSchemata(Schema... values) { public CatalogMappingType withSchemata(SchemaMappingType... values) {
if (values!= null) { if (values!= null) {
for (Schema value: values) { for (SchemaMappingType value: values) {
getSchemata().add(value); getSchemata().add(value);
} }
} }
return this; return this;
} }


public Catalog withSchemata(Collection<Schema> values) { public CatalogMappingType withSchemata(Collection<SchemaMappingType> values) {
if (values!= null) { if (values!= null) {
getSchemata().addAll(values); getSchemata().addAll(values);
} }
return this; return this;
} }


public Catalog withSchemata(List<Schema> schemata) { public CatalogMappingType withSchemata(List<SchemaMappingType> schemata) {
setSchemata(schemata); setSchemata(schemata);
return this; return this;
} }
Expand Down Expand Up @@ -209,7 +209,7 @@ public boolean equals(Object that) {
if (getClass()!= that.getClass()) { if (getClass()!= that.getClass()) {
return false; return false;
} }
Catalog other = ((Catalog) that); CatalogMappingType other = ((CatalogMappingType) that);
if (inputCatalog == null) { if (inputCatalog == null) {
if (other.inputCatalog!= null) { if (other.inputCatalog!= null) {
return false; return false;
Expand Down

0 comments on commit 7373ad1

Please sign in to comment.