You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ad...@apache.org on 2007/05/11 23:36:57 UTC
svn commit: r537297 [3/10] - in /incubator/tuscany/cpp/das:
VSExpress/tuscany_das/ VSExpress/tuscany_das/das_lite/
VSExpress/tuscany_das/das_runtime/ das_java_classes/
das_java_classes/config/ runtime/core/include/ runtime/core/include/apache/
runtime/...
Added: incubator/tuscany/cpp/das/das_java_classes/ConfigImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/das_java_classes/ConfigImpl.cpp?view=auto&rev=537297
==============================================================================
--- incubator/tuscany/cpp/das/das_java_classes/ConfigImpl.cpp (added)
+++ incubator/tuscany/cpp/das/das_java_classes/ConfigImpl.cpp Fri May 11 14:36:45 2007
@@ -0,0 +1,266 @@
+/*
+ * 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.
+ */
+#include "ConfigImpl.h"
+
+ConfigImpl::ConfigImpl(void) {
+ initializeaVariables();
+}
+
+ConfigImpl::~ConfigImpl(void) {
+}
+
+void ConfigImpl::initializeaVariables(void) {
+ command = NULL;
+ table = NULL;
+ relationship = NULL;
+ connectionInfo = NULL;
+ uri = URI_DEFAULT_;
+ dataObjectModel = DATA_OBJECT_MODEL_DEFAULT_;
+
+}
+
+Type* ConfigImpl::getType(void) {
+ return ((ConfigFactoryImpl*) ConfigFactory::INSTANCE)->getConfig();
+}
+
+list<Command*>* ConfigImpl::getCommand(void) {
+
+ if (command == NULL) {
+ //command = createPropertyList(ListKind.CONTAINMENT, Command.class, COMMAND);
+ }
+
+ return command;
+
+}
+
+list<Table*>* ConfigImpl::getTable(void) {
+
+ if (table == NULL) {
+ //table = createPropertyList(ListKind.CONTAINMENT, Table.class, TABLE);
+ }
+
+ return table;
+
+}
+
+list<Relationship*>* ConfigImpl::getRelationship(void) {
+
+ if (relationship == NULL) {
+ //relationship = createPropertyList(ListKind.CONTAINMENT, Relationship.class, RELATIONSHIP);
+ }
+
+ return relationship;
+
+}
+
+ConnectionInfo* ConfigImpl::getConnectionInfo(void) {
+ return connectionInfo;
+}
+
+//ChangeContext& ConfigImpl::basicSetConnectionInfo(ConnectionInfo& newConnectionInfo, ChangeContext& changeContext) {
+// ConnectionInfo oldConnectionInfo = connectionInfo;
+// connectionInfo = newConnectionInfo;
+// return changeContext;
+//
+//}
+
+void ConfigImpl::setConnectionInfo(ConnectionInfo* newConnectionInfo) {
+
+ if (newConnectionInfo != connectionInfo) {
+ /*ChangeContext changeContext = NULL;
+
+ if (connectionInfo != NULL) {
+ changeContext = inverseRemove(connectionInfo, *this, OPPOSITE_FEATURE_BASE - CONNECTION_INFO, NULL, changeContext);
+ }
+
+ if (newConnectionInfo != NULL) {
+ changeContext = inverseAdd(newConnectionInfo, *this, OPPOSITE_FEATURE_BASE - CONNECTION_INFO, NULL, changeContext);
+ }
+
+ changeContext = basicSetConnectionInfo(newConnectionInfo, changeContext);
+ if (changeContext != NULL) {
+ dispatch(changeContext);
+ }*/
+
+ }
+
+}
+
+string ConfigImpl::getUri(void) {
+ return uri;
+}
+
+void ConfigImpl::setUri(string newUri) {
+ uri = newUri;
+}
+
+string ConfigImpl::getDataObjectModel(void) {
+ return dataObjectModel;
+}
+
+void ConfigImpl::setDataObjectModel(string newDataObjectModel) {
+ dataObjectModel = newDataObjectModel;
+}
+
+//ChangeContext& ConfigImpl::inverseRemove(DASObject& otherEnd, int propertyIndex, ChangeContext& changeContext) {
+//
+// switch (propertyIndex) {
+//
+// case COMMAND:
+// return removeFromList(getCommand(), otherEnd, changeContext);
+//
+// case TABLE:
+// return removeFromList(getTable(), otherEnd, changeContext);
+//
+// case RELATIONSHIP:
+// return removeFromList(getRelationship(), otherEnd, changeContext);
+//
+// case CONNECTION_INFO:
+// return basicSetConnectionInfo(null, changeContext);
+//
+// }
+//
+// return DataObjectBase::inverseRemove(otherEnd, propertyIndex, changeContext);
+//
+//}
+
+DASObject* ConfigImpl::get(int propertyIndex, bool resolve) {
+ /*switch (propertyIndex) {
+
+ case COMMAND:
+ return getCommand();
+
+ case TABLE:
+ return getTable();
+
+ case RELATIONSHIP:
+ return getRelationship();
+
+ case CONNECTION_INFO:
+ return getConnectionInfo();
+
+ case URI:
+ return getUri();
+
+ case DATA_OBJECT_MODEL:
+ return getDataObjectModel();
+
+ }
+
+ return DataObjectBase::get(propertyIndex, resolve);*/
+
+}
+
+void ConfigImpl::set(int propertyIndex, DASObject* newValue) {
+ /*switch (propertyIndex) {
+
+ case COMMAND:
+ getCommand().clear();
+ getCommand().addAll((Collection) newValue);
+ return;
+
+ case TABLE:
+ getTable().clear();
+ getTable().addAll((Collection)newValue);
+ return;
+
+ case RELATIONSHIP:
+ getRelationship().clear();
+ getRelationship().addAll((Collection)newValue);
+ return;
+
+ case CONNECTION_INFO:
+ setConnectionInfo((ConnectionInfo)newValue);
+ return;
+
+ case URI:
+ setUri((String)newValue);
+ return;
+
+ case DATA_OBJECT_MODEL:
+ setDataObjectModel((String)newValue);
+ return;
+
+ }
+
+ DataObjectBase::set(propertyIndex, newValue);*/
+
+}
+
+void ConfigImpl::unset(int propertyIndex) {
+ /*switch (propertyIndex) {
+
+ case COMMAND:
+ getCommand()->clear();
+ return;
+
+ case TABLE:
+ getTable()->clear();
+ return;
+
+ case RELATIONSHIP:
+ getRelationship()->clear();
+ return;
+
+ case CONNECTION_INFO:
+ setConnectionInfo(NULL);
+ return;
+
+ case URI:
+ setUri(URI_DEFAULT_);
+ return;
+
+ case DATA_OBJECT_MODEL:
+ setDataObjectModel(DATA_OBJECT_MODEL_DEFAULT_);
+ return;
+
+ }
+
+ DataObjectBase::unset(propertyIndex);*/
+
+}
+
+bool ConfigImpl::isSet(int propertyIndex) {
+ /*switch (propertyIndex) {
+
+ case COMMAND:
+ return command != NULL && !(command->size() == 0);
+
+ case TABLE:
+ return table != NULL && !(table->size() == 0);
+
+ case RELATIONSHIP:
+ return relationship != NULL && !(relationship->size() == 0);
+
+ case CONNECTION_INFO:
+ return connectionInfo != NULL;
+
+ case URI:
+ return URI_DEFAULT_ == "" ? uri != "" : URI_DEFAULT_ != uri;
+
+ case DATA_OBJECT_MODEL:
+ return DATA_OBJECT_MODEL_DEFAULT_ == "" ? dataObjectModel != "" : DATA_OBJECT_MODEL_DEFAULT_ != dataObjectModel;
+
+ }
+
+ return DataObjectBase::isSet(propertyIndex);*/
+
+}
+
+//string ConfigImpl::toString(void) {}
Added: incubator/tuscany/cpp/das/das_java_classes/ConfigImpl.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/das_java_classes/ConfigImpl.h?view=auto&rev=537297
==============================================================================
--- incubator/tuscany/cpp/das/das_java_classes/ConfigImpl.h (added)
+++ incubator/tuscany/cpp/das/das_java_classes/ConfigImpl.h Fri May 11 14:36:45 2007
@@ -0,0 +1,86 @@
+/*
+ * 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.
+ */
+#ifndef CONFIG_IMPL_H
+#define CONFIG_IMPL_H
+
+#include <string>
+#include <list>
+
+#include "Config.h"
+#include "Command.h"
+#include "Table.h"
+#include "Relationship.h"
+#include "ConnectionInfo.h"
+#include "DASObject.h"
+#include "ConfigFactory.h"
+#include "ConfigFactoryImpl.h"
+
+#include "commonj/sdo/Type.h"
+
+using namespace commonj::sdo;
+using namespace std;
+
+class ConfigImpl : /*public DataObjectBase,*/ public Config {
+
+ protected:
+ const static string URI_DEFAULT_;
+ const static string DATA_OBJECT_MODEL_DEFAULT_;
+
+ list<Command*>* command;
+ list<Table*>* table;
+ list<Relationship*>* relationship;
+ ConnectionInfo* connectionInfo;
+ string uri;
+ string dataObjectModel;
+
+ void initializeaVariables(void);
+
+ public:
+ const static int COMMAND = 0;
+ const static int TABLE = 1;
+ const static int RELATIONSHIP = 2;
+ const static int CONNECTION_INFO = 3;
+ const static int URI = 4;
+ const static int DATA_OBJECT_MODEL = 5;
+ const static int SDO_PROPERTY_COUNT = 6;
+
+ ConfigImpl(void);
+ virtual ~ConfigImpl(void);
+ Type* getType(void);
+ list<Command*>* getCommand(void);
+ list<Table*>* getTable(void);
+ list<Relationship*>* getRelationship(void);
+ ConnectionInfo* getConnectionInfo(void);
+ //ChangeContext* basicSetConnectionInfo(ConnectionInfo* newConnectionInfo, ChangeContext* changeContext);
+ void setConnectionInfo(ConnectionInfo* newConnectionInfo);
+ string getUri(void);
+ void setUri(string newUri);
+ string getDataObjectModel(void);
+ void setDataObjectModel(string newDataObjectModel);
+ //ChangeContext* inverseRemove(DASObject* otherEnd, int propertyIndex, ChangeContext* changeContext);
+ DASObject* get(int propertyIndex, bool resolve);
+ void set(int propertyIndex, DASObject* newValue);
+ void unset(int propertyIndex);
+ bool isSet(int propertyIndex);
+ //string toString(void);
+
+};
+
+
+#endif //CONFIG_IMPL_H
Added: incubator/tuscany/cpp/das/das_java_classes/ConnectionImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/das_java_classes/ConnectionImpl.cpp?view=auto&rev=537297
==============================================================================
--- incubator/tuscany/cpp/das/das_java_classes/ConnectionImpl.cpp (added)
+++ incubator/tuscany/cpp/das/das_java_classes/ConnectionImpl.cpp Fri May 11 14:36:45 2007
@@ -0,0 +1,138 @@
+/*
+ * 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.
+ */
+#include "ConnectionImpl.h"
+
+ConnectionImpl::ConnectionImpl(HENV* aEnvironment, HDBC* aConnection) {
+ managingTransaction = true;
+
+ connection = aConnection;
+ environment = aEnvironment;
+
+ //try {
+ SQLCHAR sqlDbmsName[255];
+ SQLSMALLINT strLen;
+ SQLINTEGER strLen2;
+ SQLGetInfo(connection, SQL_DBMS_NAME, sqlDbmsName, sizeof(sqlDbmsName), &strLen);
+ string dbmsName = (char*) sqlDbmsName;
+
+ if (dbmsName.find("Oracle") < 0) {
+ boolUseGetGeneratedKeys = false;
+ } else {
+ boolUseGetGeneratedKeys = true;
+ }
+
+ SQLSMALLINT autoCommit;
+ if (SQLGetConnectAttr(connection, SQL_ATTR_AUTOCOMMIT, &autoCommit, sizeof(autoCommit), &strLen2) == SQL_AUTOCOMMIT_ON) {
+ //throw new RuntimeException("AutoCommit must be off");
+ }
+
+// } catch (SQLException e) {
+ // throw new RuntimeException(e);
+ //}
+
+}
+
+ConnectionImpl::~ConnectionImpl(void) {
+}
+
+HDBC* ConnectionImpl::getODBCConnection(void) {
+ return connection;
+}
+
+void ConnectionImpl::cleanUp(void) {
+
+ if (managingTransaction) {
+
+ /*if (this.logger.isDebugEnabled()) {
+ this.logger.debug("Committing Transaction");
+ }*/
+
+ SQLEndTran(SQL_HANDLE_DBC, connection, SQL_COMMIT);
+
+ }
+
+}
+
+void ConnectionImpl::errorCleanUp(void) {
+
+ if (managingTransaction) {
+
+ /*if (this.logger.isDebugEnabled()) {
+ this.logger.debug("Rolling back Transaction");
+ }*/
+
+ SQLTransact(environment, connection, SQL_ROLLBACK);
+
+ }
+
+}
+
+HSTMT* ConnectionImpl::prepareStatement(string queryString, string* returnKeys, int keysCount) {
+
+ /*if (this.logger.isDebugEnabled()) {
+ this.logger.debug("Preparing Statement: " + queryString);
+ }*/
+ HSTMT statement;
+ SQLAllocStmt( connection, &statement);
+
+ if (boolUseGetGeneratedKeys) {
+ SQLPrepare(statement, (SQLCHAR*) queryString.c_str(), SQL_NTS);
+ } else if (keysCount > 0) {
+ SQLPrepare(statement, (SQLCHAR*) queryString.c_str(), SQL_NTS);
+ } else {
+ SQLPrepare(statement, (SQLCHAR*) queryString.c_str(), SQL_NTS);
+ }
+
+ return &statement;
+
+}
+
+HSTMT* ConnectionImpl::preparePagedStatement(string queryString) {
+
+ /*if (this.logger.isDebugEnabled()) {
+ this.logger.debug("Preparing Statement: " + queryString);
+ }*/
+
+ HSTMT statement;
+ SQLAllocStmt( connection, &statement);
+
+ SQLSetStmtAttr(connection, SQL_ATTR_CONCURRENCY, (SQLPOINTER) SQL_CONCUR_READ_ONLY, NULL);
+ SQLSetStmtAttr(connection, SQL_ATTR_CURSOR_SENSITIVITY, (SQLPOINTER) SQL_INSENSITIVE, NULL);
+ SQLPrepare(statement, (SQLCHAR*) queryString.c_str(), SQL_NTS);
+
+ return &statement;
+
+}
+
+void ConnectionImpl::setManageTransactions(int aManageTransactions) {
+ managingTransaction = aManageTransactions;
+}
+
+HSTMT* ConnectionImpl::prepareCall(string queryString) {
+ HSTMT statement;
+ SQLAllocStmt( connection, &statement);
+ SQLPrepare(statement, (SQLCHAR*) queryString.c_str(), SQL_NTS);
+
+ return &statement;
+
+}
+
+bool ConnectionImpl::useGetGeneratedKeys(void) {
+ return boolUseGetGeneratedKeys;
+}
Added: incubator/tuscany/cpp/das/das_java_classes/ConnectionImpl.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/das_java_classes/ConnectionImpl.h?view=auto&rev=537297
==============================================================================
--- incubator/tuscany/cpp/das/das_java_classes/ConnectionImpl.h (added)
+++ incubator/tuscany/cpp/das/das_java_classes/ConnectionImpl.h Fri May 11 14:36:45 2007
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ */
+#ifndef CONNECTION_IMPL_H
+#define CONNECTION_IMPL_H
+
+#include <windows.h>
+#include <sql.h>
+#include <sqlext.h>
+#include <string>
+
+#include "CallableStatement.h"
+#include "PreparedStatement.h"
+
+using namespace std;
+
+class ConnectionImpl {
+
+ private:
+ HDBC* connection;
+ HENV* environment;
+ bool managingTransaction;
+ bool boolUseGetGeneratedKeys;
+
+ public:
+ ConnectionImpl(HENV* aEnvironment, HDBC* aConnection);
+ virtual ~ConnectionImpl(void);
+ HDBC* getODBCConnection(void);
+ void cleanUp(void);
+ void errorCleanUp(void);
+ HSTMT* prepareStatement(string queryString, string* returnKeys, int keysCount);
+ HSTMT* preparePagedStatement(string queryString);
+ void setManageTransactions(int aManageTransactions);
+ HSTMT* prepareCall(string queryString);
+ bool useGetGeneratedKeys(void);
+
+};
+
+#endif //CONNECTION_IMPL_H
Added: incubator/tuscany/cpp/das/das_java_classes/ConnectionInfo.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/das_java_classes/ConnectionInfo.h?view=auto&rev=537297
==============================================================================
--- incubator/tuscany/cpp/das/das_java_classes/ConnectionInfo.h (added)
+++ incubator/tuscany/cpp/das/das_java_classes/ConnectionInfo.h Fri May 11 14:36:45 2007
@@ -0,0 +1,79 @@
+/*
+ * 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.
+ */
+#ifndef CONNECTION_INFO_H
+#define CONNECTION_INFO_H
+
+#include "Table.h"
+
+virtual class ConnectionInfo {
+
+ public:
+ /**
+ * Returns the value of the '<em><b>Data Source</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Data Source</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Data Source</em>' attribute.
+ * @see #setDataSource(String)
+ * @generated
+ */
+ string getDataSource(void);
+
+ /**
+ * Sets the value of the '{@link org.apache.tuscany.das.rdb.config.ConnectionInfo#getDataSource <em>Data Source</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Data Source</em>' attribute.
+ * @see #getDataSource()
+ * @generated
+ */
+ void setDataSource(string value);
+
+ /**
+ * Returns the value of the '<em><b>Managedtx</b></em>' attribute.
+ * The default value is <code>"true"</code>.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Managedtx</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Managedtx</em>' attribute.
+ * @see #setManagedtx(boolean)
+ * @generated
+ */
+ bool isManagedtx(void);
+
+ /**
+ * Sets the value of the '{@link org.apache.tuscany.das.rdb.config.ConnectionInfo#isManagedtx <em>Managedtx</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Managedtx</em>' attribute.
+ * @see #isManagedtx()
+ * @generated
+ */
+ void setManagedtx(bool value);
+
+}; // ConnectionInfo
+
+
+#endif //CONNECTION_INFO_H
\ No newline at end of file
Added: incubator/tuscany/cpp/das/das_java_classes/ConnectionInfoImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/das_java_classes/ConnectionInfoImpl.cpp?view=auto&rev=537297
==============================================================================
--- incubator/tuscany/cpp/das/das_java_classes/ConnectionInfoImpl.cpp (added)
+++ incubator/tuscany/cpp/das/das_java_classes/ConnectionInfoImpl.cpp Fri May 11 14:36:45 2007
@@ -0,0 +1,196 @@
+/*
+ * 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.
+ */
+#include "ConnectionInfoImpl.h"
+
+ConnectionInfoImpl::ConnectionInfoImpl(void) {
+ dataSource = DATA_SOURCE_DEFAULT_;
+ managedtx = MANAGEDTX_DEFAULT_;
+
+}
+
+ConnectionInfoImpl::~ConnectionInfoImpl(void) {
+}
+
+Type* ConnectionInfoImpl::getType(void) {
+ return ((ConfigFactoryImpl*) ConfigFactory::INSTANCE)->getConnectionInfo();
+}
+
+string ConnectionInfoImpl::getDataSource(void) {
+ return dataSource;
+}
+
+void ConnectionInfoImpl::setDataSource(string newDataSource) {
+ dataSource = newDataSource;
+}
+
+bool ConnectionInfoImpl::isManagedtx(void) {
+ return managedtx;
+}
+
+void ConnectionInfoImpl::setManagedtx(bool newManagedtx) {
+ managedtx = newManagedtx;
+}
+
+DASObject* ConnectionInfoImpl::get(int propertyIndex, bool resolve) {
+ /*switch (propertyIndex)
+ {
+ case DATA_SOURCE:
+ return getDataSource();
+ case MANAGEDTX:
+ return isManagedtx() ? Boolean.TRUE : Boolean.FALSE;
+ }
+ return super.get(propertyIndex, resolve);*/
+}
+
+void ConnectionInfoImpl::set(int propertyIndex, DASObject* newValue) {
+ /*switch (propertyIndex)
+ {
+ case DATA_SOURCE:
+ setDataSource((String)newValue);
+ return;
+ case MANAGEDTX:
+ setManagedtx(((Boolean)newValue).booleanValue());
+ return;
+ }
+ super.set(propertyIndex, newValue);*/
+}
+
+void ConnectionInfoImpl::unset(int propertyIndex) {
+ /*switch (propertyIndex)
+ {
+ case DATA_SOURCE:
+ setDataSource(DATA_SOURCE_DEFAULT_);
+ return;
+ case MANAGEDTX:
+ setManagedtx(MANAGEDTX_DEFAULT_);
+ return;
+ }
+ super.unset(propertyIndex);*/
+}
+
+bool ConnectionInfoImpl::isSet(int propertyIndex) {
+ /*switch (propertyIndex)
+ {
+ case DATA_SOURCE:
+ return DATA_SOURCE_DEFAULT_ == null ? dataSource != null : !DATA_SOURCE_DEFAULT_.equals(dataSource);
+ case MANAGEDTX:
+ return managedtx != MANAGEDTX_DEFAULT_;
+ }
+ return super.isSet(propertyIndex);*/
+}
+
+//string ConnectionInfoImpl::toString(void) {}
+/*
+ * 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.
+ */
+#include "ConnectionInfoImpl.h"
+
+ConnectionInfoImpl::ConnectionInfoImpl(void) {
+ dataSource = DATA_SOURCE_DEFAULT_;
+ managedtx = MANAGEDTX_DEFAULT_;
+
+}
+
+ConnectionInfoImpl::~ConnectionInfoImpl(void) {
+}
+
+Type* ConnectionInfoImpl::getType(void) {
+ return ((ConfigFactoryImpl*) ConfigFactory::INSTANCE)->getConnectionInfo();
+}
+
+string ConnectionInfoImpl::getDataSource(void) {
+ return dataSource;
+}
+
+void ConnectionInfoImpl::setDataSource(string newDataSource) {
+ dataSource = newDataSource;
+}
+
+bool ConnectionInfoImpl::isManagedtx(void) {
+ return managedtx;
+}
+
+void ConnectionInfoImpl::setManagedtx(bool newManagedtx) {
+ managedtx = newManagedtx;
+}
+
+DASObject* ConnectionInfoImpl::get(int propertyIndex, bool resolve) {
+ /*switch (propertyIndex)
+ {
+ case DATA_SOURCE:
+ return getDataSource();
+ case MANAGEDTX:
+ return isManagedtx() ? Boolean.TRUE : Boolean.FALSE;
+ }
+ return super.get(propertyIndex, resolve);*/
+}
+
+void ConnectionInfoImpl::set(int propertyIndex, DASObject* newValue) {
+ /*switch (propertyIndex)
+ {
+ case DATA_SOURCE:
+ setDataSource((String)newValue);
+ return;
+ case MANAGEDTX:
+ setManagedtx(((Boolean)newValue).booleanValue());
+ return;
+ }
+ super.set(propertyIndex, newValue);*/
+}
+
+void ConnectionInfoImpl::unset(int propertyIndex) {
+ /*switch (propertyIndex)
+ {
+ case DATA_SOURCE:
+ setDataSource(DATA_SOURCE_DEFAULT_);
+ return;
+ case MANAGEDTX:
+ setManagedtx(MANAGEDTX_DEFAULT_);
+ return;
+ }
+ super.unset(propertyIndex);*/
+}
+
+bool ConnectionInfoImpl::isSet(int propertyIndex) {
+ /*switch (propertyIndex)
+ {
+ case DATA_SOURCE:
+ return DATA_SOURCE_DEFAULT_ == null ? dataSource != null : !DATA_SOURCE_DEFAULT_.equals(dataSource);
+ case MANAGEDTX:
+ return managedtx != MANAGEDTX_DEFAULT_;
+ }
+ return super.isSet(propertyIndex);*/
+}
+
+//string ConnectionInfoImpl::toString(void) {}
Added: incubator/tuscany/cpp/das/das_java_classes/ConnectionInfoImpl.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/das_java_classes/ConnectionInfoImpl.h?view=auto&rev=537297
==============================================================================
--- incubator/tuscany/cpp/das/das_java_classes/ConnectionInfoImpl.h (added)
+++ incubator/tuscany/cpp/das/das_java_classes/ConnectionInfoImpl.h Fri May 11 14:36:45 2007
@@ -0,0 +1,126 @@
+/*
+ * 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.
+ */
+#ifndef CONNECTION_INFO_IMPL_H
+#define CONNECTION_INFO_IMPL_H
+
+#include <string>;
+
+#include "ConnectionInfo.h"
+#include "DASObject.h"
+#include "ConfigFactory.h"
+#include "ConfigFactoryImpl.h"
+
+#include "commonj/sdo/Type.h"
+
+using namespace commonj::sdo;
+using namespace std;
+
+class ConnectionInfoImpl : /*public DataObjectBase,*/ public ConnectionInfo {
+
+ protected:
+ const static string DATA_SOURCE_DEFAULT_;
+ const static bool MANAGEDTX_DEFAULT_ = true;
+
+ bool managedtx;
+ string dataSource;
+
+ public:
+ const static int DATA_SOURCE = 0;
+ const static int MANAGEDTX = 1;
+ const static int SDO_PROPERTY_COUNT = 2;
+
+ ConnectionInfoImpl(void);
+ virtual ~ConnectionInfoImpl(void);
+ Type* getType(void);
+ string getDataSource(void);
+ void setDataSource(string newDataSource);
+ bool isManagedtx(void);
+ void setManagedtx(bool newManagedtx);
+ DASObject* get(int propertyIndex, bool resolve);
+ void set(int propertyIndex, DASObject* newValue);
+ void unset(int propertyIndex);
+ bool isSet(int propertyIndex);
+ //string toString(void);
+
+};
+
+#endif //CONNECTION_INFO_IMPL_H
+/*
+ * 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.
+ */
+#ifndef CONNECTION_INFO_IMPL_H
+#define CONNECTION_INFO_IMPL_H
+
+#include <string>;
+
+#include "ConnectionInfo.h"
+#include "DASObject.h"
+#include "ConfigFactory.h"
+#include "ConfigFactoryImpl.h"
+
+#include "commonj/sdo/Type.h"
+
+using namespace commonj::sdo;
+using namespace std;
+
+class ConnectionInfoImpl : /*public DataObjectBase,*/ public ConnectionInfo {
+
+ protected:
+ const static string DATA_SOURCE_DEFAULT_;
+ const static bool MANAGEDTX_DEFAULT_ = true;
+
+ bool managedtx;
+ string dataSource;
+
+ public:
+ const static int DATA_SOURCE = 0;
+ const static int MANAGEDTX = 1;
+ const static int SDO_PROPERTY_COUNT = 2;
+
+ ConnectionInfoImpl(void);
+ virtual ~ConnectionInfoImpl(void);
+ Type* getType(void);
+ string getDataSource(void);
+ void setDataSource(string newDataSource);
+ bool isManagedtx(void);
+ void setManagedtx(bool newManagedtx);
+ DASObject* get(int propertyIndex, bool resolve);
+ void set(int propertyIndex, DASObject* newValue);
+ void unset(int propertyIndex);
+ bool isSet(int propertyIndex);
+ //string toString(void);
+
+};
+
+#endif //CONNECTION_INFO_IMPL_H
Added: incubator/tuscany/cpp/das/das_java_classes/Converter.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/das_java_classes/Converter.h?view=auto&rev=537297
==============================================================================
--- incubator/tuscany/cpp/das/das_java_classes/Converter.h (added)
+++ incubator/tuscany/cpp/das/das_java_classes/Converter.h Fri May 11 14:36:45 2007
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+#ifndef CONVERTER_H
+#define CONVERTER_H
+
+#include "DASObject.h"
+
+virtual class Converter {
+
+ public:
+ DASObject* getPropertyValue(DASObject* columnData);
+ DASObject* getColumnValue(DASObject* propertyData);
+
+};
+
+#endif //CONVERTER_H
\ No newline at end of file
Added: incubator/tuscany/cpp/das/das_java_classes/Create.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/das_java_classes/Create.h?view=auto&rev=537297
==============================================================================
--- incubator/tuscany/cpp/das/das_java_classes/Create.h (added)
+++ incubator/tuscany/cpp/das/das_java_classes/Create.h Fri May 11 14:36:45 2007
@@ -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.
+ */
+#ifndef CREATE_H
+#define CREATE_H
+
+virtual class Create {
+ /**
+ * Returns the value of the '<em><b>Sql</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Sql</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Sql</em>' attribute.
+ * @see #setSql(String)
+ * @generated
+ */
+ string getSql(void);
+
+ /**
+ * Sets the value of the '{@link org.apache.tuscany.das.rdb.config.Create#getSql <em>Sql</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Sql</em>' attribute.
+ * @see #getSql()
+ * @generated
+ */
+ void setSql(string value);
+
+ /**
+ * Returns the value of the '<em><b>Parameters</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Parameters</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Parameters</em>' attribute.
+ * @see #setParameters(String)
+ * @generated
+ */
+ string getParameters(void);
+
+ /**
+ * Sets the value of the '{@link org.apache.tuscany.das.rdb.config.Create#getParameters <em>Parameters</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Parameters</em>' attribute.
+ * @see #getParameters()
+ * @generated
+ */
+ void setParameters(string value);
+
+}; // Create
+
+
+#endif //CREATE_H
\ No newline at end of file
Added: incubator/tuscany/cpp/das/das_java_classes/CreateImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/das_java_classes/CreateImpl.cpp?view=auto&rev=537297
==============================================================================
--- incubator/tuscany/cpp/das/das_java_classes/CreateImpl.cpp (added)
+++ incubator/tuscany/cpp/das/das_java_classes/CreateImpl.cpp Fri May 11 14:36:45 2007
@@ -0,0 +1,198 @@
+/*
+ * 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.
+ */
+#include "CreateImpl.h"
+
+CreateImpl::CreateImpl(void) {
+ sql = SQL_DEFAULT_;
+ parameters = PARAMETERS_DEFAULT_;
+
+}
+
+CreateImpl::~CreateImpl(void) {
+}
+
+Type* CreateImpl::getType(void) {
+ return ((ConfigFactoryImpl*) ConfigFactory::INSTANCE)->getCreate();
+}
+
+string CreateImpl::getSql(void) {
+ return sql;
+}
+
+void CreateImpl::setSql(string newSql) {
+ sql = newSql;
+}
+
+string CreateImpl::getParameters(void) {
+ return parameters;
+}
+
+void CreateImpl::setParameters(string newParameters) {
+ parameters = newParameters;
+}
+
+DASObject* CreateImpl::get(int propertyIndex, bool resolve) {
+ /*switch (propertyIndex)
+ {
+ case SQL:
+ return getSql();
+ case PARAMETERS:
+ return getParameters();
+ }
+ return super.get(propertyIndex, resolve);*/
+}
+
+
+void CreateImpl::set(int propertyIndex, DASObject* newValue) {
+ /*switch (propertyIndex)
+ {
+ case SQL:
+ setSql((String)newValue);
+ return;
+ case PARAMETERS:
+ setParameters((String)newValue);
+ return;
+ }
+ super.set(propertyIndex, newValue);*/
+}
+
+void CreateImpl::unset(int propertyIndex) {
+ /*switch (propertyIndex)
+ {
+ case SQL:
+ setSql(SQL_DEFAULT_);
+ return;
+ case PARAMETERS:
+ setParameters(PARAMETERS_DEFAULT_);
+ return;
+ }
+ super.unset(propertyIndex);*/
+}
+
+bool CreateImpl::isSet(int propertyIndex) {
+ /*switch (propertyIndex)
+ {
+ case SQL:
+ return SQL_DEFAULT_ == null ? sql != null : !SQL_DEFAULT_.equals(sql);
+ case PARAMETERS:
+ return PARAMETERS_DEFAULT_ == null ? parameters != null : !PARAMETERS_DEFAULT_.equals(parameters);
+ }
+ return super.isSet(propertyIndex);*/
+}
+
+//string CreateImpl::toString(void) {}
+/*
+ * 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.
+ */
+#include "CreateImpl.h"
+
+CreateImpl::CreateImpl(void) {
+ sql = SQL_DEFAULT_;
+ parameters = PARAMETERS_DEFAULT_;
+
+}
+
+CreateImpl::~CreateImpl(void) {
+}
+
+Type* CreateImpl::getType(void) {
+ return ((ConfigFactoryImpl*) ConfigFactory::INSTANCE)->getCreate();
+}
+
+string CreateImpl::getSql(void) {
+ return sql;
+}
+
+void CreateImpl::setSql(string newSql) {
+ sql = newSql;
+}
+
+string CreateImpl::getParameters(void) {
+ return parameters;
+}
+
+void CreateImpl::setParameters(string newParameters) {
+ parameters = newParameters;
+}
+
+DASObject* CreateImpl::get(int propertyIndex, bool resolve) {
+ /*switch (propertyIndex)
+ {
+ case SQL:
+ return getSql();
+ case PARAMETERS:
+ return getParameters();
+ }
+ return super.get(propertyIndex, resolve);*/
+}
+
+
+void CreateImpl::set(int propertyIndex, DASObject* newValue) {
+ /*switch (propertyIndex)
+ {
+ case SQL:
+ setSql((String)newValue);
+ return;
+ case PARAMETERS:
+ setParameters((String)newValue);
+ return;
+ }
+ super.set(propertyIndex, newValue);*/
+}
+
+void CreateImpl::unset(int propertyIndex) {
+ /*switch (propertyIndex)
+ {
+ case SQL:
+ setSql(SQL_DEFAULT_);
+ return;
+ case PARAMETERS:
+ setParameters(PARAMETERS_DEFAULT_);
+ return;
+ }
+ super.unset(propertyIndex);*/
+}
+
+bool CreateImpl::isSet(int propertyIndex) {
+ /*switch (propertyIndex)
+ {
+ case SQL:
+ return SQL_DEFAULT_ == null ? sql != null : !SQL_DEFAULT_.equals(sql);
+ case PARAMETERS:
+ return PARAMETERS_DEFAULT_ == null ? parameters != null : !PARAMETERS_DEFAULT_.equals(parameters);
+ }
+ return super.isSet(propertyIndex);*/
+}
+
+//string CreateImpl::toString(void) {}
Added: incubator/tuscany/cpp/das/das_java_classes/CreateImpl.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/das_java_classes/CreateImpl.h?view=auto&rev=537297
==============================================================================
--- incubator/tuscany/cpp/das/das_java_classes/CreateImpl.h (added)
+++ incubator/tuscany/cpp/das/das_java_classes/CreateImpl.h Fri May 11 14:36:45 2007
@@ -0,0 +1,124 @@
+/*
+ * 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.
+ */
+#ifndef CREATE_IMPL_H
+#define CREATE_IMPL_H
+
+#include <string>;
+
+#include "DASObject.h"
+#include "ConfigFactory.h"
+#include "ConfigFactoryImpl.h"
+
+#include "commonj/sdo/Type.h"
+
+using namespace commonj::sdo;
+using namespace std;
+
+class CreateImpl : /*public DataObjectBase,*/ public Create {
+
+ protected:
+ const static string SQL_DEFAULT_;
+ const static string PARAMETERS_DEFAULT_;
+
+ string sql;
+ string parameters;
+
+ public:
+ const static int SQL = 0;
+ const static int PARAMETERS = 1;
+ const static int SDO_PROPERTY_COUNT = 2;
+
+ CreateImpl(void);
+ virtual ~CreateImpl(void);
+ Type* getType(void);
+ string getSql(void);
+ void setSql(string newSql);
+ string getParameters(void);
+ void setParameters(string newParameters);
+ DASObject* get(int propertyIndex, bool resolve);
+ void set(int propertyIndex, DASObject* newValue);
+ void unset(int propertyIndex);
+ bool isSet(int propertyIndex);
+ string toString(void);
+
+};
+
+#endif //CREATE_IMPL_H
+/*
+ * 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.
+ */
+#ifndef CREATE_IMPL_H
+#define CREATE_IMPL_H
+
+#include <string>;
+
+#include "DASObject.h"
+#include "ConfigFactory.h"
+#include "ConfigFactoryImpl.h"
+
+#include "commonj/sdo/Type.h"
+
+using namespace commonj::sdo;
+using namespace std;
+
+class CreateImpl : /*public DataObjectBase,*/ public Create {
+
+ protected:
+ const static string SQL_DEFAULT_;
+ const static string PARAMETERS_DEFAULT_;
+
+ string sql;
+ string parameters;
+
+ public:
+ const static int SQL = 0;
+ const static int PARAMETERS = 1;
+ const static int SDO_PROPERTY_COUNT = 2;
+
+ CreateImpl(void);
+ virtual ~CreateImpl(void);
+ Type* getType(void);
+ string getSql(void);
+ void setSql(string newSql);
+ string getParameters(void);
+ void setParameters(string newParameters);
+ DASObject* get(int propertyIndex, bool resolve);
+ void set(int propertyIndex, DASObject* newValue);
+ void unset(int propertyIndex);
+ bool isSet(int propertyIndex);
+ string toString(void);
+
+};
+
+#endif //CREATE_IMPL_H
Added: incubator/tuscany/cpp/das/das_java_classes/CreateOperation.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/das_java_classes/CreateOperation.cpp?view=auto&rev=537297
==============================================================================
--- incubator/tuscany/cpp/das/das_java_classes/CreateOperation.cpp (added)
+++ incubator/tuscany/cpp/das/das_java_classes/CreateOperation.cpp Fri May 11 14:36:45 2007
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+#include "CreateOperation.h"
+
+CreateOperation::CreateOperation(InsertCommandImpl* command, DataObject* changedObject, string id) : ChangeOperation(command, changedObject) {
+ propagatedID = id;
+}
+
+CreateOperation::~CreateOperation() {
+}
Added: incubator/tuscany/cpp/das/das_java_classes/CreateOperation.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/das_java_classes/CreateOperation.h?view=auto&rev=537297
==============================================================================
--- incubator/tuscany/cpp/das/das_java_classes/CreateOperation.h (added)
+++ incubator/tuscany/cpp/das/das_java_classes/CreateOperation.h Fri May 11 14:36:45 2007
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+#ifndef CREATE_OPERATION_H
+#define CREATE_OPERATION_H
+
+#include "InsertCommandImpl.h"
+
+#include "commonj/sdo/DataObject.h"
+
+using namespace commonj::sdo;
+
+class CreateOperation : public ChangeOperation {
+
+ public:
+ CreateOperation(InsertCommandImpl* command, DataObject* changedObject, string id);
+ virtual ~CreateOperation(void);
+
+};
+
+#endif //CREATE_OPERATION_H
\ No newline at end of file
Added: incubator/tuscany/cpp/das/das_java_classes/DAS.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/das_java_classes/DAS.cpp?view=auto&rev=537297
==============================================================================
--- incubator/tuscany/cpp/das/das_java_classes/DAS.cpp (added)
+++ incubator/tuscany/cpp/das/das_java_classes/DAS.cpp Fri May 11 14:36:45 2007
@@ -0,0 +1,56 @@
+/*
+ * 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.
+ */
+#include "DAS.h"
+#include "DASFactoryImpl.h"
+
+DASFactory* DAS::FACTORY = new DASFactoryImpl;
+
+DAS::DAS(void) {}
+
+DASFactory* DAS::getFACTORY(void) {
+ return FACTORY;
+}
+/*
+ * 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.
+ */
+#include "DAS.h"
+#include "DASFactoryImpl.h"
+
+DASFactory* DAS::FACTORY = new DASFactoryImpl;
+
+DAS::DAS(void) {}
+
+DASFactory* DAS::getFACTORY(void) {
+ return FACTORY;
+}
Added: incubator/tuscany/cpp/das/das_java_classes/DAS.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/das_java_classes/DAS.h?view=auto&rev=537297
==============================================================================
--- incubator/tuscany/cpp/das/das_java_classes/DAS.h (added)
+++ incubator/tuscany/cpp/das/das_java_classes/DAS.h Fri May 11 14:36:45 2007
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+#ifndef D_A_S_H
+#define D_A_S_H
+
+#include "DASFactory.h"
+#include "Command.h"
+
+#include "commonj/sdo/DataObject.h"
+
+using namespace commonj::sdo;
+
+class DAS {
+
+ private:
+ static DASFactory* FACTORY;
+
+ public:
+ static DASFactory* getFACTORY(void);
+
+ DAS(void);
+ virtual ~DAS(void);
+ virtual void applyChanges(DataObject* root);
+ virtual Command* getCommand(char* name);
+ virtual void releaseResources(void);
+ virtual Command* createCommand(string sql);
+
+};
+
+#endif //D_A_S_H
Added: incubator/tuscany/cpp/das/das_java_classes/DASFactory.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/das_java_classes/DASFactory.h?view=auto&rev=537297
==============================================================================
--- incubator/tuscany/cpp/das/das_java_classes/DASFactory.h (added)
+++ incubator/tuscany/cpp/das/das_java_classes/DASFactory.h Fri May 11 14:36:45 2007
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ */
+#ifndef D_A_S_FACTORY_H
+#define D_A_S_FACTORY_H
+
+#include <windows.h>
+#include <sql.h>
+#include <string>
+
+#include "Config.h"
+#include "DAS.h"
+
+using namespace std;
+
+virtual class DASFactory {
+
+ public:
+ DASFactory(void);
+ virtual ~DASFactory(void);
+ DASFactory* createDAS(string configStream);
+ DASFactory* createDAS(string configStream, HDBC* connection);
+ DASFactory* createDAS(Config* config);
+ DASFactory* createDAS(Config* config, HDBC* connection);
+ DASFactory* createDAS(HDBC* connection);
+
+};
+
+#endif //D_A_S_FACTORY_H
Added: incubator/tuscany/cpp/das/das_java_classes/DASFactoryImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/das_java_classes/DASFactoryImpl.cpp?view=auto&rev=537297
==============================================================================
--- incubator/tuscany/cpp/das/das_java_classes/DASFactoryImpl.cpp (added)
+++ incubator/tuscany/cpp/das/das_java_classes/DASFactoryImpl.cpp Fri May 11 14:36:45 2007
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+#include "DASFactoryImpl.h"
+
+DASFactoryImpl::DASFactoryImpl(void) {}
+
+DASFactoryImpl::~DASFactoryImpl(void) {}
+
+//DAS* DASFactoryImpl::createDAS(InputStream* configStream) {
+// return DASImpl(configStream);
+//}
+
+DAS* DASFactoryImpl::createDAS(Config* config) {
+ return new DASImpl(config);
+}
+
+//DAS* DASFactoryImpl::createDAS(InputStream* configStream, HDBC* connection) {
+// return DASImpl(configStream, connection);
+//}
+
+DAS* DASFactoryImpl::createDAS(Config* config, HDBC* connection) {
+ return new DASImpl(config, connection);
+}
+
+DAS* DASFactoryImpl::createDAS(HDBC* connection) {
+ return new DASImpl(connection);
+}
\ No newline at end of file
Added: incubator/tuscany/cpp/das/das_java_classes/DASFactoryImpl.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/das_java_classes/DASFactoryImpl.h?view=auto&rev=537297
==============================================================================
--- incubator/tuscany/cpp/das/das_java_classes/DASFactoryImpl.h (added)
+++ incubator/tuscany/cpp/das/das_java_classes/DASFactoryImpl.h Fri May 11 14:36:45 2007
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ */
+#ifndef D_A_S_FACTORY_IMPL_H
+#define D_A_S_FACTORY_IMPL_H
+
+#include <windows.h>
+#include <sql.h>
+#include <sqlext.h>
+
+#include "DAS.h"
+#include "DASImpl.h"
+#include "Config.h"
+//#include "Connection.h"
+
+class DASFactoryImpl : public DASFactory {
+
+ public:
+ DASFactoryImpl(void);
+ virtual ~DASFactoryImpl(void);
+ //DAS* createDAS(InputStream* configStream);
+ DAS* createDAS(Config* config);
+ //DAS* createDAS(InputStream* configStream, HDBC* connection);
+ DAS* createDAS(Config* config, HDBC* connection);
+ DAS* createDAS(HDBC* connection);
+
+};
+
+#endif //D_A_S_FACTORY_IMPL_H
Added: incubator/tuscany/cpp/das/das_java_classes/DASImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/das_java_classes/DASImpl.cpp?view=auto&rev=537297
==============================================================================
--- incubator/tuscany/cpp/das/das_java_classes/DASImpl.cpp (added)
+++ incubator/tuscany/cpp/das/das_java_classes/DASImpl.cpp Fri May 11 14:36:45 2007
@@ -0,0 +1,276 @@
+/*
+ * 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.
+ */
+#include "DASImpl.h"
+
+//DASImpl::DASImpl(InputStream* stream) {
+// //this(ConfigUtil.loadConfig(stream));
+//}
+
+DASImpl::DASImpl(Config* inConfig) {
+ init(inConfig);
+
+}
+
+
+DASImpl::DASImpl(Config* inConfig, HDBC* inConnection) {
+ init(inConfig);
+ setConnection(inConnection);
+}
+
+//DASImpl::DASImpl(InputStream* configStream, HDBC* inConnection) {
+// this(ConfigUtil.loadConfig(configStream), inConnection);
+//}
+
+DASImpl::DASImpl(HDBC* inConnection) {
+ init(ConfigFactory::INSTANCE->createConfig());
+ setConnection(inConnection);
+
+}
+
+DASImpl::~DASImpl() {
+}
+
+
+void DASImpl::init(Config* inConfig) {
+ Config* cfg = inConfig;
+
+ if (cfg == NULL) {
+ cfg = ConfigFactory::INSTANCE->createConfig();
+ }
+
+ configWrapper = new MappingWrapper(cfg);
+
+ list<config::Command*>* commandList = configWrapper->getConfig()->getCommand();
+ list<config::Command*>::iterator i;
+
+ for (i = commandList->begin() ; i != commandList->end() ; i++) {
+ config::Command* commandConfig = *i;
+ string kind = commandConfig->getKind();
+ toLower(kind);
+
+ if ("select" == kind) {
+ commands.insert(make_pair(commandConfig->getName(), new ReadCommandImpl(commandConfig->getSQL(),
+ configWrapper, commandConfig->getResultDescriptor())));
+
+ } else if ("update" == kind) {
+ commands.insert(make_pair(commandConfig->getName(), new UpdateCommandImpl(commandConfig->getSQL())));
+
+ } else if ("insert" == kind) {
+ string* stringList = {{0}};
+ commands.insert(make_pair(commandConfig->getName(), new InsertCommandImpl(commandConfig->getSQL(), stringList, 0)));
+
+ } else if ("delete" == kind) {
+ commands.insert(make_pair(commandConfig->getName(), new DeleteCommandImpl(commandConfig->getSQL())));
+
+ } else if ("procedure" == kind) {
+ commands.insert(make_pair(commandConfig->getName(), new SPCommandImpl(commandConfig->getSQL(),
+ configWrapper, commandConfig->getParameter())));
+
+ } else {
+ //throw new RuntimeException("Invalid kind of command: " + kind);
+ }
+
+ }
+}
+
+ApplyChangesCommandImpl* DASImpl::getApplyChangesCommand(void) {
+ return new ApplyChangesCommandImpl(configWrapper, connection);
+}
+
+Command* DASImpl::getCommand(string name) {
+
+ map<string, CommandImpl*>::iterator i = commands.find(name);
+ if (i == commands.end()) {
+ //throw new RuntimeException("CommandGroup has no command named: " + name);
+ }
+
+ CommandImpl* cmd = (CommandImpl*) i->second;
+ cmd->setConnection(getConnection(), configWrapper->getConfig());
+
+ return cmd;
+
+}
+
+void DASImpl::setConnection(HDBC* aConnection) {
+ connection = aConnection;
+}
+
+HDBC* DASImpl::getConnection(void) {
+
+ if (connection == NULL) {
+ initializeConnection();
+ }
+
+ return connection;
+
+}
+
+void DASImpl::initializeConnection(void) {
+ Config* config = configWrapper->getConfig();
+
+ if (config == NULL || config->getConnectionInfo() == NULL
+ || config->getConnectionInfo()->getDataSource() == "") {
+ //throw new RuntimeException("No connection has been provided and no data source has been specified");
+ }
+
+ HDBC* connection = new HDBC;
+
+ //try {
+ char* ds = (char*) configWrapper->getConfig()->getConnectionInfo()->getDataSource().c_str();
+ // try {
+ SQLRETURN sqlConnectRes = SQLConnect(*connection, (SQLCHAR*) ds, SQL_NTS, (SQLCHAR*) NULL, SQL_NTS, (SQLCHAR*) NULL, SQL_NTS);
+
+ if (sqlConnectRes != SQL_SUCCESS && sqlConnectRes != SQL_SUCCESS_WITH_INFO) {
+ //throw new RuntimeException("Could not obtain a Connection from DataSource");
+ }
+
+ SQLSetConnectAttr(connection, SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF, SQL_NTS);
+ setConnection(connection);
+
+ //} catch (SQLException e) {
+ // throw new RuntimeException(e);
+ //}
+
+ //} catch (NamingException e) {
+ // throw new RuntimeException(e);
+ //}
+
+
+}
+
+void DASImpl::releaseResources(void) {
+
+ if (managingConnections()) {
+ closeConnection();
+ }
+
+}
+
+Command* DASImpl::createCommand(string sql) {
+ return baseCreateCommand(sql, configWrapper);
+}
+
+Command* DASImpl::createCommand(string sql, Config* config) {
+ return baseCreateCommand(sql, new MappingWrapper(config));
+}
+
+Command* DASImpl::baseCreateCommand(string inSql, MappingWrapper* config) {
+ CommandImpl* returnCmd = NULL;
+ trim(inSql); // Remove leading white space
+ char firstChar = toupper(inSql[0]);
+
+ switch (firstChar) {
+ case 'S':
+ returnCmd = new ReadCommandImpl(inSql, config, NULL);
+ break;
+
+ case 'I':
+ returnCmd = new InsertCommandImpl(inSql, NULL, 0);
+ break;
+
+ case 'U':
+ returnCmd = new UpdateCommandImpl(inSql);
+ break;
+
+ case 'D':
+ returnCmd = new DeleteCommandImpl(inSql);
+ break;
+
+ case '{':
+ returnCmd = new SPCommandImpl(inSql, config, new list<Parameter*>);
+ break;
+
+ //default:
+ //throw new RuntimeException("SQL => " + sql + " is not valid");
+
+ }
+
+ returnCmd->setConnection(getConnection(), config->getConfig());
+ return returnCmd;
+
+}
+
+void DASImpl::applyChanges(DataObject* root) {
+ getApplyChangesCommand()->execute(root);
+}
+
+int DASImpl::managingConnections(void) {
+
+ if (configWrapper->getConfig()->getConnectionInfo()->getDataSource() == "") {
+ return 0;
+ }
+
+ return 1;
+
+}
+void DASImpl::closeConnection(void) {
+
+ if (connection != NULL) {
+
+ //try {
+ SQLDisconnect(connection);
+ connection = NULL;
+ //} catch (SQLException e) {
+ // throw new RuntimeException(e);
+ //}
+
+ }
+
+}
+
+void DASImpl::toLower(string str) {
+ int i;
+ int stringSize = str.size();
+
+ for (i = 0 ; i < stringSize ; i++) {
+ str[i] = tolower(str[i]);
+ }
+
+}
+
+void DASImpl::trim(string str) {
+ int stringSize = str.size();
+ int stringBegin = 0;
+ int stringEnd = str.size() - 1;
+ char actual = str[0];
+
+ while (actual != ' ') {
+ stringBegin++;
+ actual = str[stringBegin];
+
+ }
+
+ actual = str[stringEnd];
+ while (actual != ' ') {
+ stringEnd--;
+ actual = str[stringBegin];
+
+ }
+
+ int i;
+ int j = 0;
+ for (i = stringBegin ; i <= stringEnd ; i++) {
+ str[j] = str[i];
+ j++;
+
+ }
+
+ str[j] = 0;
+
+}
Added: incubator/tuscany/cpp/das/das_java_classes/DASImpl.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/das_java_classes/DASImpl.h?view=auto&rev=537297
==============================================================================
--- incubator/tuscany/cpp/das/das_java_classes/DASImpl.h (added)
+++ incubator/tuscany/cpp/das/das_java_classes/DASImpl.h Fri May 11 14:36:45 2007
@@ -0,0 +1,83 @@
+/*
+ * 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.
+ */
+#ifndef D_A_S_IMPL_H
+#define D_A_S_IMPL_H
+
+#include <windows.h>
+#include <sql.h>
+#include <map>
+#include <string>
+#include <cctype>
+#include <list>
+
+#include "config/CommandImpl.h"
+#include "MappingWrapper.h"
+#include "DAS.h"
+#include "Command.h"
+#include "CommandImpl.h"
+#include "Config.h"
+#include "ApplyChangesCommandImpl.h"
+//#include "ConfigUtil.h"
+#include "ConfigFactory.h"
+#include "ReadCommandImpl.h"
+#include "UpdateCommandImpl.h"
+#include "InsertCommandImpl.h"
+#include "DeleteCommandImpl.h"
+#include "SPCommandImpl.h"
+//#include "DataSource.h"
+
+#include "commonj/sdo/DataFactory.h"
+
+using namespace commonj::sdo;
+using namespace std;
+
+class DASImpl : public DAS {
+
+ private:
+ MappingWrapper* configWrapper;
+ HDBC* connection;
+ map<string, CommandImpl*> commands;
+
+ int managingConnections(void);
+ void closeConnection(void);
+ void toLower(string string);
+ void trim(string string);
+ void init(Config* inConfig);
+
+ public:
+ //DASImpl(InputStream* stream);
+ DASImpl(Config* inConfig);
+ DASImpl(Config* inConfig, HDBC* inConnection);
+ //DASImpl(InputStream* configStream, HDBC* inConnection);
+ DASImpl(HDBC* inConnection);
+ virtual ~DASImpl(void);
+ ApplyChangesCommandImpl* getApplyChangesCommand(void);
+ Command* getCommand(string name);
+ HDBC* getConnection(void);
+ void setConnection(HDBC* aConnection);
+ void initializeConnection(void);
+ void releaseResources(void);
+ Command* createCommand(string sql);
+ Command* createCommand(string sql, Config* config);
+ Command* baseCreateCommand(string inSql, MappingWrapper* config);
+ void applyChanges(DataObject* root);
+
+};
+
+#endif //D_A_S_IMPL_H
Added: incubator/tuscany/cpp/das/das_java_classes/DASObject.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/das_java_classes/DASObject.cpp?view=auto&rev=537297
==============================================================================
--- incubator/tuscany/cpp/das/das_java_classes/DASObject.cpp (added)
+++ incubator/tuscany/cpp/das/das_java_classes/DASObject.cpp Fri May 11 14:36:45 2007
@@ -0,0 +1,90 @@
+/*
+ * 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.
+ */
+#include "DASObject.h"
+
+DASObject::DASObject(void) {
+ dasPointer = 0;
+ dasValueType = 0;
+
+}
+
+DASObject::DASObject(DASPointer pointer, short value) {
+ setDASObject(pointer, value);
+}
+
+DASObject::~DASObject(void) {}
+
+void DASObject::setDASObject(DASPointer pointer, short value) {
+ dasPointer = pointer;
+ dasValueType = value;
+
+}
+
+DASPointer DASObject::getDASPointer(void) const {
+ return dasPointer;
+}
+
+short DASObject::getDASObject(void) const {
+ return dasValueType;
+}
+/*
+ * 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.
+ */
+#include "DASObject.h"
+
+DASObject::DASObject(void) {
+ dasPointer = 0;
+ dasValueType = 0;
+
+}
+
+DASObject::DASObject(DASPointer pointer, short value) {
+ setDASObject(pointer, value);
+}
+
+DASObject::~DASObject(void) {}
+
+void DASObject::setDASObject(DASPointer pointer, short value) {
+ dasPointer = pointer;
+ dasValueType = value;
+
+}
+
+DASPointer DASObject::getDASPointer(void) const {
+ return dasPointer;
+}
+
+short DASObject::getDASObject(void) const {
+ return dasValueType;
+}
Added: incubator/tuscany/cpp/das/das_java_classes/DASObject.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/das_java_classes/DASObject.h?view=auto&rev=537297
==============================================================================
--- incubator/tuscany/cpp/das/das_java_classes/DASObject.h (added)
+++ incubator/tuscany/cpp/das/das_java_classes/DASObject.h Fri May 11 14:36:45 2007
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+#ifndef DAS_VALUE_H
+#define DAS_VALUE_H
+
+#include "DASPointer.h"
+
+class DASObject {
+
+ private:
+ DASPointer dasPointer;
+ short dasValueType;
+
+ public:
+ DASObject(void);
+ DASObject(DASPointer pointer, short value);
+ virtual ~DASObject(void);
+ void setDASObject(DASPointer pointer, short value);
+ DASPointer getDASPointer(void) const;
+ short getDASObject(void) const;
+
+};
+
+#endif //DAS_VALUE_H
Added: incubator/tuscany/cpp/das/das_java_classes/DASPointer.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/das_java_classes/DASPointer.h?view=auto&rev=537297
==============================================================================
--- incubator/tuscany/cpp/das/das_java_classes/DASPointer.h (added)
+++ incubator/tuscany/cpp/das/das_java_classes/DASPointer.h Fri May 11 14:36:45 2007
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+#ifndef DAS_POINTER_H
+#define DAS_POINTER_H
+
+typedef void* DASPointer;
+
+#endif //DAS_POINTER_H
+/*
+ * 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.
+ */
+#ifndef DAS_POINTER_H
+#define DAS_POINTER_H
+
+typedef void* DASPointer;
+
+#endif //DAS_POINTER_H
Added: incubator/tuscany/cpp/das/das_java_classes/DASValues.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/das_java_classes/DASValues.h?view=auto&rev=537297
==============================================================================
--- incubator/tuscany/cpp/das/das_java_classes/DASValues.h (added)
+++ incubator/tuscany/cpp/das/das_java_classes/DASValues.h Fri May 11 14:36:45 2007
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+#ifndef DAS_VALUES_H
+#define DAS_VALUES_H
+
+class DASValues {
+
+ const static short DAS_BOOL = 1;
+ const static short DAS_STRING = 2;
+
+};
+
+#endif //DAS_VALUES_H
+/*
+ * 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.
+ */
+#ifndef DAS_VALUES_H
+#define DAS_VALUES_H
+
+class DASValues {
+
+ const static short DAS_BOOL = 1;
+ const static short DAS_STRING = 2;
+
+};
+
+#endif //DAS_VALUES_H
Added: incubator/tuscany/cpp/das/das_java_classes/DataObjectMaker.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/das_java_classes/DataObjectMaker.cpp?view=auto&rev=537297
==============================================================================
--- incubator/tuscany/cpp/das/das_java_classes/DataObjectMaker.cpp (added)
+++ incubator/tuscany/cpp/das/das_java_classes/DataObjectMaker.cpp Fri May 11 14:36:45 2007
@@ -0,0 +1,114 @@
+/*
+ * 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.
+ */
+#include "DataObjectMaker.h"
+
+DataObjectMaker::DataObjectMaker(DataObject& root) {
+ rootObject = root;
+}
+
+DataObjectMaker::~DataObjectMaker(void) {
+}
+
+DataObject& DataObjectMaker::createAndAddDataObject(TableData* tableData, ResultMetadata* resultMetadata) {
+ /*if (this.logger.isDebugEnabled()) {
+ this.logger.debug("Looking for Type for " + tableData.getTableName());
+ }*/
+
+ Type* tableClass = findTableTypeByPropertyName(tableData->getTableName());
+
+ if (tableClass == NULL) {
+ //throw new RuntimeException("An SDO Type with name " + tableData.getTableName() + " was not found");
+ }
+
+ DataObjectPtr obj = DataFactory::getDataFactory()->create(tableClass);
+
+ // Now, check to see if the root data object has a containment reference
+ // to this EClass. If so, add it to the graph. If not, it will be taken
+ // care
+ // of when we process relationships
+
+ list<Property*>& propertiesList = rootObject->getType().getProperties();
+ list<Property*>::iterator i;
+
+ for (i = propertiesList.begin() ; i != propertiesList.end() ; i++) {
+
+ if ((*i)->isContainment() && (*i)->getType().equals(tableClass)) {
+
+ if ((*i)->isMany()) {
+ rootObject->getList(**i).insert(obj);
+ } else {
+ rootObject->setDataObject(**i, obj);
+ }
+
+ }
+
+ }
+
+ list<string>& columnNames = resultMetadata.getPropertyNames(tableData.getTableName());
+ list<string>::iterator j;
+
+ for (j = columnNames.begin() ; j != columnNames.end() ; j++) {
+ Property& p = findProperty(obj->getType(), *j);
+
+ if (j == NULL) {
+ //throw new RuntimeException("Type " + obj.getType().getName()
+ // + " does not contain a property named " + propertyName);
+ }
+
+ DASObject value = tableData->getColumnData(propertyName);
+
+ obj->set(*j, value);
+
+ }
+
+ return obj;
+
+}
+
+const Type& DataObjectMaker::findTableTypeByPropertyName(string tableName) {
+ PropertyList propertyList = rootObject->getType().getProperties();
+ int i;
+
+ for (i = 0 ; i < propertyList.size() ; i++) {
+
+ if (tableName == (string) propertyList[i].getType().getName()) {
+ return propertyList[i].getType();
+ }
+
+ }
+
+}
+
+const Property* findProperty(Type& type, string columnName) {
+ PropertyList propertyList = type.getProperties();
+ int i;
+
+ for (i = 0 ; i < propertyList.size() ; i++) {
+
+ if (columnName == (string) propertyList[i].getName()) {
+ return &propertyList[i];
+ }
+
+ }
+
+ return NULL;
+
+}
+
+
Added: incubator/tuscany/cpp/das/das_java_classes/DataObjectMaker.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/das_java_classes/DataObjectMaker.h?view=auto&rev=537297
==============================================================================
--- incubator/tuscany/cpp/das/das_java_classes/DataObjectMaker.h (added)
+++ incubator/tuscany/cpp/das/das_java_classes/DataObjectMaker.h Fri May 11 14:36:45 2007
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+#ifndef DATA_OBJECT_MAKER_H
+#define DATA_OBJECT_MAKER_H
+
+#include <string>
+
+#include "ResultMetadata.h"
+#include "TableData.h"
+
+#include "commonj/sdo/DataObject.h"
+#include "commonj/sdo/Property.h"
+#include "commonj/sdo/Type.h"
+
+using namespace commonj::sdo;
+using namespace std;
+
+class DataObjectMaker {
+
+ private:
+ DataObject* rootObject;
+
+ const Type& findTableTypeByPropertyName(string tableName);
+ const Property& findProperty(Type* type, string columnName);
+
+ public:
+ DataObjectMaker(DataObject* root);
+ virtual ~DataObjectMaker(void);
+ DataObject* createAndAddDataObject(TableData* tableData, ResultMetadata* resultMetadata);
+
+};
+
+#endif //DATA_OBJECT_MAKER_H
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org