Added:
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlPreparedStatement.java
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlPreparedStatement.java?rev=1805579&view=auto
==============================================================================
---
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlPreparedStatement.java
(added)
+++
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlPreparedStatement.java
Sun Aug 20 19:16:28 2017
@@ -0,0 +1,348 @@
+/**************************************************************
+ *
+ * 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 com.sun.star.sdbcx.comp.postgresql;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import com.sun.star.beans.PropertyVetoException;
+import com.sun.star.beans.UnknownPropertyException;
+import com.sun.star.beans.XPropertyChangeListener;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.beans.XPropertySetInfo;
+import com.sun.star.beans.XVetoableChangeListener;
+import com.sun.star.io.XInputStream;
+import com.sun.star.lang.DisposedException;
+import com.sun.star.lang.IllegalArgumentException;
+import com.sun.star.lang.WrappedTargetException;
+import com.sun.star.lib.uno.helper.ComponentBase;
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.sdbc.XArray;
+import com.sun.star.sdbc.XBlob;
+import com.sun.star.sdbc.XClob;
+import com.sun.star.sdbc.XCloseable;
+import com.sun.star.sdbc.XConnection;
+import com.sun.star.sdbc.XMultipleResults;
+import com.sun.star.sdbc.XParameters;
+import com.sun.star.sdbc.XPreparedBatchExecution;
+import com.sun.star.sdbc.XPreparedStatement;
+import com.sun.star.sdbc.XRef;
+import com.sun.star.sdbc.XResultSet;
+import com.sun.star.sdbc.XResultSetMetaData;
+import com.sun.star.sdbc.XResultSetMetaDataSupplier;
+import com.sun.star.sdbc.XWarningsSupplier;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.util.Date;
+import com.sun.star.util.DateTime;
+import com.sun.star.util.Time;
+import com.sun.star.util.XCancellable;
+
+public class PostgresqlPreparedStatement extends ComponentBase
+ implements XPreparedStatement, XCloseable, XPropertySet, XCancellable,
XResultSetMetaDataSupplier, XParameters, XPreparedBatchExecution,
+ XWarningsSupplier, XMultipleResults {
+
+ private XPreparedStatement impl;
+ private XCloseable implCloseable;
+ private XPropertySet implPropertySet;
+ private XCancellable implCancellable;
+ private XResultSetMetaDataSupplier implResultSetMetaDataSupplier;
+ private XParameters implParameters;
+ private XPreparedBatchExecution implPreparedBatchExecution;
+ private XWarningsSupplier implWarningsSupplier;
+ private XMultipleResults implMultipleResults;
+ private XConnection connection;
+ private AtomicBoolean isDisposed = new AtomicBoolean(false);
+
+ public PostgresqlPreparedStatement(XPreparedStatement impl, XConnection
connection) {
+ this.impl = impl;
+ this.implCloseable = UnoRuntime.queryInterface(XCloseable.class, impl);
+ this.implPropertySet = UnoRuntime.queryInterface(XPropertySet.class,
impl);
+ this.implCancellable = UnoRuntime.queryInterface(XCancellable.class,
impl);
+ this.implResultSetMetaDataSupplier =
UnoRuntime.queryInterface(XResultSetMetaDataSupplier.class, impl);
+ this.implParameters = UnoRuntime.queryInterface(XParameters.class,
impl);
+ this.implPreparedBatchExecution =
UnoRuntime.queryInterface(XPreparedBatchExecution.class, impl);
+ this.implWarningsSupplier =
UnoRuntime.queryInterface(XWarningsSupplier.class, impl);
+ this.implMultipleResults =
UnoRuntime.queryInterface(XMultipleResults.class, impl);
+ this.connection = connection;
+ }
+
+ // XComponentBase:
+
+ @Override
+ protected void postDisposing() {
+ isDisposed.set(true);
+ try {
+ implCloseable.close();
+ } catch (SQLException sqlException) {
+ }
+ }
+
+ private void checkDisposed() {
+ if (isDisposed.get()) {
+ throw new DisposedException();
+ }
+ }
+
+ // XPreparedStatement:
+
+ public boolean execute() throws SQLException {
+ checkDisposed();
+ return impl.execute();
+ }
+
+ public XResultSet executeQuery() throws SQLException {
+ checkDisposed();
+ return new PostgresqlResultSet(impl.executeQuery(), this);
+ }
+
+ public int executeUpdate() throws SQLException {
+ checkDisposed();
+ return impl.executeUpdate();
+ }
+
+ public XConnection getConnection() throws SQLException {
+ checkDisposed();
+ return connection;
+ }
+
+ // XCloseable:
+
+ public void close() throws SQLException {
+ dispose();
+ }
+
+ // XPropertySet:
+
+ public void addPropertyChangeListener(String arg0, XPropertyChangeListener
arg1) throws UnknownPropertyException, WrappedTargetException {
+ checkDisposed();
+ implPropertySet.addPropertyChangeListener(arg0, arg1);
+ }
+
+ public void addVetoableChangeListener(String arg0, XVetoableChangeListener
arg1) throws UnknownPropertyException, WrappedTargetException {
+ checkDisposed();
+ implPropertySet.addVetoableChangeListener(arg0, arg1);
+ }
+
+ public XPropertySetInfo getPropertySetInfo() {
+ checkDisposed();
+ return implPropertySet.getPropertySetInfo();
+ }
+
+ public Object getPropertyValue(String arg0) throws
UnknownPropertyException, WrappedTargetException {
+ checkDisposed();
+ return implPropertySet.getPropertyValue(arg0);
+ }
+
+ public void removePropertyChangeListener(String arg0,
XPropertyChangeListener arg1) throws UnknownPropertyException,
WrappedTargetException {
+ checkDisposed();
+ implPropertySet.removePropertyChangeListener(arg0, arg1);
+ }
+
+ public void removeVetoableChangeListener(String arg0,
XVetoableChangeListener arg1) throws UnknownPropertyException,
WrappedTargetException {
+ checkDisposed();
+ implPropertySet.removeVetoableChangeListener(arg0, arg1);
+ }
+
+ public void setPropertyValue(String arg0, Object arg1)
+ throws UnknownPropertyException, PropertyVetoException,
IllegalArgumentException, WrappedTargetException {
+ checkDisposed();
+ implPropertySet.setPropertyValue(arg0, arg1);
+ }
+
+ // XCancellable:
+
+ public void cancel() {
+ checkDisposed();
+ implCancellable.cancel();
+ }
+
+ // XResultSetMetaDataSupplier:
+
+ public XResultSetMetaData getMetaData() throws SQLException {
+ checkDisposed();
+ return new
PostgresqlResultSetMetaData(implResultSetMetaDataSupplier.getMetaData());
+ }
+
+ // XParameters:
+
+ public void clearParameters() throws SQLException {
+ checkDisposed();
+ implParameters.clearParameters();
+ }
+
+ public void setArray(int arg0, XArray arg1) throws SQLException {
+ checkDisposed();
+ implParameters.setArray(arg0, arg1);
+ }
+
+ public void setBinaryStream(int arg0, XInputStream arg1, int arg2) throws
SQLException {
+ checkDisposed();
+ implParameters.setBinaryStream(arg0, arg1, arg2);
+ }
+
+ public void setBlob(int arg0, XBlob arg1) throws SQLException {
+ checkDisposed();
+ implParameters.setBlob(arg0, arg1);
+ }
+
+ public void setBoolean(int arg0, boolean arg1) throws SQLException {
+ checkDisposed();
+ implParameters.setBoolean(arg0, arg1);
+ }
+
+ public void setByte(int arg0, byte arg1) throws SQLException {
+ checkDisposed();
+ implParameters.setByte(arg0, arg1);
+ }
+
+ public void setBytes(int arg0, byte[] arg1) throws SQLException {
+ checkDisposed();
+ implParameters.setBytes(arg0, arg1);
+ }
+
+ public void setCharacterStream(int arg0, XInputStream arg1, int arg2)
throws SQLException {
+ checkDisposed();
+ implParameters.setCharacterStream(arg0, arg1, arg2);
+ }
+
+ public void setClob(int arg0, XClob arg1) throws SQLException {
+ checkDisposed();
+ implParameters.setClob(arg0, arg1);
+ }
+
+ public void setDate(int arg0, Date arg1) throws SQLException {
+ checkDisposed();
+ implParameters.setDate(arg0, arg1);
+ }
+
+ public void setDouble(int arg0, double arg1) throws SQLException {
+ checkDisposed();
+ implParameters.setDouble(arg0, arg1);
+ }
+
+ public void setFloat(int arg0, float arg1) throws SQLException {
+ checkDisposed();
+ implParameters.setFloat(arg0, arg1);
+ }
+
+ public void setInt(int arg0, int arg1) throws SQLException {
+ checkDisposed();
+ implParameters.setInt(arg0, arg1);
+ }
+
+ public void setLong(int arg0, long arg1) throws SQLException {
+ checkDisposed();
+ implParameters.setLong(arg0, arg1);
+ }
+
+ public void setNull(int arg0, int arg1) throws SQLException {
+ checkDisposed();
+ implParameters.setNull(arg0, arg1);
+ }
+
+ public void setObject(int arg0, Object arg1) throws SQLException {
+ checkDisposed();
+ implParameters.setObject(arg0, arg1);
+ }
+
+ public void setObjectNull(int arg0, int arg1, String arg2) throws
SQLException {
+ checkDisposed();
+ implParameters.setObjectNull(arg0, arg1, arg2);
+ }
+
+ public void setObjectWithInfo(int arg0, Object arg1, int arg2, int arg3)
throws SQLException {
+ checkDisposed();
+ implParameters.setObjectWithInfo(arg0, arg1, arg2, arg3);
+ }
+
+ public void setRef(int arg0, XRef arg1) throws SQLException {
+ checkDisposed();
+ implParameters.setRef(arg0, arg1);
+ }
+
+ public void setShort(int arg0, short arg1) throws SQLException {
+ checkDisposed();
+ implParameters.setShort(arg0, arg1);
+ }
+
+ public void setString(int arg0, String arg1) throws SQLException {
+ checkDisposed();
+ implParameters.setString(arg0, arg1);
+ }
+
+ public void setTime(int arg0, Time arg1) throws SQLException {
+ checkDisposed();
+ implParameters.setTime(arg0, arg1);
+ }
+
+ public void setTimestamp(int arg0, DateTime arg1) throws SQLException {
+ checkDisposed();
+ implParameters.setTimestamp(arg0, arg1);
+ }
+
+ // XPreparedBatchExecution:
+
+ public void addBatch() throws SQLException {
+ checkDisposed();
+ implPreparedBatchExecution.addBatch();
+ }
+
+ public void clearBatch() throws SQLException {
+ checkDisposed();
+ implPreparedBatchExecution.clearBatch();
+ }
+
+ public int[] executeBatch() throws SQLException {
+ checkDisposed();
+ return implPreparedBatchExecution.executeBatch();
+ }
+
+ // XWarningsSupplier:
+
+ public void clearWarnings() throws SQLException {
+ checkDisposed();
+ implWarningsSupplier.clearWarnings();
+ }
+
+ public Object getWarnings() throws SQLException {
+ checkDisposed();
+ return implWarningsSupplier.getWarnings();
+ }
+
+ // XMultipleResults:
+
+ public boolean getMoreResults() throws SQLException {
+ checkDisposed();
+ return implMultipleResults.getMoreResults();
+ }
+
+ public XResultSet getResultSet() throws SQLException {
+ checkDisposed();
+ return new PostgresqlResultSet(implMultipleResults.getResultSet(),
this);
+ }
+
+ public int getUpdateCount() throws SQLException {
+ checkDisposed();
+ return implMultipleResults.getUpdateCount();
+ }
+
+
+}
Propchange:
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlPreparedStatement.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlResultSet.java
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlResultSet.java?rev=1805579&view=auto
==============================================================================
---
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlResultSet.java
(added)
+++
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlResultSet.java
Sun Aug 20 19:16:28 2017
@@ -0,0 +1,495 @@
+/**************************************************************
+ *
+ * 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 com.sun.star.sdbcx.comp.postgresql;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import com.sun.star.beans.PropertyVetoException;
+import com.sun.star.beans.UnknownPropertyException;
+import com.sun.star.beans.XPropertyChangeListener;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.beans.XPropertySetInfo;
+import com.sun.star.beans.XVetoableChangeListener;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.io.XInputStream;
+import com.sun.star.lang.DisposedException;
+import com.sun.star.lang.IllegalArgumentException;
+import com.sun.star.lang.WrappedTargetException;
+import com.sun.star.lib.uno.helper.ComponentBase;
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.sdbc.XArray;
+import com.sun.star.sdbc.XBlob;
+import com.sun.star.sdbc.XClob;
+import com.sun.star.sdbc.XCloseable;
+import com.sun.star.sdbc.XColumnLocate;
+import com.sun.star.sdbc.XRef;
+import com.sun.star.sdbc.XResultSet;
+import com.sun.star.sdbc.XResultSetMetaData;
+import com.sun.star.sdbc.XResultSetMetaDataSupplier;
+import com.sun.star.sdbc.XResultSetUpdate;
+import com.sun.star.sdbc.XRow;
+import com.sun.star.sdbc.XRowUpdate;
+import com.sun.star.sdbc.XWarningsSupplier;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.util.Date;
+import com.sun.star.util.DateTime;
+import com.sun.star.util.Time;
+import com.sun.star.util.XCancellable;
+
+public class PostgresqlResultSet extends ComponentBase
+ implements XResultSet, XRow, XResultSetMetaDataSupplier, XCancellable,
XWarningsSupplier, XResultSetUpdate,
+ XRowUpdate, XCloseable, XColumnLocate, XPropertySet {
+
+ private XResultSet impl;
+ private XRow implRow;
+ private XResultSetMetaDataSupplier implResultSetMetaDataSupplier;
+ private XCancellable implCancellable;
+ private XWarningsSupplier implWarningsSupplier;
+ private XResultSetUpdate implResultSetUpdate;
+ private XRowUpdate implRowUpdate;
+ private XCloseable implCloseable;
+ private XColumnLocate implColumnLocate;
+ private XPropertySet implPropertySet;
+ private Object statement;
+ private AtomicBoolean isDisposed = new AtomicBoolean(false);
+
+ public PostgresqlResultSet(XResultSet impl, Object statement) {
+ this.impl = impl;
+ this.implRow = UnoRuntime.queryInterface(XRow.class, impl);
+ this.implResultSetMetaDataSupplier =
UnoRuntime.queryInterface(XResultSetMetaDataSupplier.class, impl);
+ this.implCancellable = UnoRuntime.queryInterface(XCancellable.class,
impl);
+ this.implWarningsSupplier =
UnoRuntime.queryInterface(XWarningsSupplier.class, impl);
+ this.implResultSetUpdate =
UnoRuntime.queryInterface(XResultSetUpdate.class, impl);
+ this.implRowUpdate = UnoRuntime.queryInterface(XRowUpdate.class, impl);
+ this.implCloseable = UnoRuntime.queryInterface(XCloseable.class, impl);
+ this.implColumnLocate = UnoRuntime.queryInterface(XColumnLocate.class,
impl);
+ this.implPropertySet = UnoRuntime.queryInterface(XPropertySet.class,
impl);
+ this.statement = statement;
+ }
+
+ // XComponent:
+
+ @Override
+ protected synchronized void postDisposing() {
+ isDisposed.set(true);
+ try {
+ implCloseable.close();
+ } catch (SQLException sqlException) {
+ }
+ };
+
+ private void checkDisposed() throws DisposedException {
+ if (isDisposed.get()) {
+ throw new DisposedException();
+ }
+ }
+
+ // XCloseable:
+
+ public void close() throws SQLException {
+ dispose();
+ }
+
+ // XResultSet:
+
+ public boolean absolute(int arg0) throws SQLException {
+ checkDisposed();
+ return impl.absolute(arg0);
+ }
+
+ public void afterLast() throws SQLException {
+ checkDisposed();
+ impl.afterLast();
+ }
+
+ public void beforeFirst() throws SQLException {
+ checkDisposed();
+ impl.beforeFirst();
+ }
+
+ public boolean first() throws SQLException {
+ checkDisposed();
+ return impl.first();
+ }
+
+ public int getRow() throws SQLException {
+ checkDisposed();
+ return impl.getRow();
+ }
+
+ public Object getStatement() throws SQLException {
+ checkDisposed();
+ return statement;
+ }
+
+ public boolean isAfterLast() throws SQLException {
+ checkDisposed();
+ return impl.isAfterLast();
+ }
+
+ public boolean isBeforeFirst() throws SQLException {
+ checkDisposed();
+ return impl.isBeforeFirst();
+ }
+
+ public boolean isFirst() throws SQLException {
+ checkDisposed();
+ return impl.isFirst();
+ }
+
+ public boolean isLast() throws SQLException {
+ checkDisposed();
+ return impl.isLast();
+ }
+
+ public boolean last() throws SQLException {
+ checkDisposed();
+ return impl.last();
+ }
+
+ public boolean next() throws SQLException {
+ checkDisposed();
+ return impl.next();
+ }
+
+ public boolean previous() throws SQLException {
+ checkDisposed();
+ return impl.previous();
+ }
+
+ public void refreshRow() throws SQLException {
+ checkDisposed();
+ impl.refreshRow();
+ }
+
+ public boolean relative(int arg0) throws SQLException {
+ checkDisposed();
+ return impl.relative(arg0);
+ }
+
+ public boolean rowDeleted() throws SQLException {
+ checkDisposed();
+ return impl.rowDeleted();
+ }
+
+ public boolean rowInserted() throws SQLException {
+ checkDisposed();
+ return impl.rowInserted();
+ }
+
+ public boolean rowUpdated() throws SQLException {
+ checkDisposed();
+ return impl.rowUpdated();
+ }
+
+ // XRow:
+
+ public XArray getArray(int arg0) throws SQLException {
+ checkDisposed();
+ return implRow.getArray(arg0);
+ }
+
+ public XInputStream getBinaryStream(int arg0) throws SQLException {
+ checkDisposed();
+ return implRow.getBinaryStream(arg0);
+ }
+
+ public XBlob getBlob(int arg0) throws SQLException {
+ checkDisposed();
+ return implRow.getBlob(arg0);
+ }
+
+ public boolean getBoolean(int arg0) throws SQLException {
+ checkDisposed();
+ return implRow.getBoolean(arg0);
+ }
+
+ public byte getByte(int arg0) throws SQLException {
+ checkDisposed();
+ return implRow.getByte(arg0);
+ }
+
+ public byte[] getBytes(int arg0) throws SQLException {
+ checkDisposed();
+ return implRow.getBytes(arg0);
+ }
+
+ public XInputStream getCharacterStream(int arg0) throws SQLException {
+ checkDisposed();
+ return implRow.getCharacterStream(arg0);
+ }
+
+ public XClob getClob(int arg0) throws SQLException {
+ checkDisposed();
+ return implRow.getClob(arg0);
+ }
+
+ public Date getDate(int arg0) throws SQLException {
+ checkDisposed();
+ return implRow.getDate(arg0);
+ }
+
+ public double getDouble(int arg0) throws SQLException {
+ checkDisposed();
+ return implRow.getDouble(arg0);
+ }
+
+ public float getFloat(int arg0) throws SQLException {
+ checkDisposed();
+ return implRow.getFloat(arg0);
+ }
+
+ public int getInt(int arg0) throws SQLException {
+ checkDisposed();
+ return implRow.getInt(arg0);
+ }
+
+ public long getLong(int arg0) throws SQLException {
+ checkDisposed();
+ return implRow.getLong(arg0);
+ }
+
+ public Object getObject(int arg0, XNameAccess arg1) throws SQLException {
+ checkDisposed();
+ return implRow.getObject(arg0, arg1);
+ }
+
+ public XRef getRef(int arg0) throws SQLException {
+ checkDisposed();
+ return implRow.getRef(arg0);
+ }
+
+ public short getShort(int arg0) throws SQLException {
+ checkDisposed();
+ return implRow.getShort(arg0);
+ }
+
+ public String getString(int arg0) throws SQLException {
+ checkDisposed();
+ return implRow.getString(arg0);
+ }
+
+ public Time getTime(int arg0) throws SQLException {
+ checkDisposed();
+ return implRow.getTime(arg0);
+ }
+
+ public DateTime getTimestamp(int arg0) throws SQLException {
+ checkDisposed();
+ return implRow.getTimestamp(arg0);
+ }
+
+ public boolean wasNull() throws SQLException {
+ checkDisposed();
+ return implRow.wasNull();
+ }
+
+ // XResultSetMetaDataSupplier:
+
+ public XResultSetMetaData getMetaData() throws SQLException {
+ checkDisposed();
+ return new
PostgresqlResultSetMetaData(implResultSetMetaDataSupplier.getMetaData());
+ }
+
+ // XCancellable:
+
+ public void cancel() {
+ checkDisposed();
+ implCancellable.cancel();
+ }
+
+ // XWarningsSupplier:
+
+ public void clearWarnings() throws SQLException {
+ checkDisposed();
+ implWarningsSupplier.clearWarnings();
+ }
+
+ public Object getWarnings() throws SQLException {
+ checkDisposed();
+ return implWarningsSupplier.getWarnings();
+ }
+
+ // XResultSetUpdate:
+
+ public void cancelRowUpdates() throws SQLException {
+ checkDisposed();
+ implResultSetUpdate.cancelRowUpdates();
+ }
+
+ public void deleteRow() throws SQLException {
+ checkDisposed();
+ implResultSetUpdate.deleteRow();
+ }
+
+ public void insertRow() throws SQLException {
+ checkDisposed();
+ implResultSetUpdate.insertRow();
+ }
+
+ public void moveToCurrentRow() throws SQLException {
+ checkDisposed();
+ implResultSetUpdate.moveToCurrentRow();
+ }
+
+ public void moveToInsertRow() throws SQLException {
+ checkDisposed();
+ implResultSetUpdate.moveToInsertRow();
+ }
+
+ public void updateRow() throws SQLException {
+ checkDisposed();
+ implResultSetUpdate.updateRow();
+ }
+
+ // XRowUpdate:
+
+ public void updateBinaryStream(int arg0, XInputStream arg1, int arg2)
throws SQLException {
+ checkDisposed();
+ implRowUpdate.updateBinaryStream(arg0, arg1, arg2);
+ }
+
+ public void updateBoolean(int arg0, boolean arg1) throws SQLException {
+ checkDisposed();
+ implRowUpdate.updateBoolean(arg0, arg1);
+ }
+
+ public void updateByte(int arg0, byte arg1) throws SQLException {
+ checkDisposed();
+ implRowUpdate.updateByte(arg0, arg1);
+ }
+
+ public void updateBytes(int arg0, byte[] arg1) throws SQLException {
+ checkDisposed();
+ implRowUpdate.updateBytes(arg0, arg1);
+ }
+
+ public void updateCharacterStream(int arg0, XInputStream arg1, int arg2)
throws SQLException {
+ checkDisposed();
+ implRowUpdate.updateCharacterStream(arg0, arg1, arg2);
+ }
+
+ public void updateDate(int arg0, Date arg1) throws SQLException {
+ checkDisposed();
+ implRowUpdate.updateDate(arg0, arg1);
+ }
+
+ public void updateDouble(int arg0, double arg1) throws SQLException {
+ checkDisposed();
+ implRowUpdate.updateDouble(arg0, arg1);
+ }
+
+ public void updateFloat(int arg0, float arg1) throws SQLException {
+ checkDisposed();
+ implRowUpdate.updateFloat(arg0, arg1);
+ }
+
+ public void updateInt(int arg0, int arg1) throws SQLException {
+ checkDisposed();
+ implRowUpdate.updateInt(arg0, arg1);
+ }
+
+ public void updateLong(int arg0, long arg1) throws SQLException {
+ checkDisposed();
+ implRowUpdate.updateLong(arg0, arg1);
+ }
+
+ public void updateNull(int arg0) throws SQLException {
+ checkDisposed();
+ implRowUpdate.updateNull(arg0);
+ }
+
+ public void updateNumericObject(int arg0, Object arg1, int arg2) throws
SQLException {
+ checkDisposed();
+ implRowUpdate.updateNumericObject(arg0, arg1, arg2);
+ }
+
+ public void updateObject(int arg0, Object arg1) throws SQLException {
+ checkDisposed();
+ implRowUpdate.updateObject(arg0, arg1);
+ }
+
+ public void updateShort(int arg0, short arg1) throws SQLException {
+ checkDisposed();
+ implRowUpdate.updateShort(arg0, arg1);
+ }
+
+ public void updateString(int arg0, String arg1) throws SQLException {
+ checkDisposed();
+ implRowUpdate.updateString(arg0, arg1);
+ }
+
+ public void updateTime(int arg0, Time arg1) throws SQLException {
+ checkDisposed();
+ implRowUpdate.updateTime(arg0, arg1);
+ }
+
+ public void updateTimestamp(int arg0, DateTime arg1) throws SQLException {
+ checkDisposed();
+ implRowUpdate.updateTimestamp(arg0, arg1);
+ }
+
+ // XColumnLocate:
+
+ public int findColumn(String arg0) throws SQLException {
+ checkDisposed();
+ return implColumnLocate.findColumn(arg0);
+ }
+
+ // XPropertySet:
+
+ public void addPropertyChangeListener(String arg0, XPropertyChangeListener
arg1) throws UnknownPropertyException, WrappedTargetException {
+ checkDisposed();
+ implPropertySet.addPropertyChangeListener(arg0, arg1);
+ }
+
+ public void addVetoableChangeListener(String arg0, XVetoableChangeListener
arg1) throws UnknownPropertyException, WrappedTargetException {
+ checkDisposed();
+ implPropertySet.addVetoableChangeListener(arg0, arg1);
+ }
+
+ public XPropertySetInfo getPropertySetInfo() {
+ checkDisposed();
+ return implPropertySet.getPropertySetInfo();
+ }
+
+ public Object getPropertyValue(String arg0) throws
UnknownPropertyException, WrappedTargetException {
+ checkDisposed();
+ return implPropertySet.getPropertyValue(arg0);
+ }
+
+ public void removePropertyChangeListener(String arg0,
XPropertyChangeListener arg1) throws UnknownPropertyException,
WrappedTargetException {
+ checkDisposed();
+ implPropertySet.removePropertyChangeListener(arg0, arg1);
+ }
+
+ public void removeVetoableChangeListener(String arg0,
XVetoableChangeListener arg1) throws UnknownPropertyException,
WrappedTargetException {
+ checkDisposed();
+ implPropertySet.removeVetoableChangeListener(arg0, arg1);
+ }
+
+ public void setPropertyValue(String arg0, Object arg1)
+ throws UnknownPropertyException, PropertyVetoException,
IllegalArgumentException, WrappedTargetException {
+ checkDisposed();
+ implPropertySet.setPropertyValue(arg0, arg1);
+ }
+}
Propchange:
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlResultSet.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlResultSetMetaData.java
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlResultSetMetaData.java?rev=1805579&view=auto
==============================================================================
---
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlResultSetMetaData.java
(added)
+++
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlResultSetMetaData.java
Sun Aug 20 19:16:28 2017
@@ -0,0 +1,127 @@
+/**************************************************************
+ *
+ * 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 com.sun.star.sdbcx.comp.postgresql;
+
+import com.sun.star.lib.uno.helper.WeakBase;
+import com.sun.star.sdbc.DataType;
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.sdbc.XResultSetMetaData;
+
+public class PostgresqlResultSetMetaData extends WeakBase implements
XResultSetMetaData {
+
+ private XResultSetMetaData impl;
+
+ public PostgresqlResultSetMetaData(XResultSetMetaData impl) {
+ this.impl = impl;
+ }
+
+ public String getCatalogName(int arg0) throws SQLException {
+ return impl.getCatalogName(arg0);
+ }
+
+ public int getColumnCount() throws SQLException {
+ return impl.getColumnCount();
+ }
+
+ public int getColumnDisplaySize(int arg0) throws SQLException {
+ return impl.getColumnDisplaySize(arg0);
+ }
+
+ public String getColumnLabel(int arg0) throws SQLException {
+ return impl.getColumnLabel(arg0);
+ }
+
+ public String getColumnName(int arg0) throws SQLException {
+ return impl.getColumnName(arg0);
+ }
+
+ public String getColumnServiceName(int arg0) throws SQLException {
+ return impl.getColumnServiceName(arg0);
+ }
+
+ public int getColumnType(int column) throws SQLException {
+ int columnType = impl.getColumnType(column);
+ if (columnType == DataType.BIT) {
+ String columnName = getColumnTypeName(column);
+ if (columnName.equals("bool")) {
+ columnType = DataType.BOOLEAN;
+ }
+ }
+ return columnType;
+ }
+
+ public String getColumnTypeName(int column) throws SQLException {
+ return impl.getColumnTypeName(column);
+ }
+
+ public int getPrecision(int arg0) throws SQLException {
+ return impl.getPrecision(arg0);
+ }
+
+ public int getScale(int arg0) throws SQLException {
+ return impl.getScale(arg0);
+ }
+
+ public String getSchemaName(int arg0) throws SQLException {
+ return impl.getSchemaName(arg0);
+ }
+
+ public String getTableName(int arg0) throws SQLException {
+ return impl.getTableName(arg0);
+ }
+
+ public boolean isAutoIncrement(int arg0) throws SQLException {
+ return impl.isAutoIncrement(arg0);
+ }
+
+ public boolean isCaseSensitive(int arg0) throws SQLException {
+ return impl.isCaseSensitive(arg0);
+ }
+
+ public boolean isCurrency(int arg0) throws SQLException {
+ return impl.isCurrency(arg0);
+ }
+
+ public boolean isDefinitelyWritable(int arg0) throws SQLException {
+ return impl.isDefinitelyWritable(arg0);
+ }
+
+ public int isNullable(int arg0) throws SQLException {
+ return impl.isNullable(arg0);
+ }
+
+ public boolean isReadOnly(int arg0) throws SQLException {
+ return impl.isReadOnly(arg0);
+ }
+
+ public boolean isSearchable(int arg0) throws SQLException {
+ return impl.isSearchable(arg0);
+ }
+
+ public boolean isSigned(int arg0) throws SQLException {
+ return impl.isSigned(arg0);
+ }
+
+ public boolean isWritable(int arg0) throws SQLException {
+ return impl.isWritable(arg0);
+ }
+}
Propchange:
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlResultSetMetaData.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlStatement.java
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlStatement.java?rev=1805579&view=auto
==============================================================================
---
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlStatement.java
(added)
+++
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlStatement.java
Sun Aug 20 19:16:28 2017
@@ -0,0 +1,188 @@
+/**************************************************************
+ *
+ * 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 com.sun.star.sdbcx.comp.postgresql;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import com.sun.star.beans.PropertyVetoException;
+import com.sun.star.beans.UnknownPropertyException;
+import com.sun.star.beans.XPropertyChangeListener;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.beans.XPropertySetInfo;
+import com.sun.star.beans.XVetoableChangeListener;
+import com.sun.star.lang.DisposedException;
+import com.sun.star.lang.IllegalArgumentException;
+import com.sun.star.lang.WrappedTargetException;
+import com.sun.star.lib.uno.helper.ComponentBase;
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.sdbc.XCloseable;
+import com.sun.star.sdbc.XConnection;
+import com.sun.star.sdbc.XMultipleResults;
+import com.sun.star.sdbc.XResultSet;
+import com.sun.star.sdbc.XStatement;
+import com.sun.star.sdbc.XWarningsSupplier;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.util.XCancellable;
+
+public class PostgresqlStatement extends ComponentBase
+ implements XCloseable, XPropertySet, XCancellable, XStatement,
XWarningsSupplier, XMultipleResults {
+
+ private XStatement impl;
+ private XCloseable implCloseable;
+ private XPropertySet implPropertySet;
+ private XCancellable implCancellable;
+ private XWarningsSupplier implWarningsSupplier;
+ private XMultipleResults implMultipleResults;
+ private XConnection connection;
+ private AtomicBoolean isDisposed = new AtomicBoolean(false);
+
+ public PostgresqlStatement(XStatement impl, XConnection connection) {
+ this.impl = impl;
+ this.implCloseable = UnoRuntime.queryInterface(XCloseable.class, impl);
+ this.implPropertySet = UnoRuntime.queryInterface(XPropertySet.class,
impl);
+ this.implCancellable = UnoRuntime.queryInterface(XCancellable.class,
impl);
+ this.implWarningsSupplier =
UnoRuntime.queryInterface(XWarningsSupplier.class, impl);
+ this.implMultipleResults =
UnoRuntime.queryInterface(XMultipleResults.class, impl);
+ this.connection = connection;
+ }
+
+ // XComponentBase:
+
+ @Override
+ protected void postDisposing() {
+ isDisposed.set(true);
+ try {
+ implCloseable.close();
+ } catch (SQLException sqlException) {
+ }
+ }
+
+ private void checkDisposed() throws DisposedException {
+ if (isDisposed.get()) {
+ throw new DisposedException();
+ }
+ }
+
+ // XStatement:
+
+ public boolean execute(String arg0) throws SQLException {
+ checkDisposed();
+ System.out.println(arg0);
+ return impl.execute(arg0);
+ }
+
+ public XResultSet executeQuery(String arg0) throws SQLException {
+ checkDisposed();
+ XResultSet results = impl.executeQuery(arg0);
+ return new PostgresqlResultSet(results, this);
+ }
+
+ public int executeUpdate(String arg0) throws SQLException {
+ checkDisposed();
+ return impl.executeUpdate(arg0);
+ }
+
+ public XConnection getConnection() throws SQLException {
+ checkDisposed();
+ return connection;
+ }
+
+ // XCloseable:
+
+ public void close() throws SQLException {
+ dispose();
+ }
+
+ // XPropertySet:
+
+ public void addPropertyChangeListener(String arg0, XPropertyChangeListener
arg1) throws UnknownPropertyException, WrappedTargetException {
+ checkDisposed();
+ implPropertySet.addPropertyChangeListener(arg0, arg1);
+ }
+
+ public void addVetoableChangeListener(String arg0, XVetoableChangeListener
arg1) throws UnknownPropertyException, WrappedTargetException {
+ checkDisposed();
+ implPropertySet.addVetoableChangeListener(arg0, arg1);
+ }
+
+ public XPropertySetInfo getPropertySetInfo() {
+ checkDisposed();
+ return implPropertySet.getPropertySetInfo();
+ }
+
+ public Object getPropertyValue(String arg0) throws
UnknownPropertyException, WrappedTargetException {
+ checkDisposed();
+ return implPropertySet.getPropertyValue(arg0);
+ }
+
+ public void removePropertyChangeListener(String arg0,
XPropertyChangeListener arg1) throws UnknownPropertyException,
WrappedTargetException {
+ checkDisposed();
+ implPropertySet.removePropertyChangeListener(arg0, arg1);
+ }
+
+ public void removeVetoableChangeListener(String arg0,
XVetoableChangeListener arg1) throws UnknownPropertyException,
WrappedTargetException {
+ checkDisposed();
+ implPropertySet.removeVetoableChangeListener(arg0, arg1);
+ }
+
+ public void setPropertyValue(String arg0, Object arg1)
+ throws UnknownPropertyException, PropertyVetoException,
IllegalArgumentException, WrappedTargetException {
+ checkDisposed();
+ implPropertySet.setPropertyValue(arg0, arg1);
+ }
+
+ // XCancellable:
+
+ public void cancel() {
+ checkDisposed();
+ implCancellable.cancel();
+ }
+
+ // XWarningsSupplier:
+
+ public void clearWarnings() throws SQLException {
+ checkDisposed();
+ implWarningsSupplier.clearWarnings();
+ }
+
+ public Object getWarnings() throws SQLException {
+ checkDisposed();
+ return implWarningsSupplier.getWarnings();
+ }
+
+ // XMultipleResults:
+
+ public boolean getMoreResults() throws SQLException {
+ checkDisposed();
+ return implMultipleResults.getMoreResults();
+ }
+
+ public XResultSet getResultSet() throws SQLException {
+ checkDisposed();
+ return new PostgresqlResultSet(implMultipleResults.getResultSet(),
this);
+ }
+
+ public int getUpdateCount() throws SQLException {
+ checkDisposed();
+ return implMultipleResults.getUpdateCount();
+ }
+}
Propchange:
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlStatement.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlTable.java
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlTable.java?rev=1805579&view=auto
==============================================================================
---
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlTable.java
(added)
+++
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlTable.java
Sun Aug 20 19:16:28 2017
@@ -0,0 +1,125 @@
+/**************************************************************
+ *
+ * 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 com.sun.star.sdbcx.comp.postgresql;
+
+import java.util.List;
+import java.util.Map;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.ElementExistException;
+import com.sun.star.container.NoSuchElementException;
+import com.sun.star.lang.IndexOutOfBoundsException;
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.sdbc.XConnection;
+import com.sun.star.sdbcx.comp.postgresql.comphelper.CompHelper;
+import com.sun.star.sdbcx.comp.postgresql.sdbcx.OColumnContainer;
+import com.sun.star.sdbcx.comp.postgresql.sdbcx.OContainer;
+import com.sun.star.sdbcx.comp.postgresql.sdbcx.OIndexContainer;
+import com.sun.star.sdbcx.comp.postgresql.sdbcx.OKey;
+import com.sun.star.sdbcx.comp.postgresql.sdbcx.OKeyContainer;
+import com.sun.star.sdbcx.comp.postgresql.sdbcx.OTable;
+import com.sun.star.sdbcx.comp.postgresql.sdbcx.SqlTableHelper;
+import
com.sun.star.sdbcx.comp.postgresql.sdbcx.SqlTableHelper.ColumnDescription;
+import
com.sun.star.sdbcx.comp.postgresql.sdbcx.descriptors.SdbcxTableDescriptor;
+
+public class PostgresqlTable extends OTable {
+ private PostgresqlTable(Object lock, XConnection connection, OContainer
tables, String name,
+ String catalogName, String schemaName, String description, String
type) {
+ super(lock, name, true, connection, tables);
+ super.catalogName = catalogName;
+ super.schemaName = schemaName;
+ super.description = description;
+ super.type = type;
+ }
+
+ public static PostgresqlTable create(XConnection connection, OContainer
tables, String name,
+ String catalogName, String schemaName, String description, String
type) {
+ Object lock = new Object();
+ return new PostgresqlTable(lock, connection, tables, name,
catalogName, schemaName, description, type);
+ }
+
+ @Override
+ public XPropertySet createDataDescriptor() {
+ SdbcxTableDescriptor descriptor = SdbcxTableDescriptor.create(true);
+ synchronized (lock) {
+ CompHelper.copyProperties(this, descriptor);
+ }
+ return descriptor;
+ }
+
+ @Override
+ public void setName(String name) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void rename(String name) throws SQLException, ElementExistException
{
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void alterColumnByIndex(int index, XPropertySet descriptor) throws
SQLException, IndexOutOfBoundsException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void alterColumnByName(String name, XPropertySet descriptor) throws
SQLException, NoSuchElementException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ protected OContainer refreshColumns() {
+ try {
+ List<ColumnDescription> columns = new
SqlTableHelper().readColumns(getConnection().getMetaData(), catalogName,
schemaName, getName());
+ return new OColumnContainer(lock, isCaseSensitive(), columns,
this, getConnection().getMetaData());
+ } catch (SQLException sqlException) {
+ return null;
+ }
+ }
+
+ @Override
+ protected OContainer refreshIndexes() {
+ try {
+ List<String> indexes = new
SqlTableHelper().readIndexes(getConnection().getMetaData(), catalogName,
schemaName, getName(), this);
+ return new OIndexContainer(lock, indexes, isCaseSensitive(), this);
+ } catch (SQLException sqlException) {
+ return null;
+ }
+ }
+
+ @Override
+ protected OContainer refreshKeys() {
+ try {
+ Map<String, OKey> keys = new SqlTableHelper().readKeys(
+ getConnection().getMetaData(), catalogName, schemaName,
getName(), isCaseSensitive(), this);
+ return OKeyContainer.create(isCaseSensitive(), keys, this);
+ } catch (SQLException sqlException) {
+ return null;
+ }
+ }
+
+
+}
Propchange:
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlTable.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlTables.java
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlTables.java?rev=1805579&view=auto
==============================================================================
---
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlTables.java
(added)
+++
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlTables.java
Sun Aug 20 19:16:28 2017
@@ -0,0 +1,151 @@
+/**************************************************************
+ *
+ * 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 com.sun.star.sdbcx.comp.postgresql;
+
+import java.util.List;
+
+import com.sun.star.beans.UnknownPropertyException;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.lang.IllegalArgumentException;
+import com.sun.star.lang.IndexOutOfBoundsException;
+import com.sun.star.lang.WrappedTargetException;
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.sdbc.XDatabaseMetaData;
+import com.sun.star.sdbc.XResultSet;
+import com.sun.star.sdbc.XRow;
+import com.sun.star.sdbc.XStatement;
+import com.sun.star.sdbcx.comp.postgresql.comphelper.CompHelper;
+import com.sun.star.sdbcx.comp.postgresql.sdbcx.OContainer;
+import
com.sun.star.sdbcx.comp.postgresql.sdbcx.descriptors.SdbcxTableDescriptor;
+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.PropertyIds;
+import com.sun.star.sdbcx.comp.postgresql.util.StandardSQLState;
+import com.sun.star.sdbcx.comp.postgresql.util.DbTools.NameComponents;
+import com.sun.star.uno.Any;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.UnoRuntime;
+
+public class PostgresqlTables extends OContainer {
+ private XDatabaseMetaData metadata;
+ private PostgresqlCatalog catalog;
+
+ public PostgresqlTables(Object lock, XDatabaseMetaData metadata,
PostgresqlCatalog catalog, List<String> names) {
+ super(lock, true, names);
+ this.metadata = metadata;
+ this.catalog = catalog;
+ }
+
+ @Override
+ public XPropertySet createObject(String name) throws SQLException {
+ NameComponents nameComponents =
DbTools.qualifiedNameComponents(metadata, name, ComposeRule.InDataManipulation);
+ Object queryCatalog = nameComponents.getCatalog().isEmpty() ? Any.VOID
: nameComponents.getCatalog();
+ XPropertySet ret = null;
+ XResultSet results = null;
+ try {
+ results = metadata.getTables(
+ queryCatalog, nameComponents.getSchema(),
nameComponents.getTable(), new String[] { "VIEW", "TABLE", "%" });
+ if (results != null) {
+ XRow row = UnoRuntime.queryInterface(XRow.class, results);
+ if (results.next()) {
+ String type = row.getString(4);
+ String remarks = row.getString(5);
+ ret = PostgresqlTable.create(metadata.getConnection(),
this, nameComponents.getTable(),
+ nameComponents.getCatalog(),
nameComponents.getSchema(), remarks, type);
+ }
+ }
+ } finally {
+ CompHelper.disposeComponent(results);
+ }
+ return ret;
+
+ }
+
+ @Override
+ public void dropObject(int index, String name) throws SQLException {
+ try {
+ Object object = getObject(index);
+
+ NameComponents nameComponents =
DbTools.qualifiedNameComponents(metadata, name, ComposeRule.InDataManipulation);
+
+ boolean isView = false;
+ XPropertySet propertySet =
UnoRuntime.queryInterface(XPropertySet.class, object);
+ if (propertySet != null) {
+ isView =
AnyConverter.toString(propertySet.getPropertyValue(PropertyIds.TYPE.name)).equals("VIEW");
+ }
+
+ String composedName = DbTools.composeTableName(metadata,
nameComponents.getCatalog(), nameComponents.getSchema(),
nameComponents.getTable(),
+ true, ComposeRule.InDataManipulation);
+ String sql = String.format("DROP %s %s", isView ? "VIEW" :
"TABLE", composedName);
+
+ XStatement statement = null;
+ try {
+ statement = metadata.getConnection().createStatement();
+ statement.execute(sql);
+ } finally {
+ CompHelper.disposeComponent(statement);
+ }
+ // FIXME: delete it from our views
+ } catch (IllegalArgumentException illegalArgumentException) {
+ throw new SQLException("Error", this,
StandardSQLState.SQL_GENERAL_ERROR.text(), 0, illegalArgumentException);
+ } catch (UnknownPropertyException unknownPropertyException) {
+ throw new SQLException("Error", this,
StandardSQLState.SQL_GENERAL_ERROR.text(), 0, unknownPropertyException);
+ } catch (WrappedTargetException wrappedTargetException) {
+ throw new SQLException("Error", this,
StandardSQLState.SQL_GENERAL_ERROR.text(), 0, wrappedTargetException);
+ }
+ }
+
+ @Override
+ public void impl_refresh() {
+ catalog.refreshTables();
+ }
+
+ @Override
+ public XPropertySet createDescriptor() {
+ return SdbcxTableDescriptor.create(true);
+ }
+
+ @Override
+ public XPropertySet appendObject(String name, XPropertySet descriptor)
throws SQLException {
+ createTable(descriptor);
+ return createObject(name);
+ }
+
+ void createTable(XPropertySet descriptor) throws SQLException {
+ XStatement statement = null;
+ try {
+ String sql = DbTools.createSqlCreateTableStatement(descriptor,
metadata.getConnection(), null, "(M,D)");
+ statement = metadata.getConnection().createStatement();
+ statement.execute(sql);
+ } catch (IndexOutOfBoundsException indexOutOfBoundsException) {
+ throw new SQLException("Error", this,
StandardSQLState.SQL_GENERAL_ERROR.text(), 0, indexOutOfBoundsException);
+ } catch (IllegalArgumentException illegalArgumentException) {
+ throw new SQLException("Error", this,
StandardSQLState.SQL_GENERAL_ERROR.text(), 0, illegalArgumentException);
+ } catch (UnknownPropertyException unknownPropertyException) {
+ throw new SQLException("Error", this,
StandardSQLState.SQL_GENERAL_ERROR.text(), 0, unknownPropertyException);
+ } catch (WrappedTargetException wrappedTargetException) {
+ throw new SQLException("Error", this,
StandardSQLState.SQL_GENERAL_ERROR.text(), 0, wrappedTargetException);
+ } finally {
+ CompHelper.disposeComponent(statement);
+ }
+ }
+}
Propchange:
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/PostgresqlTables.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/comphelper/CompHelper.java
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/comphelper/CompHelper.java?rev=1805579&view=auto
==============================================================================
---
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/comphelper/CompHelper.java
(added)
+++
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/comphelper/CompHelper.java
Sun Aug 20 19:16:28 2017
@@ -0,0 +1,74 @@
+/**************************************************************
+ *
+ * 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 com.sun.star.sdbcx.comp.postgresql.comphelper;
+
+import com.sun.star.beans.Property;
+import com.sun.star.beans.PropertyAttribute;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.beans.XPropertySetInfo;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.uno.UnoRuntime;
+
+public class CompHelper {
+ /**
+ * If the given parameter is an XComponent, calls dispose() on it.
+ * @param object the UNO interface to try dispose; may be null.
+ */
+ public static void disposeComponent(final Object object) {
+ final XComponent component =
UnoRuntime.queryInterface(XComponent.class, object);
+ if (component != null) {
+ component.dispose();
+ }
+ }
+
+ public static void copyProperties(final XPropertySet src, final
XPropertySet dst) {
+ if (src == null || dst == null) {
+ return;
+ }
+
+ XPropertySetInfo srcPropertySetInfo = src.getPropertySetInfo();
+ XPropertySetInfo dstPropertySetInfo = dst.getPropertySetInfo();
+
+ for (Property srcProperty : srcPropertySetInfo.getProperties()) {
+ if (dstPropertySetInfo.hasPropertyByName(srcProperty.Name)) {
+ try {
+ Property dstProperty =
dstPropertySetInfo.getPropertyByName(srcProperty.Name);
+ if ((dstProperty.Attributes & PropertyAttribute.READONLY)
== 0) {
+ Object value = src.getPropertyValue(srcProperty.Name);
+ if ((dstProperty.Attributes &
PropertyAttribute.MAYBEVOID) == 0 || value != null) {
+ dst.setPropertyValue(srcProperty.Name, value);
+ }
+ }
+ } catch (Exception e) {
+ String error = "Could not copy property '" +
srcProperty.Name +
+ "' to the destination set";
+ XServiceInfo serviceInfo =
UnoRuntime.queryInterface(XServiceInfo.class, dst);
+ if (serviceInfo != null) {
+ error += " (a '" + serviceInfo.getImplementationName()
+ "' implementation)";
+ }
+
+ }
+ }
+ }
+ }
+}
Propchange:
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/comphelper/CompHelper.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/comphelper/OArrayEnumeration.java
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/comphelper/OArrayEnumeration.java?rev=1805579&view=auto
==============================================================================
---
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/comphelper/OArrayEnumeration.java
(added)
+++
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/comphelper/OArrayEnumeration.java
Sun Aug 20 19:16:28 2017
@@ -0,0 +1,55 @@
+/**************************************************************
+ *
+ * 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 com.sun.star.sdbcx.comp.postgresql.comphelper;
+
+import com.sun.star.container.NoSuchElementException;
+import com.sun.star.container.XEnumeration;
+import com.sun.star.lang.WrappedTargetException;
+import com.sun.star.lib.uno.helper.WeakBase;
+
+public class OArrayEnumeration extends WeakBase implements XEnumeration {
+ private Object[] elements;
+ private int position;
+
+ public OArrayEnumeration(Object[] elements) {
+ this.elements = elements;
+ }
+
+ @Override
+ public boolean hasMoreElements() {
+ synchronized (this) {
+ return position < elements.length;
+ }
+ }
+
+ @Override
+ public Object nextElement()
+ throws NoSuchElementException, WrappedTargetException {
+ synchronized (this) {
+ if (position < elements.length) {
+ return elements[position++];
+ } else {
+ throw new NoSuchElementException();
+ }
+ }
+ }
+}
Propchange:
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/comphelper/OArrayEnumeration.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/comphelper/OEnumerationByIndex.java
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/comphelper/OEnumerationByIndex.java?rev=1805579&view=auto
==============================================================================
---
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/comphelper/OEnumerationByIndex.java
(added)
+++
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/comphelper/OEnumerationByIndex.java
Sun Aug 20 19:16:28 2017
@@ -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 com.sun.star.sdbcx.comp.postgresql.comphelper;
+
+import com.sun.star.container.NoSuchElementException;
+import com.sun.star.container.XEnumeration;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.EventObject;
+import com.sun.star.lang.WrappedTargetException;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XEventListener;
+import com.sun.star.lib.uno.helper.WeakBase;
+import com.sun.star.uno.UnoRuntime;
+
+public class OEnumerationByIndex extends WeakBase implements XEnumeration,
XEventListener {
+ private XIndexAccess collection;
+ private int position;
+ boolean isListening;
+
+ public OEnumerationByIndex(XIndexAccess collection) {
+ this.collection = collection;
+ startDisposeListening();
+ }
+
+ @Override
+ public void disposing(EventObject event) {
+ synchronized (this) {
+ if (event.Source == collection) {
+ collection = null;
+ }
+ }
+ }
+
+ @Override
+ public boolean hasMoreElements() {
+ synchronized (this) {
+ if (collection != null) {
+ if (position < collection.getCount()) {
+ return true;
+ } else {
+ stopDisposeListening();
+ collection = null;
+ }
+ }
+ return false;
+ }
+ }
+
+ @Override
+ public Object nextElement()
+ throws NoSuchElementException, WrappedTargetException {
+ Object value = null;
+ synchronized (this) {
+ if (collection != null) {
+ if (position < collection.getCount()) {
+ try {
+ value = collection.getByIndex(position++);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException
indexOutOfBoundsException) {
+ // can't happen
+ }
+ }
+ if (position >= collection.getCount()) {
+ stopDisposeListening();
+ collection = null;
+ }
+ }
+ }
+ if (value == null) {
+ throw new NoSuchElementException();
+ }
+ return value;
+ }
+
+ private void startDisposeListening() {
+ synchronized (this) {
+ if (isListening) {
+ return;
+ }
+ XComponent component = UnoRuntime.queryInterface(XComponent.class,
collection);
+ if (component != null) {
+ component.addEventListener(this);
+ isListening = true;
+ }
+ }
+ }
+
+ private void stopDisposeListening() {
+ synchronized (this) {
+ if (!isListening) {
+ return;
+ }
+ XComponent component = UnoRuntime.queryInterface(XComponent.class,
collection);
+ if (component != null) {
+ component.removeEventListener(this);
+ isListening = false;
+ }
+ }
+ }
+}
Propchange:
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/comphelper/OEnumerationByIndex.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/comphelper/OEnumerationByName.java
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/comphelper/OEnumerationByName.java?rev=1805579&view=auto
==============================================================================
---
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/comphelper/OEnumerationByName.java
(added)
+++
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/comphelper/OEnumerationByName.java
Sun Aug 20 19:16:28 2017
@@ -0,0 +1,116 @@
+/**************************************************************
+ *
+ * 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 com.sun.star.sdbcx.comp.postgresql.comphelper;
+
+import com.sun.star.container.NoSuchElementException;
+import com.sun.star.container.XEnumeration;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.lang.EventObject;
+import com.sun.star.lang.WrappedTargetException;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XEventListener;
+import com.sun.star.lib.uno.helper.WeakBase;
+import com.sun.star.uno.UnoRuntime;
+
+public class OEnumerationByName extends WeakBase implements XEnumeration,
XEventListener {
+ private String[] names;
+ private int position;
+ private XNameAccess collection;
+ private boolean isListening;
+
+ public OEnumerationByName(XNameAccess collection) {
+ this.collection = collection;
+ names = collection.getElementNames();
+ startDisposeListening();
+ }
+
+ @Override
+ public void disposing(EventObject event) {
+ synchronized (this) {
+ if (event.Source == collection) {
+ collection = null;
+ }
+ }
+ }
+
+ @Override
+ public boolean hasMoreElements() {
+ synchronized (this) {
+ if (collection != null) {
+ if (position < names.length) {
+ return true;
+ } else {
+ stopDisposeListening();
+ collection = null;
+ }
+ }
+ return false;
+ }
+ }
+
+ @Override
+ public Object nextElement()
+ throws NoSuchElementException, WrappedTargetException {
+ Object value = null;
+ synchronized (this) {
+ if (collection != null) {
+ if (position < names.length) {
+ value = collection.getByName(names[position++]);
+ }
+ if (position >= names.length) {
+ stopDisposeListening();
+ collection = null;
+ }
+ }
+ }
+ if (value == null) {
+ throw new NoSuchElementException();
+ }
+ return value;
+ }
+
+ private void startDisposeListening() {
+ synchronized (this) {
+ if (isListening) {
+ return;
+ }
+ XComponent component = UnoRuntime.queryInterface(XComponent.class,
collection);
+ if (component != null) {
+ component.addEventListener(this);
+ isListening = true;
+ }
+ }
+ }
+
+ private void stopDisposeListening() {
+ synchronized (this) {
+ if (!isListening) {
+ return;
+ }
+ XComponent component = UnoRuntime.queryInterface(XComponent.class,
collection);
+ if (component != null) {
+ component.removeEventListener(this);
+ isListening = false;
+ }
+ }
+ }
+}
Propchange:
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/comphelper/OEnumerationByName.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/comphelper/PropertySet.java
URL:
http://svn.apache.org/viewvc/openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/comphelper/PropertySet.java?rev=1805579&view=auto
==============================================================================
---
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/comphelper/PropertySet.java
(added)
+++
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/comphelper/PropertySet.java
Sun Aug 20 19:16:28 2017
@@ -0,0 +1,160 @@
+/**************************************************************
+ *
+ * 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 com.sun.star.sdbcx.comp.postgresql.comphelper;
+
+import com.sun.star.beans.PropertyVetoException;
+import com.sun.star.beans.UnknownPropertyException;
+import com.sun.star.beans.XFastPropertySet;
+import com.sun.star.beans.XMultiPropertySet;
+import com.sun.star.beans.XPropertiesChangeListener;
+import com.sun.star.beans.XPropertyChangeListener;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.beans.XPropertySetInfo;
+import com.sun.star.beans.XVetoableChangeListener;
+import com.sun.star.lang.DisposedException;
+import com.sun.star.lang.IllegalArgumentException;
+import com.sun.star.lang.WrappedTargetException;
+import com.sun.star.lib.uno.helper.ComponentBase;
+import
com.sun.star.sdbcx.comp.postgresql.comphelper.PropertySetAdapter.PropertyGetter;
+import
com.sun.star.sdbcx.comp.postgresql.comphelper.PropertySetAdapter.PropertySetter;
+import com.sun.star.uno.Type;
+
+public class PropertySet extends ComponentBase implements XPropertySet,
XFastPropertySet, XMultiPropertySet {
+ private final PropertySetAdapter impl;
+
+ protected PropertySet(Object lock) {
+ impl = new PropertySetAdapter(lock, this);
+ }
+
+ @Override
+ protected void postDisposing() {
+ impl.dispose();
+ }
+
+ public void registerProperty(String propertyName, int handle, Type type,
short attributes, PropertyGetter getter, PropertySetter setter) {
+ impl.registerProperty(propertyName, handle, type, attributes, getter,
setter);
+ }
+
+ public void registerProperty(String propertyName, Type type, short
attributes, PropertyGetter getter, PropertySetter setter) {
+ impl.registerProperty(propertyName, type, attributes, getter, setter);
+ }
+
+ public void addPropertyChangeListener(String propertyName,
XPropertyChangeListener listener) throws UnknownPropertyException,
WrappedTargetException {
+ // only add listeners if you are not disposed
+ if (!bInDispose && !bDisposed) {
+ impl.addPropertyChangeListener(propertyName, listener);
+ }
+ }
+
+ public void addVetoableChangeListener(String propertyName,
XVetoableChangeListener listener) throws UnknownPropertyException,
WrappedTargetException {
+ // only add listeners if you are not disposed
+ if (!bInDispose && !bDisposed) {
+ impl.addVetoableChangeListener(propertyName, listener);
+ }
+ }
+
+ public void addPropertiesChangeListener(String[] propertyNames,
XPropertiesChangeListener listener) {
+ // only add listeners if you are not disposed
+ if (!bInDispose && !bDisposed) {
+ impl.addPropertiesChangeListener(propertyNames, listener);
+ }
+ }
+
+ public XPropertySetInfo getPropertySetInfo() {
+ return impl.getPropertySetInfo();
+ }
+
+ public Object getPropertyValue(String propertyName) throws
UnknownPropertyException, WrappedTargetException {
+ if (bInDispose || bDisposed) {
+ throw new DisposedException("Component is already disposed");
+ }
+ return impl.getPropertyValue(propertyName);
+ }
+
+ @Override
+ public Object getFastPropertyValue(int handle) throws
UnknownPropertyException, WrappedTargetException {
+ if (bInDispose || bDisposed) {
+ throw new DisposedException("Component is already disposed");
+ }
+ return impl.getFastPropertyValue(handle);
+ }
+
+ public Object[] getPropertyValues(String[] propertyNames) {
+ if (bInDispose || bDisposed) {
+ throw new DisposedException("Component is already disposed");
+ }
+ return impl.getPropertyValues(propertyNames);
+ }
+
+ public void removePropertyChangeListener(String propertyName,
XPropertyChangeListener listener) throws UnknownPropertyException,
WrappedTargetException {
+ // all listeners are automatically released in a dispose call
+ if (!bInDispose && !bDisposed) {
+ impl.removePropertyChangeListener(propertyName, listener);
+ }
+ }
+
+ public void removeVetoableChangeListener(String propertyName,
XVetoableChangeListener listener) throws UnknownPropertyException,
WrappedTargetException {
+ // all listeners are automatically released in a dispose call
+ if (!bInDispose && !bDisposed) {
+ impl.removeVetoableChangeListener(propertyName, listener);
+ }
+ }
+
+ public void removePropertiesChangeListener(XPropertiesChangeListener
listener) {
+ // all listeners are automatically released in a dispose call
+ if (!bInDispose && !bDisposed) {
+ impl.removePropertiesChangeListener(listener);
+ }
+ }
+
+ public void setPropertyValue(String propertyName, Object value)
+ throws UnknownPropertyException, PropertyVetoException,
IllegalArgumentException, WrappedTargetException {
+ if (bInDispose || bDisposed) {
+ throw new DisposedException("Component is already disposed");
+ }
+ impl.setPropertyValue(propertyName, value);
+ }
+
+ public void setFastPropertyValue(int handle, Object value)
+ throws UnknownPropertyException, PropertyVetoException,
IllegalArgumentException, WrappedTargetException {
+ if (bInDispose || bDisposed) {
+ throw new DisposedException("Component is already disposed");
+ }
+ impl.setFastPropertyValue(handle, value);
+ }
+
+ public void setPropertyValues(String[] propertyNames, Object[] values)
throws PropertyVetoException, IllegalArgumentException, WrappedTargetException {
+ if (bInDispose || bDisposed) {
+ throw new DisposedException("Component is already disposed");
+ }
+ impl.setPropertyValues(propertyNames, values);
+ }
+
+ public void firePropertiesChangeEvent(String[] propertyNames,
XPropertiesChangeListener listener) {
+ if (bInDispose || bDisposed) {
+ throw new DisposedException("Component is already disposed");
+ }
+ impl.firePropertiesChangeEvent(propertyNames, listener);
+ }
+
+
+}
Propchange:
openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/comphelper/PropertySet.java
------------------------------------------------------------------------------
svn:eol-style = native