connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlDriver.java | 2 connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OCatalog.java | 9 ++ connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OColumn.java | 29 ++++++++ connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OColumnContainer.java | 34 +++++++++- connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OContainer.java | 4 - connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OIndex.java | 31 ++++++++- connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OIndexColumn.java | 29 ++++++++ connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OKey.java | 26 +++++++ connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OKeyColumn.java | 29 ++++++++ connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OTable.java | 8 +- connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxColumnDescriptor.java | 29 ++++++++ connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxIndexColumnDescriptor.java | 29 ++++++++ connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxIndexDescriptor.java | 29 ++++++++ connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxKeyColumnDescriptor.java | 28 +++++++- connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxKeyDescriptor.java | 29 ++++++++ connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxTableDescriptor.java | 29 ++++++++ connectivity/source/sdbcx/VColumn.cxx | 4 - connectivity/source/sdbcx/VIndexColumn.cxx | 8 +- connectivity/source/sdbcx/VKey.cxx | 4 - connectivity/source/sdbcx/VKeyColumn.cxx | 4 - 20 files changed, 365 insertions(+), 29 deletions(-)
New commits: commit 9e678c46ef60f5fb9f4e534f01275b2f1067389e Author: Damjan Jovanovic <dam...@apache.org> Date: Tue Sep 19 06:18:22 2017 +0000 Add support for adding and deleting columns in Java's SDBCX tables, currently used by the PostgreSQL driver. Patch by: me diff --git a/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OColumnContainer.java b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OColumnContainer.java index f37f68d3da7c..5ac10788385b 100644 --- a/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OColumnContainer.java +++ b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OColumnContainer.java @@ -33,9 +33,13 @@ import com.sun.star.sdbc.ColumnValue; import com.sun.star.sdbc.DataType; import com.sun.star.sdbc.SQLException; import com.sun.star.sdbc.XDatabaseMetaData; +import com.sun.star.sdbc.XStatement; +import com.sun.star.sdbcx.comp.postgresql.comphelper.CompHelper; import com.sun.star.sdbcx.comp.postgresql.sdbcx.SqlTableHelper.ColumnDescription; import com.sun.star.sdbcx.comp.postgresql.sdbcx.descriptors.SdbcxColumnDescriptor; +import com.sun.star.sdbcx.comp.postgresql.util.ComposeRule; import com.sun.star.sdbcx.comp.postgresql.util.DbTools; +import com.sun.star.sdbcx.comp.postgresql.util.Osl; import com.sun.star.uno.UnoRuntime; public class OColumnContainer extends OContainer { @@ -116,10 +120,38 @@ public class OColumnContainer extends OContainer { @Override protected XPropertySet appendObject(String _rForName, XPropertySet descriptor) throws SQLException { - return null; + if (table == null) { + return cloneDescriptor(descriptor); + } + String sql = String.format("ALTER TABLE %s ADD %s", + DbTools.composeTableName(metadata, table, ComposeRule.InTableDefinitions, false, false, true), + DbTools.createStandardColumnPart(descriptor, table.getConnection(), null, table.getTypeCreatePattern())); + XStatement statement = null; + try { + statement = table.getConnection().createStatement(); + statement.execute(sql); + } finally { + CompHelper.disposeComponent(statement); + } + return createObject(_rForName); } @Override protected void dropObject(int index, String name) throws SQLException { + Osl.ensure(table, "Table is null!"); + if (table == null) { + return; + } + String quote = metadata.getIdentifierQuoteString(); + String sql = String.format("ALTER TABLE %s DROP %s", + DbTools.composeTableName(metadata, table, ComposeRule.InTableDefinitions, false, false, true), + DbTools.quoteName(quote, name)); + XStatement statement = null; + try { + statement = table.getConnection().createStatement(); + statement.execute(sql); + } finally { + CompHelper.disposeComponent(statement); + } } } diff --git a/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OTable.java b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OTable.java index bee2a90fdd24..036924cd7425 100644 --- a/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OTable.java +++ b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OTable.java @@ -167,6 +167,10 @@ public abstract class OTable extends ODescriptor return connection; } + public String getTypeCreatePattern() { + return ""; + } + protected abstract OContainer refreshColumns(); protected abstract OContainer refreshIndexes(); protected abstract OContainer refreshKeys(); commit 8c9c0f996842cc88f69bbe509cd71871e46f7dc9 Author: Damjan Jovanovic <dam...@apache.org> Date: Tue Sep 19 02:20:32 2017 +0000 Implement XServiceInfo in all the Java SDBCX classes and standardize it to a common form. Patch by: me diff --git a/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlDriver.java b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlDriver.java index 2a57edd9b67a..59ad50e033b4 100644 --- a/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlDriver.java +++ b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlDriver.java @@ -89,7 +89,7 @@ public class PostgresqlDriver extends ComponentBase implements XServiceInfo, XDr @Override public boolean supportsService(String serviceName) { - for (String service : services) { + for (String service : getSupportedServiceNames()) { if (service.equals(serviceName)) { return true; } diff --git a/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OColumn.java b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OColumn.java index c0f969c69266..aad4d3182f83 100644 --- a/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OColumn.java +++ b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OColumn.java @@ -24,6 +24,7 @@ package com.sun.star.sdbcx.comp.postgresql.sdbcx; import com.sun.star.beans.PropertyAttribute; import com.sun.star.beans.XPropertySet; import com.sun.star.container.XNamed; +import com.sun.star.lang.XServiceInfo; import com.sun.star.sdbc.ColumnValue; import com.sun.star.sdbcx.XDataDescriptorFactory; import com.sun.star.sdbcx.comp.postgresql.comphelper.CompHelper; @@ -33,7 +34,12 @@ import com.sun.star.sdbcx.comp.postgresql.sdbcx.descriptors.SdbcxColumnDescripto import com.sun.star.sdbcx.comp.postgresql.util.PropertyIds; import com.sun.star.uno.Type; -public class OColumn extends ODescriptor implements XNamed, XDataDescriptorFactory { +public class OColumn extends ODescriptor implements XNamed, XDataDescriptorFactory, XServiceInfo { + + private static final String[] services = { + "com.sun.star.sdbcx.Column" + }; + private String typeName; private String description; private String defaultValue; @@ -234,6 +240,27 @@ public class OColumn extends ODescriptor implements XNamed, XDataDescriptorFacto super.postDisposing(); } + // XServiceInfo + + public String getImplementationName() { + return getClass().getName(); + } + + @Override + public String[] getSupportedServiceNames() { + return services.clone(); + } + + @Override + public boolean supportsService(String serviceName) { + for (String service : getSupportedServiceNames()) { + if (service.equals(serviceName)) { + return true; + } + } + return false; + } + // XDataDescriptorFactory @Override diff --git a/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OContainer.java b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OContainer.java index 4776146950e7..9f9fab85a897 100644 --- a/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OContainer.java +++ b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OContainer.java @@ -128,7 +128,7 @@ public abstract class OContainer extends WeakBase implements // XServiceInfo public String getImplementationName() { - return "com.sun.star.sdbcx.VContainer"; + return getClass().getName(); } @Override @@ -138,7 +138,7 @@ public abstract class OContainer extends WeakBase implements @Override public boolean supportsService(String serviceName) { - for (String service : services) { + for (String service : getSupportedServiceNames()) { if (service.equals(serviceName)) { return true; } diff --git a/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OIndex.java b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OIndex.java index 3e318aeaceb7..876077d214e6 100644 --- a/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OIndex.java +++ b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OIndex.java @@ -27,6 +27,7 @@ import com.sun.star.beans.PropertyAttribute; import com.sun.star.beans.XPropertySet; import com.sun.star.container.ElementExistException; import com.sun.star.container.XNameAccess; +import com.sun.star.lang.XServiceInfo; import com.sun.star.sdbc.SQLException; import com.sun.star.sdbcx.XColumnsSupplier; import com.sun.star.sdbcx.XDataDescriptorFactory; @@ -37,7 +38,12 @@ import com.sun.star.sdbcx.comp.postgresql.util.DbTools; import com.sun.star.sdbcx.comp.postgresql.util.PropertyIds; import com.sun.star.uno.Type; -public class OIndex extends ODescriptor implements XColumnsSupplier, XDataDescriptorFactory { +public class OIndex extends ODescriptor implements XColumnsSupplier, XDataDescriptorFactory, XServiceInfo { + + private static final String[] services = { + "com.sun.star.sdbcx.Index" + }; + protected String catalogName; protected boolean isUnique; protected boolean isPrimaryKeyIndex; @@ -88,6 +94,29 @@ public class OIndex extends ODescriptor implements XColumnsSupplier, XDataDescri }, null); } + // XServiceInfo + + public String getImplementationName() { + return getClass().getName(); + } + + @Override + public String[] getSupportedServiceNames() { + return services.clone(); + } + + @Override + public boolean supportsService(String serviceName) { + for (String service : getSupportedServiceNames()) { + if (service.equals(serviceName)) { + return true; + } + } + return false; + } + + // XDataDescriptorFactory + @Override public XPropertySet createDataDescriptor() { SdbcxIndexDescriptor descriptor = new SdbcxIndexDescriptor(isCaseSensitive()); diff --git a/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OIndexColumn.java b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OIndexColumn.java index 5a7b7767e28a..8050a3d76499 100644 --- a/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OIndexColumn.java +++ b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OIndexColumn.java @@ -23,13 +23,19 @@ package com.sun.star.sdbcx.comp.postgresql.sdbcx; import com.sun.star.beans.PropertyAttribute; import com.sun.star.beans.XPropertySet; +import com.sun.star.lang.XServiceInfo; import com.sun.star.sdbcx.comp.postgresql.comphelper.CompHelper; import com.sun.star.sdbcx.comp.postgresql.comphelper.PropertySetAdapter.PropertyGetter; import com.sun.star.sdbcx.comp.postgresql.sdbcx.descriptors.SdbcxIndexColumnDescriptor; import com.sun.star.sdbcx.comp.postgresql.util.PropertyIds; import com.sun.star.uno.Type; -public class OIndexColumn extends OColumn { +public class OIndexColumn extends OColumn implements XServiceInfo { + + private static final String[] services = { + "com.sun.star.sdbcx.IndexColumn" + }; + protected boolean isAscending; public OIndexColumn( @@ -63,6 +69,27 @@ public class OIndexColumn extends OColumn { }, null); } + // XServiceInfo + + public String getImplementationName() { + return getClass().getName(); + } + + @Override + public String[] getSupportedServiceNames() { + return services.clone(); + } + + @Override + public boolean supportsService(String serviceName) { + for (String service : getSupportedServiceNames()) { + if (service.equals(serviceName)) { + return true; + } + } + return false; + } + // XDataDescriptorFactory @Override diff --git a/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OKey.java b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OKey.java index ffec0fe23178..cab0cd14c3b2 100644 --- a/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OKey.java +++ b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OKey.java @@ -27,6 +27,7 @@ import com.sun.star.beans.PropertyAttribute; import com.sun.star.beans.XPropertySet; import com.sun.star.container.ElementExistException; import com.sun.star.container.XNameAccess; +import com.sun.star.lang.XServiceInfo; import com.sun.star.sdbc.SQLException; import com.sun.star.sdbcx.XColumnsSupplier; import com.sun.star.sdbcx.XDataDescriptorFactory; @@ -38,7 +39,11 @@ import com.sun.star.sdbcx.comp.postgresql.util.PropertyIds; import com.sun.star.uno.Type; public class OKey extends ODescriptor - implements XDataDescriptorFactory, XColumnsSupplier { + implements XDataDescriptorFactory, XColumnsSupplier, XServiceInfo { + + private static final String[] services = { + "com.sun.star.sdbcx.Key" + }; protected OTable table; protected String referencedTable; @@ -130,5 +135,24 @@ public class OKey extends ODescriptor + ", name=" + getName() + "]"; } + // XServiceInfo + + public String getImplementationName() { + return getClass().getName(); + } + @Override + public String[] getSupportedServiceNames() { + return services.clone(); + } + + @Override + public boolean supportsService(String serviceName) { + for (String service : getSupportedServiceNames()) { + if (service.equals(serviceName)) { + return true; + } + } + return false; + } } diff --git a/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OKeyColumn.java b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OKeyColumn.java index 0d78e0add049..0e0079c0bcda 100644 --- a/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OKeyColumn.java +++ b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OKeyColumn.java @@ -23,13 +23,19 @@ package com.sun.star.sdbcx.comp.postgresql.sdbcx; import com.sun.star.beans.PropertyAttribute; import com.sun.star.beans.XPropertySet; +import com.sun.star.lang.XServiceInfo; import com.sun.star.sdbcx.comp.postgresql.comphelper.CompHelper; import com.sun.star.sdbcx.comp.postgresql.comphelper.PropertySetAdapter.PropertyGetter; import com.sun.star.sdbcx.comp.postgresql.sdbcx.descriptors.SdbcxKeyColumnDescriptor; import com.sun.star.sdbcx.comp.postgresql.util.PropertyIds; import com.sun.star.uno.Type; -public class OKeyColumn extends OColumn { +public class OKeyColumn extends OColumn implements XServiceInfo { + + private static final String[] services = { + "com.sun.star.sdbcx.KeyColumn" + }; + protected String referencedColumn; protected OKeyColumn(boolean isCaseSensitive) { @@ -68,6 +74,27 @@ public class OKeyColumn extends OColumn { }, null); } + // XServiceInfo + + public String getImplementationName() { + return getClass().getName(); + } + + @Override + public String[] getSupportedServiceNames() { + return services.clone(); + } + + @Override + public boolean supportsService(String serviceName) { + for (String service : getSupportedServiceNames()) { + if (service.equals(serviceName)) { + return true; + } + } + return false; + } + // XDataDescriptorFactory @Override diff --git a/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OTable.java b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OTable.java index d86be6e989c4..bee2a90fdd24 100644 --- a/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OTable.java +++ b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OTable.java @@ -117,7 +117,7 @@ public abstract class OTable extends ODescriptor @Override public String getImplementationName() { - return "com.sun.star.sdbcx.Table"; + return getClass().getName(); } @Override @@ -127,7 +127,7 @@ public abstract class OTable extends ODescriptor @Override public boolean supportsService(String serviceName) { - for (String service : services) { + for (String service : getSupportedServiceNames()) { if (serviceName.equals(service)) { return true; } diff --git a/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxColumnDescriptor.java b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxColumnDescriptor.java index c7696be6a2a4..ebf87ab98a35 100644 --- a/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxColumnDescriptor.java +++ b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxColumnDescriptor.java @@ -21,13 +21,18 @@ package com.sun.star.sdbcx.comp.postgresql.sdbcx.descriptors; +import com.sun.star.lang.XServiceInfo; import com.sun.star.sdbcx.comp.postgresql.comphelper.PropertySetAdapter.PropertyGetter; import com.sun.star.sdbcx.comp.postgresql.comphelper.PropertySetAdapter.PropertySetter; import com.sun.star.sdbcx.comp.postgresql.sdbcx.ODescriptor; import com.sun.star.sdbcx.comp.postgresql.util.PropertyIds; import com.sun.star.uno.Type; -public class SdbcxColumnDescriptor extends ODescriptor { +public class SdbcxColumnDescriptor extends ODescriptor implements XServiceInfo { + private static final String[] services = { + "com.sun.star.sdbcx.ColumnDescriptor" + }; + protected int type; protected String typeName; protected int precision; @@ -186,4 +191,26 @@ public class SdbcxColumnDescriptor extends ODescriptor { } }); } + + // XServiceInfo + + @Override + public String getImplementationName() { + return getClass().getName(); + } + + @Override + public String[] getSupportedServiceNames() { + return services.clone(); + } + + @Override + public boolean supportsService(String serviceName) { + for (String service : getSupportedServiceNames()) { + if (service.equals(serviceName)) { + return true; + } + } + return false; + } } diff --git a/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxIndexColumnDescriptor.java b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxIndexColumnDescriptor.java index c8e9800a6987..0069d7c0e029 100644 --- a/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxIndexColumnDescriptor.java +++ b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxIndexColumnDescriptor.java @@ -21,12 +21,18 @@ package com.sun.star.sdbcx.comp.postgresql.sdbcx.descriptors; +import com.sun.star.lang.XServiceInfo; import com.sun.star.sdbcx.comp.postgresql.comphelper.PropertySetAdapter.PropertyGetter; import com.sun.star.sdbcx.comp.postgresql.comphelper.PropertySetAdapter.PropertySetter; import com.sun.star.sdbcx.comp.postgresql.util.PropertyIds; import com.sun.star.uno.Type; -public class SdbcxIndexColumnDescriptor extends SdbcxColumnDescriptor { +public class SdbcxIndexColumnDescriptor extends SdbcxColumnDescriptor implements XServiceInfo { + + private static final String[] services = { + "com.sun.star.sdbcx.IndexColumnDescriptor" + }; + protected boolean isAscending; public SdbcxIndexColumnDescriptor(boolean isCaseSensitive) { @@ -50,4 +56,25 @@ public class SdbcxIndexColumnDescriptor extends SdbcxColumnDescriptor { } }); } + + // XServiceInfo + + public String getImplementationName() { + return getClass().getName(); + } + + @Override + public String[] getSupportedServiceNames() { + return services.clone(); + } + + @Override + public boolean supportsService(String serviceName) { + for (String service : getSupportedServiceNames()) { + if (service.equals(serviceName)) { + return true; + } + } + return false; + } } diff --git a/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxIndexDescriptor.java b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxIndexDescriptor.java index cf5a120a9e53..a036ceaedb15 100644 --- a/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxIndexDescriptor.java +++ b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxIndexDescriptor.java @@ -21,6 +21,7 @@ package com.sun.star.sdbcx.comp.postgresql.sdbcx.descriptors; +import com.sun.star.lang.XServiceInfo; import com.sun.star.sdbcx.XColumnsSupplier; import com.sun.star.sdbcx.comp.postgresql.comphelper.PropertySetAdapter.PropertyGetter; import com.sun.star.sdbcx.comp.postgresql.comphelper.PropertySetAdapter.PropertySetter; @@ -28,7 +29,11 @@ import com.sun.star.sdbcx.comp.postgresql.sdbcx.ODescriptor; import com.sun.star.sdbcx.comp.postgresql.util.PropertyIds; import com.sun.star.uno.Type; -public class SdbcxIndexDescriptor extends ODescriptor implements XColumnsSupplier { +public class SdbcxIndexDescriptor extends ODescriptor implements XColumnsSupplier, XServiceInfo { + private static final String[] services = { + "com.sun.star.sdbcx.IndexDescriptor" + }; + protected String catalog = ""; protected boolean isUnique; protected boolean isClustered; @@ -86,4 +91,26 @@ public class SdbcxIndexDescriptor extends ODescriptor implements XColumnsSupplie public SdbcxIndexColumnDescriptorContainer getColumns() { return columns; } + + // XServiceInfo + + @Override + public String getImplementationName() { + return getClass().getName(); + } + + @Override + public String[] getSupportedServiceNames() { + return services.clone(); + } + + @Override + public boolean supportsService(String serviceName) { + for (String service : getSupportedServiceNames()) { + if (service.equals(serviceName)) { + return true; + } + } + return false; + } } diff --git a/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxKeyColumnDescriptor.java b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxKeyColumnDescriptor.java index f4b161283ca2..db8ce4ce507a 100644 --- a/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxKeyColumnDescriptor.java +++ b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxKeyColumnDescriptor.java @@ -21,12 +21,17 @@ package com.sun.star.sdbcx.comp.postgresql.sdbcx.descriptors; +import com.sun.star.lang.XServiceInfo; import com.sun.star.sdbcx.comp.postgresql.comphelper.PropertySetAdapter.PropertyGetter; import com.sun.star.sdbcx.comp.postgresql.comphelper.PropertySetAdapter.PropertySetter; import com.sun.star.sdbcx.comp.postgresql.util.PropertyIds; import com.sun.star.uno.Type; -public class SdbcxKeyColumnDescriptor extends SdbcxColumnDescriptor { +public class SdbcxKeyColumnDescriptor extends SdbcxColumnDescriptor implements XServiceInfo { + private static final String[] services = { + "com.sun.star.sdbcx.KeyColumnDescriptor" + }; + protected String relatedColumn; public SdbcxKeyColumnDescriptor(boolean isCaseSensitive) { @@ -50,4 +55,25 @@ public class SdbcxKeyColumnDescriptor extends SdbcxColumnDescriptor { } }); } + + // XServiceInfo + + public String getImplementationName() { + return getClass().getName(); + } + + @Override + public String[] getSupportedServiceNames() { + return services.clone(); + } + + @Override + public boolean supportsService(String serviceName) { + for (String service : getSupportedServiceNames()) { + if (service.equals(serviceName)) { + return true; + } + } + return false; + } } diff --git a/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxKeyDescriptor.java b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxKeyDescriptor.java index 5050849bcb13..ccb3fd5b668e 100644 --- a/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxKeyDescriptor.java +++ b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxKeyDescriptor.java @@ -22,6 +22,7 @@ package com.sun.star.sdbcx.comp.postgresql.sdbcx.descriptors; import com.sun.star.container.XNameAccess; +import com.sun.star.lang.XServiceInfo; import com.sun.star.sdbcx.XColumnsSupplier; import com.sun.star.sdbcx.comp.postgresql.comphelper.PropertySetAdapter.PropertyGetter; import com.sun.star.sdbcx.comp.postgresql.comphelper.PropertySetAdapter.PropertySetter; @@ -29,7 +30,12 @@ import com.sun.star.sdbcx.comp.postgresql.sdbcx.ODescriptor; import com.sun.star.sdbcx.comp.postgresql.util.PropertyIds; import com.sun.star.uno.Type; -public class SdbcxKeyDescriptor extends ODescriptor implements XColumnsSupplier { +public class SdbcxKeyDescriptor extends ODescriptor implements XColumnsSupplier, XServiceInfo { + + private static final String[] services = { + "com.sun.star.sdbcx.KeyDescriptor" + }; + protected int type; protected String referencedTable; protected int updateRule; @@ -105,4 +111,25 @@ public class SdbcxKeyDescriptor extends ODescriptor implements XColumnsSupplier public XNameAccess getColumns() { return columns; } + + // XServiceInfo + + public String getImplementationName() { + return getClass().getName(); + } + + @Override + public String[] getSupportedServiceNames() { + return services.clone(); + } + + @Override + public boolean supportsService(String serviceName) { + for (String service : getSupportedServiceNames()) { + if (service.equals(serviceName)) { + return true; + } + } + return false; + } } diff --git a/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxTableDescriptor.java b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxTableDescriptor.java index a5fedfac14e1..fadbcb9695e2 100644 --- a/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxTableDescriptor.java +++ b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxTableDescriptor.java @@ -23,6 +23,7 @@ package com.sun.star.sdbcx.comp.postgresql.sdbcx.descriptors; import com.sun.star.container.XIndexAccess; import com.sun.star.container.XNameAccess; +import com.sun.star.lang.XServiceInfo; import com.sun.star.sdbcx.XColumnsSupplier; import com.sun.star.sdbcx.XKeysSupplier; import com.sun.star.sdbcx.comp.postgresql.comphelper.PropertySetAdapter.PropertyGetter; @@ -32,7 +33,12 @@ import com.sun.star.sdbcx.comp.postgresql.sdbcx.ODescriptor; import com.sun.star.sdbcx.comp.postgresql.util.PropertyIds; import com.sun.star.uno.Type; -public class SdbcxTableDescriptor extends ODescriptor implements XColumnsSupplier, XKeysSupplier { +public class SdbcxTableDescriptor extends ODescriptor implements XColumnsSupplier, XKeysSupplier, XServiceInfo { + + private static final String[] services = { + "com.sun.star.sdbcx.TableDescriptor" + }; + protected String catalogName; protected String schemaName; protected String description; @@ -101,4 +107,25 @@ public class SdbcxTableDescriptor extends ODescriptor implements XColumnsSupplie public XIndexAccess getKeys() { return keys; } + + // XServiceInfo + + public String getImplementationName() { + return getClass().getName(); + } + + @Override + public String[] getSupportedServiceNames() { + return services.clone(); + } + + @Override + public boolean supportsService(String serviceName) { + for (String service : getSupportedServiceNames()) { + if (service.equals(serviceName)) { + return true; + } + } + return false; + } } commit ccc4532f9ed95f4460941e2762ae3250d37805f5 Author: Damjan Jovanovic <dam...@apache.org> Date: Tue Sep 19 02:16:41 2017 +0000 More naming errors. There are no "Descriptions" in the SDBCX module, there are only "Descriptors". Patch by: me diff --git a/connectivity/source/sdbcx/VColumn.cxx b/connectivity/source/sdbcx/VColumn.cxx index 1e0e1c4e59c9..ae62c4ea52a3 100644 --- a/connectivity/source/sdbcx/VColumn.cxx +++ b/connectivity/source/sdbcx/VColumn.cxx @@ -42,7 +42,7 @@ using namespace ::com::sun::star::sdbc; ::rtl::OUString SAL_CALL OColumn::getImplementationName( ) throw (::com::sun::star::uno::RuntimeException) { if(isNew()) - return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.VColumnDescription"); + return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.VColumnDescriptor"); return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.VColumn"); } // ----------------------------------------------------------------------------- @@ -50,7 +50,7 @@ using namespace ::com::sun::star::sdbc; { ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(1); if(isNew()) - aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.ColumnDescription"); + aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.ColumnDescriptor"); else aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.Column"); diff --git a/connectivity/source/sdbcx/VIndexColumn.cxx b/connectivity/source/sdbcx/VIndexColumn.cxx index a1ec3f784321..6618117f2a45 100644 --- a/connectivity/source/sdbcx/VIndexColumn.cxx +++ b/connectivity/source/sdbcx/VIndexColumn.cxx @@ -34,7 +34,7 @@ using namespace ::com::sun::star::uno; ::rtl::OUString SAL_CALL OIndexColumn::getImplementationName( ) throw (::com::sun::star::uno::RuntimeException) { if(isNew()) - return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.VIndexColumnDescription"); + return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.VIndexColumnDescriptor"); return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.VIndexColumn"); } // ----------------------------------------------------------------------------- @@ -42,7 +42,7 @@ using namespace ::com::sun::star::uno; { ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(1); if(isNew()) - aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.IndexColumnDescription"); + aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.IndexColumnDescriptor"); else aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.IndexColumn"); diff --git a/connectivity/source/sdbcx/VKey.cxx b/connectivity/source/sdbcx/VKey.cxx index d897c2649ca6..749e0c895e57 100644 --- a/connectivity/source/sdbcx/VKey.cxx +++ b/connectivity/source/sdbcx/VKey.cxx @@ -46,7 +46,7 @@ using namespace ::com::sun::star::lang; ::rtl::OUString SAL_CALL OKey::getImplementationName( ) throw (::com::sun::star::uno::RuntimeException) { if(isNew()) - return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.VKeyDescription"); + return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.VKeyDescriptor"); return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.VKey"); } // ----------------------------------------------------------------------------- @@ -54,7 +54,7 @@ using namespace ::com::sun::star::lang; { ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(1); if(isNew()) - aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.KeyDescription"); + aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.KeyDescriptor"); else aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.Key"); diff --git a/connectivity/source/sdbcx/VKeyColumn.cxx b/connectivity/source/sdbcx/VKeyColumn.cxx index cd83c051c7bc..7809029e2435 100644 --- a/connectivity/source/sdbcx/VKeyColumn.cxx +++ b/connectivity/source/sdbcx/VKeyColumn.cxx @@ -35,7 +35,7 @@ using namespace cppu; ::rtl::OUString SAL_CALL OKeyColumn::getImplementationName( ) throw (::com::sun::star::uno::RuntimeException) { if(isNew()) - return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.VKeyColumnDescription"); + return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.VKeyColumnDescriptor"); return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.VKeyColumn"); } // ----------------------------------------------------------------------------- @@ -43,7 +43,7 @@ using namespace cppu; { ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(1); if(isNew()) - aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.KeyColumnDescription"); + aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.KeyColumnDescriptor"); else aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.KeyColumn"); commit d2f0e14de2a52180ed84c0402e47a0de16589203 Author: Damjan Jovanovic <dam...@apache.org> Date: Tue Sep 19 02:02:42 2017 +0000 Fix a typo in the XServiceInfo implementation for main/connectivity/source/sdbcx/VIndexColumn.cxx. It's implementation/service names are com.sun.star.sdbcx.VIndexColumn and com.sun.star.sdbcx.IndexColumn, not com.sun.star.sdbcx.VIndex and com.sun.star.sdbcx.Index. Patch by: me diff --git a/connectivity/source/sdbcx/VIndexColumn.cxx b/connectivity/source/sdbcx/VIndexColumn.cxx index ff47c1fc8fef..a1ec3f784321 100644 --- a/connectivity/source/sdbcx/VIndexColumn.cxx +++ b/connectivity/source/sdbcx/VIndexColumn.cxx @@ -35,16 +35,16 @@ using namespace ::com::sun::star::uno; { if(isNew()) return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.VIndexColumnDescription"); - return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.VIndex"); + return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.VIndexColumn"); } // ----------------------------------------------------------------------------- ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL OIndexColumn::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException) { ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(1); if(isNew()) - aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.IndexDescription"); + aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.IndexColumnDescription"); else - aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.Index"); + aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.IndexColumn"); return aSupported; } commit d84ff13f30982901a5601ed70b1a0d10e5013446 Author: Damjan Jovanovic <dam...@apache.org> Date: Mon Sep 18 15:46:40 2017 +0000 In buildName(), schema should be the empty string, instead of null. Add some JavaDoc for it, and use getClass().getName() for getImplementationName(), which is most accurate for Java. Patch by: me diff --git a/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OCatalog.java b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OCatalog.java index cdc9786d9443..b2ab379e685c 100644 --- a/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OCatalog.java +++ b/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/OCatalog.java @@ -72,7 +72,7 @@ public abstract class OCatalog extends ComponentBase @Override public String getImplementationName() { - return "com.sun.star.comp.connectivity.OCatalog"; + return getClass().getName(); } @Override @@ -128,6 +128,11 @@ public abstract class OCatalog extends ComponentBase return users; } + /** + * Builds the name which should be used to access the object later on in the collection. + * Will only be called in fillNames. + * @param row The current row from the resultset + */ protected String buildName(XRow row) throws SQLException { String catalog = row.getString(1); if (row.wasNull()) { @@ -135,7 +140,7 @@ public abstract class OCatalog extends ComponentBase } String schema = row.getString(2); if (row.wasNull()) { - schema = null; + schema = ""; } String table = row.getString(3); if (row.wasNull()) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits