You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by lr...@apache.org on 2007/01/13 00:33:57 UTC
svn commit: r495788 [2/5] - in /incubator/tuscany/cpp/das: ./ VSExpress/
VSExpress/tuscany_das/ VSExpress/tuscany_das/Build/
VSExpress/tuscany_das/Build/Debug/ VSExpress/tuscany_das/das_runtime/
runtime/ runtime/core/ runtime/core/src/
Added: incubator/tuscany/cpp/das/runtime/core/src/CollisionParameter.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/CollisionParameter.h?view=auto&rev=495788
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/CollisionParameter.h (added)
+++ incubator/tuscany/cpp/das/runtime/core/src/CollisionParameter.h Fri Jan 12 15:33:46 2007
@@ -0,0 +1,35 @@
+/*
+ * 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 COLLISION_PARAMETER_H
+#define COLLISION_PARAMETER_H
+
+#include "ParameterImpl.h"
+//#include "DASObject.h"
+
+class CollisionParameter : public ParameterImpl {
+
+ private:
+ int isSet;
+
+ public:
+ void setValue(DASObject* aValue);
+
+};
+
+#endif //COLLISION_PARAMETER_H
\ No newline at end of file
Added: incubator/tuscany/cpp/das/runtime/core/src/Column.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/Column.h?view=auto&rev=495788
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/Column.h (added)
+++ incubator/tuscany/cpp/das/runtime/core/src/Column.h Fri Jan 12 15:33:46 2007
@@ -0,0 +1,199 @@
+/*
+ * 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 COLUMN_H
+#define COLUMN_H
+
+#include <string>
+
+using namespace std;
+
+virtual class Column {
+ /**
+ * Returns the value of the '<em><b>Column Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Column Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Column Name</em>' attribute.
+ * @see #setColumnName(String)
+ * @generated
+ */
+ string getColumnName(void);
+
+ /**
+ * Sets the value of the '{@link org.apache.tuscany.das.rdb.config.Column#getColumnName <em>Column Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Column Name</em>' attribute.
+ * @see #getColumnName()
+ * @generated
+ */
+ void setColumnName(string value);
+
+ /**
+ * Returns the value of the '<em><b>Property Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Property Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Property Name</em>' attribute.
+ * @see #setPropertyName(String)
+ * @generated
+ */
+ string getPropertyName(void);
+
+ /**
+ * Sets the value of the '{@link org.apache.tuscany.das.rdb.config.Column#getPropertyName <em>Property Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Property Name</em>' attribute.
+ * @see #getPropertyName()
+ * @generated
+ */
+ void setPropertyName(string value);
+
+ /**
+ * Returns the value of the '<em><b>Converter Class Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Converter Class Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Converter Class Name</em>' attribute.
+ * @see #setConverterClassName(String)
+ * @generated
+ */
+ string getConverterClassName(void);
+
+ /**
+ * Sets the value of the '{@link org.apache.tuscany.das.rdb.config.Column#getConverterClassName <em>Converter Class Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Converter Class Name</em>' attribute.
+ * @see #getConverterClassName()
+ * @generated
+ */
+ void setConverterClassName(string value);
+
+ /**
+ * Returns the value of the '<em><b>Primary Key</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Primary Key</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Primary Key</em>' attribute.
+ * @see #setPrimaryKey(boolean)
+ * @generated
+ */
+ bool isPrimaryKey(void);
+
+ /**
+ * Sets the value of the '{@link org.apache.tuscany.das.rdb.config.Column#isPrimaryKey <em>Primary Key</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Primary Key</em>' attribute.
+ * @see #isPrimaryKey()
+ * @generated
+ */
+ void setPrimaryKey(bool value);
+
+ /**
+ * Returns the value of the '<em><b>Generated</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Generated</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Generated</em>' attribute.
+ * @see #setGenerated(boolean)
+ * @generated
+ */
+ bool isGenerated(void);
+
+ /**
+ * Sets the value of the '{@link org.apache.tuscany.das.rdb.config.Column#isGenerated <em>Generated</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Generated</em>' attribute.
+ * @see #isGenerated()
+ * @generated
+ */
+ void setGenerated(bool value);
+
+ /**
+ * Returns the value of the '<em><b>Collision</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Collision</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Collision</em>' attribute.
+ * @see #setCollision(boolean)
+ * @generated
+ */
+ bool isCollision(void);
+
+ /**
+ * Sets the value of the '{@link org.apache.tuscany.das.rdb.config.Column#isCollision <em>Collision</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Collision</em>' attribute.
+ * @see #isCollision()
+ * @generated
+ */
+ void setCollision(bool value);
+
+ /**
+ * Returns the value of the '<em><b>Managed</b></em>' attribute.
+ * The default value is <code>"true"</code>.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Managed</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Managed</em>' attribute.
+ * @see #setManaged(boolean)
+ * @generated
+ */
+ bool isManaged(void);
+
+ /**
+ * Sets the value of the '{@link org.apache.tuscany.das.rdb.config.Column#isManaged <em>Managed</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Managed</em>' attribute.
+ * @see #isManaged()
+ * @generated
+ */
+ void setManaged(bool value);
+
+}; // Column
+
+
+#endif //COLUMN_H
\ No newline at end of file
Added: incubator/tuscany/cpp/das/runtime/core/src/ColumnImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/ColumnImpl.cpp?view=auto&rev=495788
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/ColumnImpl.cpp (added)
+++ incubator/tuscany/cpp/das/runtime/core/src/ColumnImpl.cpp Fri Jan 12 15:33:46 2007
@@ -0,0 +1,233 @@
+/*
+ * 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 "ColumnImpl.h"
+
+ColumnImpl::ColumnImpl(void) {}
+
+ColumnImpl::~ColumnImpl(void) {
+}
+
+void ColumnImpl::initializeVariables(void) {
+ columnName = COLUMN_NAME_DEFAULT_;
+ propertyName = PROPERTY_NAME_DEFAULT_;
+ converterClassName = CONVERTER_CLASS_NAME_DEFAULT_;
+ primaryKey = PRIMARY_KEY_DEFAULT_;
+ generated = GENERATED_DEFAULT_;
+ collision = COLLISION_DEFAULT_;
+ managed = MANAGED_DEFAULT_;
+
+}
+
+Type& ColumnImpl::getType(void) {
+ return ((ConfigFactoryImpl) ConfigFactory.INSTANCE).getColumn();
+}
+
+string ColumnImpl::getColumnName(void) {
+ return columnName;
+}
+
+void ColumnImpl::setColumnName(string newColumnName) {
+ columnName = newColumnName;
+}
+
+string ColumnImpl::getPropertyName(void) {
+ return propertyName;
+}
+
+void ColumnImpl::setPropertyName(string newPropertyName) {
+ propertyName = newPropertyName;
+}
+
+string ColumnImpl::getConverterClassName(void) {
+ return converterClassName;
+}
+
+void ColumnImpl::setConverterClassName(string newConverterClassName) {
+ converterClassName = newConverterClassName;
+}
+
+bool ColumnImpl::isPrimaryKey(void) {
+ return primaryKey;
+}
+
+void ColumnImpl::setPrimaryKey(bool newPrimaryKey) {
+ primaryKey = newPrimaryKey;
+}
+
+bool ColumnImpl::isGenerated(void) {
+ return generated;
+}
+
+void ColumnImpl::setGenerated(bool newGenerated) {
+ generated = newGenerated;
+}
+
+bool ColumnImpl::isCollision(void) {
+ return collision;
+}
+
+void ColumnImpl::setCollision(bool newCollision) {
+ collision = newCollision;
+}
+
+bool ColumnImpl::isManaged(void) {
+ return managed;
+}
+
+void ColumnImpl::setManaged(bool newManaged) {
+ managed = newManaged;
+}
+
+DASObject& ColumnImpl::get(int propertyIndex, bool resolve) {
+ switch (propertyIndex) {
+
+ case COLUMN_NAME:
+ return getColumnName();
+
+ case PROPERTY_NAME:
+ return getPropertyName();
+
+ case CONVERTER_CLASS_NAME:
+ return getConverterClassName();
+
+ case PRIMARY_KEY:
+ return isPrimaryKey() ? Boolean.TRUE : Boolean.FALSE;
+
+ case GENERATED:
+ return isGenerated() ? Boolean.TRUE : Boolean.FALSE;
+
+ case COLLISION:
+ return isCollision() ? Boolean.TRUE : Boolean.FALSE;
+
+ case MANAGED:
+ return isManaged() ? Boolean.TRUE : Boolean.FALSE;
+
+ }
+
+ return DataObjectBase::get(propertyIndex, resolve);
+
+}
+
+void ColumnImpl::set(int propertyIndex, DASObject& newValue) {
+
+ switch (propertyIndex) {
+
+ case COLUMN_NAME:
+ setColumnName((String) newValue);
+ return;
+
+ case PROPERTY_NAME:
+ setPropertyName((String) newValue);
+ return;
+
+ case CONVERTER_CLASS_NAME:
+ setConverterClassName((String) newValue);
+ return;
+
+ case PRIMARY_KEY:
+ setPrimaryKey(((Boolean) newValue).booleanValue());
+ return;
+
+ case GENERATED:
+ setGenerated(((Boolean) newValue).booleanValue());
+ return;
+
+ case COLLISION:
+ setCollision(((Boolean) newValue).booleanValue());
+ return;
+
+ case MANAGED:
+ setManaged(((Boolean) newValue).booleanValue());
+ return;
+
+ }
+
+ DataObjectBase::set(propertyIndex, newValue);
+
+}
+
+void ColumnImpl::unset(int propertyIndex) {
+
+ switch (propertyIndex) {
+
+ case COLUMN_NAME:
+ setColumnName(COLUMN_NAME_DEFAULT_);
+ return;
+
+ case PROPERTY_NAME:
+ setPropertyName(PROPERTY_NAME_DEFAULT_);
+ return;
+
+ case CONVERTER_CLASS_NAME:
+ setConverterClassName(CONVERTER_CLASS_NAME_DEFAULT_);
+ return;
+
+ case PRIMARY_KEY:
+ setPrimaryKey(PRIMARY_KEY_DEFAULT_);
+ return;
+
+ case GENERATED:
+ setGenerated(GENERATED_DEFAULT_);
+ return;
+
+ case COLLISION:
+ setCollision(COLLISION_DEFAULT_);
+ return;
+
+ case MANAGED:
+ setManaged(MANAGED_DEFAULT_);
+ return;
+
+ }
+
+ DataObjectBase::unset(propertyIndex);
+
+}
+
+bool ColumnImpl::isSet(int propertyIndex) {
+ switch (propertyIndex) {
+
+ case COLUMN_NAME:
+ return COLUMN_NAME_DEFAULT_ == NULL ? columnName != NULL : !(strcmp(COLUMN_NAME_DEFAULT_, columnName) == 0);
+
+ case PROPERTY_NAME:
+ return PROPERTY_NAME_DEFAULT_ == NULL ? propertyName != NULL : !(strcmp(PROPERTY_NAME_DEFAULT_, propertyName) == 0);
+
+ case CONVERTER_CLASS_NAME:
+ return CONVERTER_CLASS_NAME_DEFAULT_ == NULL ? converterClassName != NULL : !(strcmp(CONVERTER_CLASS_NAME_DEFAULT_, converterClassName) == 0);
+
+ case PRIMARY_KEY:
+ return primaryKey != PRIMARY_KEY_DEFAULT_;
+
+ case GENERATED:
+ return generated != GENERATED_DEFAULT_;
+
+ case COLLISION:
+ return collision != COLLISION_DEFAULT_;
+
+ case MANAGED:
+ return managed != MANAGED_DEFAULT_;
+
+ }
+
+ return DataObjectBase::isSet(propertyIndex);
+
+}
+
+//string ColumnImpl::toString(void) {}
Added: incubator/tuscany/cpp/das/runtime/core/src/ColumnImpl.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/ColumnImpl.h?view=auto&rev=495788
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/ColumnImpl.h (added)
+++ incubator/tuscany/cpp/das/runtime/core/src/ColumnImpl.h Fri Jan 12 15:33:46 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 COLUMN_IMPL_H
+#define COLUMN_IMPL_H
+
+class ColumnImpl : public DataObjectBase, public Column {
+
+ protected:
+ const static string COLUMN_NAME_DEFAULT_ = NULL;
+ const static string PROPERTY_NAME_DEFAULT_ = NULL;
+ const static string CONVERTER_CLASS_NAME_DEFAULT_ = NULL;
+ const static bool PRIMARY_KEY_DEFAULT_ = false;
+ const static bool GENERATED_DEFAULT_ = false;
+ const static bool COLLISION_DEFAULT_ = false;
+ const static bool MANAGED_DEFAULT_ = true;
+
+ string columnName = COLUMN_NAME_DEFAULT_;
+ string propertyName = PROPERTY_NAME_DEFAULT_;
+ string converterClassName = CONVERTER_CLASS_NAME_DEFAULT_;
+ bool primaryKey = PRIMARY_KEY_DEFAULT_;
+ bool generated = GENERATED_DEFAULT_;
+ bool collision = COLLISION_DEFAULT_;
+ bool managed = MANAGED_DEFAULT_;
+
+ ColumnImpl(void);
+ void initializeVariables(void);
+
+ public:
+ const static int COLUMN_NAME = 0;
+ const static int PROPERTY_NAME = 1;
+ const static int CONVERTER_CLASS_NAME = 2;
+ const static int PRIMARY_KEY = 3;
+ const static int GENERATED = 4;
+ const static int COLLISION = 5;
+ const static int MANAGED = 6;
+ const static int SDO_PROPERTY_COUNT = 7;
+
+ virtual ~ColumnImpl(void);
+ Type* getType(void);
+ string getColumnName(void);
+ void setColumnName(string newColumnName);
+ string getPropertyName(void);
+ void setPropertyName(string newPropertyName);
+ string getConverterClassName(void);
+ void setConverterClassName(string newConverterClassName);
+ bool isPrimaryKey(void);
+ void setPrimaryKey(bool newPrimaryKey);
+ bool isGenerated(void);
+ void setGenerated(bool newGenerated);
+ bool isCollision(void);
+ void setCollision(bool newCollision);
+ bool isManaged(void);
+ void setManaged(bool newManaged);
+ DASObject* get(int propertyIndex, bool resolve);
+ void set(int propertyIndex, DASObject* newValue);
+ void unset(int propertyIndex);
+ bool isSet(int propertyIndex);
+ //string toString(void);
+
+};
+
+
+#endif //COLUMN_IMPL_H
\ No newline at end of file
Added: incubator/tuscany/cpp/das/runtime/core/src/Command.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/Command.h?view=auto&rev=495788
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/Command.h (added)
+++ incubator/tuscany/cpp/das/runtime/core/src/Command.h Fri Jan 12 15:33:46 2007
@@ -0,0 +1,77 @@
+/*
+ * 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 COMMAND_H
+#define COMMAND_H
+
+#include "DASObject.h"
+
+#include "commonj/sdo/DataObject.h"
+
+using namespace commonj::sdo;
+
+/**
+ * A Command is used to execute a read or write to a database
+ */
+virtual class Command {
+
+ public:
+
+ /**
+ * Performs the function defined by the command
+ */
+ void execute(void);
+
+ /**
+ * Performs the function defined by the command and return the results in the root DataObject
+ *
+ * @return the root DataObject
+ */
+ DataObject* executeQuery(void);
+
+ /**
+ * Sets the value of the associated Parameter
+ *
+ * @param index
+ * the index of the Parameter
+ * @param value
+ * the value for the Parameter
+ */
+ void setParameter(int index, DASObject* value);
+
+ /**
+ * Returns the value of the associated Parameter
+ *
+ * @param index
+ * the index of the Parameter
+ * @return the value of the Parameter
+ */
+ DASObject* getParameter(int index);
+
+ /**
+ * Returns the value of the database-generated key. This method is specific
+ * to an "insert" command and will be valid only after the command has
+ * been executed.
+ *
+ * @return the generated key
+ */
+ int getGeneratedKey(void);
+
+};
+
+#endif //COMMAND_H
\ No newline at end of file
Added: incubator/tuscany/cpp/das/runtime/core/src/CommandImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/CommandImpl.cpp?view=auto&rev=495788
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/CommandImpl.cpp (added)
+++ incubator/tuscany/cpp/das/runtime/core/src/CommandImpl.cpp Fri Jan 12 15:33:46 2007
@@ -0,0 +1,69 @@
+/*
+ * 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.
+ */
+CommandImpl::CommandImpl(string sqlString) {
+ statement = Statement(sqlString);
+
+ //try {
+ URL url = getClass().getResource("/xml/sdoJava.xsd");
+ if (url == null) {
+ //throw new RuntimeException("Could not find resource: xml/sdoJava.xsd");
+ }
+
+ InputStream inputStream = url.openStream();
+ XSDHelper.INSTANCE.define(inputStream, url.toString());
+ inputStream.close();
+ //} catch (IOException ex) {
+ // throw new RuntimeException(ex);
+ //}
+
+}
+
+CommandImpl::~CommandImpl() {
+}
+
+void CommandImpl::setParameter(int index, Object* value) {
+ parameters.setParameter(index, value);
+}
+
+void CommandImpl::addParameter(ParameterImpl* param) {
+ parameters.add(param);
+}
+
+list* CommandImpl::getParameters(void) {
+ return parameters.parameterList();
+}
+
+DASObject* CommandImpl::getParameter(int index) {
+ return parameters.parameterWithIndex(index)->getValue();
+}
+
+void CommandImpl::setConnection(ConnectionImpl connection) {
+ statement->setConnection(connection);
+}
+
+int CommandImpl::getGeneratedKey(void) {
+ //throw new RuntimeException("This method is only valid for insert commands");
+}
+
+void CommandImpl::close(void) {
+ statement->close();
+}
+ConnectionImpl* CommandImpl::getConnection(void) {
+ return statement->getConnection();
+}
Added: incubator/tuscany/cpp/das/runtime/core/src/CommandImpl.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/CommandImpl.h?view=auto&rev=495788
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/CommandImpl.h (added)
+++ incubator/tuscany/cpp/das/runtime/core/src/CommandImpl.h Fri Jan 12 15:33:46 2007
@@ -0,0 +1,63 @@
+/*
+ * 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 COMMAND_IMPL_H
+#define COMMAND_IMPL_H
+
+#include <list>
+
+#include "Command.h"
+#include "Statement.h"
+#include "Parameters.h"
+#include "ResultSetShape.h"
+#include "ConnectionImpl.h"
+#include "DASObject.h"
+#include "BaseCommandImpl.h"
+#include "ParameterImpl.h"
+//#include "XSDHelper.h"
+
+#include "commonj/sdo/DataObject.h"
+
+using namespace commonj::sdo;
+using namespace std;
+
+class CommandImpl : public Command, public BaseCommandImpl {
+
+ protected:
+ Statement *statement;
+ Parameters parameters;
+ ResultSetShape *resultSetShape;
+
+ ConnectionImpl* getConnection(void);
+
+ public:
+ CommandImpl(string sqlString);
+ virtual ~CommandImpl(void);
+ virtual void execute(void);
+ virtual DataObject* executeQuery(void);
+ void setParameter(int index, DASObject* value);
+ void addParameter(ParameterImpl* param);
+ list<ParameterImpl*>* getParameters(void);
+ DASObject* getParameter(int index);
+ void setConnection(ConnectionImpl* connection);
+ void close(void);
+ int getGeneratedKey(void);
+
+};
+
+#endif //COMMAND_IMPL_H
\ No newline at end of file
Added: incubator/tuscany/cpp/das/runtime/core/src/Config.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/Config.h?view=auto&rev=495788
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/Config.h (added)
+++ incubator/tuscany/cpp/das/runtime/core/src/Config.h Fri Jan 12 15:33:46 2007
@@ -0,0 +1,148 @@
+/*
+ * 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_H
+#define CONFIG_H
+
+#include <list>;
+
+#include "ConnectionInfo.h"
+
+using namespace std;
+
+virtual class Config {
+
+ public:
+ /**
+ * Returns the value of the '<em><b>Command</b></em>' containment reference list.
+ * The list contents are of type {@link org.apache.tuscany.das.rdb.config.Command}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Command</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Command</em>' containment reference list.
+ * @generated
+ */
+ list<string>* getCommand(void);
+
+ /**
+ * Returns the value of the '<em><b>Table</b></em>' containment reference list.
+ * The list contents are of type {@link org.apache.tuscany.das.rdb.config.Table}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Table</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Table</em>' containment reference list.
+ * @generated
+ */
+ list<Table*>* getTable(void);
+
+ /**
+ * Returns the value of the '<em><b>Relationship</b></em>' containment reference list.
+ * The list contents are of type {@link org.apache.tuscany.das.rdb.config.Relationship}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Relationship</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Relationship</em>' containment reference list.
+ * @generated
+ */
+ list<string>* getRelationship();
+
+ /**
+ * Returns the value of the '<em><b>Connection Info</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Connection Info</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Connection Info</em>' containment reference.
+ * @see #setConnectionInfo(ConnectionInfo)
+ * @generated
+ */
+ ConnectionInfo* getConnectionInfo(void);
+
+ /**
+ * Sets the value of the '{@link org.apache.tuscany.das.rdb.config.Config#getConnectionInfo <em>Connection Info</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Connection Info</em>' containment reference.
+ * @see #getConnectionInfo()
+ * @generated
+ */
+ void setConnectionInfo(ConnectionInfo* value);
+
+ /**
+ * Returns the value of the '<em><b>Uri</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Uri</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Uri</em>' attribute.
+ * @see #setUri(String)
+ * @generated
+ */
+ string getUri(void);
+
+ /**
+ * Sets the value of the '{@link org.apache.tuscany.das.rdb.config.Config#getUri <em>Uri</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Uri</em>' attribute.
+ * @see #getUri()
+ * @generated
+ */
+ void setUri(string value);
+
+ /**
+ * Returns the value of the '<em><b>Data Object Model</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Data Object Model</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 Object Model</em>' attribute.
+ * @see #setDataObjectModel(String)
+ * @generated
+ */
+ string getDataObjectModel(void);
+
+ /**
+ * Sets the value of the '{@link org.apache.tuscany.das.rdb.config.Config#getDataObjectModel <em>Data Object Model</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Data Object Model</em>' attribute.
+ * @see #getDataObjectModel()
+ * @generated
+ */
+ void setDataObjectModel(string value);
+
+}; // Config
+
+
+#endif //CONFIG_H
\ No newline at end of file
Added: incubator/tuscany/cpp/das/runtime/core/src/ConfigFactory.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/ConfigFactory.cpp?view=auto&rev=495788
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/ConfigFactory.cpp (added)
+++ incubator/tuscany/cpp/das/runtime/core/src/ConfigFactory.cpp Fri Jan 12 15:33:46 2007
@@ -0,0 +1,21 @@
+/*
+ * 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 "ConfigFactory.h"
+
+ConfigFactory& ConfigFactory::INSTANCE = ConfigFactoryImpl.init();
\ No newline at end of file
Added: incubator/tuscany/cpp/das/runtime/core/src/ConfigFactory.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/ConfigFactory.h?view=auto&rev=495788
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/ConfigFactory.h (added)
+++ incubator/tuscany/cpp/das/runtime/core/src/ConfigFactory.h Fri Jan 12 15:33:46 2007
@@ -0,0 +1,159 @@
+/*
+ * 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_FACTORY_H
+#define CONFIG_FACTORY_H
+
+#include "Column.h"
+#include "Command.h"
+#include "Config.h"
+#include "ConnectionInfo.h"
+#include "Create.h"
+#include "Delete.h"
+#include "KeyPair.h"
+#include "Parameter.h"
+#include "ResultDescriptor.h"
+#include "Relationship.h"
+#include "Update.h"
+#include "Table.h"
+#include "ConfigFactoryImpl.h"
+
+class ConfigFactory {
+
+ public:
+
+ /**
+ * The singleton instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ ConfigFactory* INSTANCE/* = ConfigFactoryImpl.init()*/;
+
+ /**
+ * Returns a new object of class '<em>Column</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Column</em>'.
+ * @generated
+ */
+ virtual Column* createColumn(void) = 0;
+
+ /**
+ * Returns a new object of class '<em>Command</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Command</em>'.
+ * @generated
+ */
+ virtual Command* createCommand(void) = 0;
+
+ /**
+ * Returns a new object of class '<em>Config</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Config</em>'.
+ * @generated
+ */
+ virtual Config* createConfig(void) = 0;
+
+ /**
+ * Returns a new object of class '<em>Connection Info</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Connection Info</em>'.
+ * @generated
+ */
+ virtual ConnectionInfo* createConnectionInfo(void) = 0;
+
+ /**
+ * Returns a new object of class '<em>Create</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Create</em>'.
+ * @generated
+ */
+ virtual Create* createCreate(void) = 0;
+
+ /**
+ * Returns a new object of class '<em>Delete</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Delete</em>'.
+ * @generated
+ */
+ virtual Delete* createDelete(void) = 0;
+
+ /**
+ * Returns a new object of class '<em>Key Pair</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Key Pair</em>'.
+ * @generated
+ */
+ virtual KeyPair* createKeyPair(void) = 0;
+
+ /**
+ * Returns a new object of class '<em>Parameter</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Parameter</em>'.
+ * @generated
+ */
+ virtual Parameter* createParameter(void) = 0;
+
+ /**
+ * Returns a new object of class '<em>Relationship</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Relationship</em>'.
+ * @generated
+ */
+ virtual Relationship* createRelationship(void) = 0;
+
+ /**
+ * Returns a new object of class '<em>Result Descriptor</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Result Descriptor</em>'.
+ * @generated
+ */
+ virtual ResultDescriptor* createResultDescriptor(void) = 0;
+
+ /**
+ * Returns a new object of class '<em>Table</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Table</em>'.
+ * @generated
+ */
+ virtual Table* createTable(void) = 0;
+
+ /**
+ * Returns a new object of class '<em>Update</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Update</em>'.
+ * @generated
+ */
+ virtual Update* createUpdate(void) = 0;
+
+}; //ConfigFactory
+
+
+#endif //CONFIG_FACTORY_H
\ No newline at end of file
Added: incubator/tuscany/cpp/das/runtime/core/src/ConfigFactoryImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/ConfigFactoryImpl.cpp?view=auto&rev=495788
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/ConfigFactoryImpl.cpp (added)
+++ incubator/tuscany/cpp/das/runtime/core/src/ConfigFactoryImpl.cpp Fri Jan 12 15:33:46 2007
@@ -0,0 +1,540 @@
+/*
+ * 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 meta-data objects
+ theConfigFactoryImpl.createMetaData();
+
+ // Initialize created meta-data
+ theConfigFactoryImpl.initializeMetaData();
+
+ // Mark meta-data to indicate it can't be changed
+ //theConfigFactoryImpl.freeze(); //FB do we need to freeze / should we freeze ????
+
+ return theConfigFactoryImpl;
+
+}
+
+void ConfigFactoryImpl::initializeVariables(void) {
+ isCreated = false;
+ isInitialized = false;
+ columnType = NULL;
+ commandType = NULL;
+ configType = NULL;
+ connectionInfoType = NULL;
+ createType = NULL;
+ deleteType = NULL;
+ keyPairType = NULL;
+ parameterType = NULL;
+ relationshipType = NULL;
+ resultDescriptorType = NULL;
+ tableType = NULL;
+ updateType = NULL;
+
+}
+
+//void ConfigFactoryImpl::createXSDMetaData(ModelFactoryImpl& theModelPackageImpl) {
+// super.createXSDMetaData();
+//
+// Property& property = NULL;
+//
+// addXSDMapping
+// (columnType,
+// new String[]
+// {
+// "name", "Column",
+// "kind", "empty"
+// });
+//
+// addXSDMapping
+// ((Property&) columnType.getProperties().get(ColumnImpl.COLUMN_NAME),
+// new String[]
+// {
+// "kind", "attribute",
+// "name", "columnName"
+// });
+//
+// addXSDMapping
+// ((Property&) columnType.getProperties().get(ColumnImpl.PROPERTY_NAME),
+// new String[]
+// {
+// "kind", "attribute",
+// "name", "propertyName"
+// });
+//
+// addXSDMapping
+// ((Property&) columnType.getProperties().get(ColumnImpl.CONVERTER_CLASS_NAME),
+// new String[]
+// {
+// "kind", "attribute",
+// "name", "converterClassName"
+// });
+//
+// addXSDMapping
+// ((Property&) columnType.getProperties().get(ColumnImpl.PRIMARY_KEY),
+// new String[]
+// {
+// "kind", "attribute",
+// "name", "primaryKey"
+// });
+//
+// addXSDMapping
+// ((Property&) columnType.getProperties().get(ColumnImpl.GENERATED),
+// new String[]
+// {
+// "kind", "attribute",
+// "name", "generated"
+// });
+//
+// addXSDMapping
+// ((Property&) columnType.getProperties().get(ColumnImpl.COLLISION),
+// new String[]
+// {
+// "kind", "attribute",
+// "name", "collision"
+// });
+//
+// addXSDMapping
+// ((Property&) columnType.getProperties().get(ColumnImpl.MANAGED),
+// new String[]
+// {
+// "kind", "attribute",
+// "name", "managed"
+// });
+//
+// addXSDMapping
+// (commandType,
+// new String[]
+// {
+// "name", "Command",
+// "kind", "elementOnly"
+// });
+//
+// addXSDMapping
+// ((Property&) commandType.getProperties().get(CommandImpl.PARAMETER),
+// new String[]
+// {
+// "kind", "element",
+// "name", "Parameter",
+// "namespace", "##targetNamespace"
+// });
+//
+// addXSDMapping
+// ((Property&) commandType.getProperties().get(CommandImpl.RESULT_DESCRIPTOR),
+// new String[]
+// {
+// "kind", "element",
+// "name", "ResultDescriptor",
+// "namespace", "##targetNamespace"
+// });
+//
+// addXSDMapping
+// ((Property&) commandType.getProperties().get(CommandImpl.NAME),
+// new String[]
+// {
+// "kind", "attribute",
+// "name", "name"
+// });
+//
+// addXSDMapping
+// ((Property&) commandType.getProperties().get(CommandImpl.SQL),
+// new String[]
+// {
+// "kind", "attribute",
+// "name", "SQL"
+// });
+//
+// addXSDMapping
+// ((Property&) commandType.getProperties().get(CommandImpl.KIND),
+// new String[]
+// {
+// "kind", "attribute",
+// "name", "kind"
+// });
+//
+// addXSDMapping
+// (configType,
+// new String[]
+// {
+// "name", "Config",
+// "kind", "elementOnly"
+// });
+//
+// addXSDMapping
+// ((Property&) configType.getProperties().get(ConfigImpl.COMMAND),
+// new String[]
+// {
+// "kind", "element",
+// "name", "Command",
+// "namespace", "##targetNamespace"
+// });
+//
+// addXSDMapping
+// ((Property&) configType.getProperties().get(ConfigImpl.TABLE),
+// new String[]
+// {
+// "kind", "element",
+// "name", "Table",
+// "namespace", "##targetNamespace"
+// });
+//
+// addXSDMapping
+// ((Property&) configType.getProperties().get(ConfigImpl.RELATIONSHIP),
+// new String[]
+// {
+// "kind", "element",
+// "name", "Relationship",
+// "namespace", "##targetNamespace"
+// });
+//
+// addXSDMapping
+// ((Property&) configType.getProperties().get(ConfigImpl.CONNECTION_INFO),
+// new String[]
+// {
+// "kind", "element",
+// "name", "ConnectionInfo",
+// "namespace", "##targetNamespace"
+// });
+//
+// addXSDMapping
+// ((Property&) configType.getProperties().get(ConfigImpl.URI),
+// new String[]
+// {
+// "kind", "attribute",
+// "name", "uri"
+// });
+//
+// addXSDMapping
+// ((Property&) configType.getProperties().get(ConfigImpl.DATA_OBJECT_MODEL),
+// new String[]
+// {
+// "kind", "attribute",
+// "name", "dataObjectModel"
+// });
+//
+// addXSDMapping
+// (connectionInfoType,
+// new String[]
+// {
+// "name", "ConnectionInfo",
+// "kind", "empty"
+// });
+//
+// addXSDMapping
+// ((Property&) connectionInfoType.getProperties().get(ConnectionInfoImpl.DATA_SOURCE),
+// new String[]
+// {
+// "kind", "attribute",
+// "name", "dataSource"
+// });
+//
+// addXSDMapping
+// ((Property&) connectionInfoType.getProperties().get(ConnectionInfoImpl.MANAGEDTX),
+// new String[]
+// {
+// "kind", "attribute",
+// "name", "managedtx"
+// });
+//
+// addXSDMapping
+// (createType,
+// new String[]
+// {
+// "name", "Create",
+// "kind", "empty"
+// });
+//
+// addXSDMapping
+// ((Property&) createType.getProperties().get(CreateImpl.SQL),
+// new String[]
+// {
+// "kind", "attribute",
+// "name", "sql"
+// });
+//
+// addXSDMapping
+// ((Property&) createType.getProperties().get(CreateImpl.PARAMETERS),
+// new String[]
+// {
+// "kind", "attribute",
+// "name", "parameters"
+// });
+//
+// addXSDMapping
+// (deleteType,
+// new String[]
+// {
+// "name", "Delete",
+// "kind", "empty"
+// });
+//
+// addXSDMapping
+// ((Property&) deleteType.getProperties().get(DeleteImpl.SQL),
+// new String[]
+// {
+// "kind", "attribute",
+// "name", "sql"
+// });
+//
+// addXSDMapping
+// ((Property&) deleteType.getProperties().get(DeleteImpl.PARAMETERS),
+// new String[]
+// {
+// "kind", "attribute",
+// "name", "parameters"
+// });
+//
+// property = createGlobalProperty
+// ("Config",
+// this.getConfig(),
+// new String[]
+// {
+// "kind", "element",
+// "name", "Config",
+// "namespace", "##targetNamespace"
+// });
+//
+// addXSDMapping
+// (keyPairType,
+// new String[]
+// {
+// "name", "KeyPair",
+// "kind", "empty"
+// });
+//
+// addXSDMapping
+// ((Property&) keyPairType.getProperties().get(KeyPairImpl.PRIMARY_KEY_COLUMN),
+// new String[]
+// {
+// "kind", "attribute",
+// "name", "primaryKeyColumn"
+// });
+//
+// addXSDMapping
+// ((Property&) keyPairType.getProperties().get(KeyPairImpl.FOREIGN_KEY_COLUMN),
+// new String[]
+// {
+// "kind", "attribute",
+// "name", "foreignKeyColumn"
+// });
+//
+// addXSDMapping
+// (parameterType,
+// new String[]
+// {
+// "name", "Parameter",
+// "kind", "empty"
+// });
+//
+// addXSDMapping
+// ((Property&) parameterType.getProperties().get(ParameterImpl.COLUMN_TYPE),
+// new String[]
+// {
+// "kind", "attribute",
+// "name", "columnType"
+// });
+//
+// addXSDMapping
+// ((Property&) parameterType.getProperties().get(ParameterImpl.DIRECTION),
+// new String[]
+// {
+// "kind", "attribute",
+// "name", "direction"
+// });
+//
+// addXSDMapping
+// ((Property&) parameterType.getProperties().get(ParameterImpl.INDEX),
+// new String[]
+// {
+// "kind", "attribute",
+// "name", "index"
+// });
+//
+// addXSDMapping
+// (relationshipType,
+// new String[]
+// {
+// "name", "Relationship",
+// "kind", "elementOnly"
+// });
+//
+// addXSDMapping
+// ((Property&) relationshipType.getProperties().get(RelationshipImpl.KEY_PAIR),
+// new String[]
+// {
+// "kind", "element",
+// "name", "KeyPair",
+// "namespace", "##targetNamespace"
+// });
+//
+// addXSDMapping
+// ((Property&) relationshipType.getProperties().get(RelationshipImpl.NAME),
+// new String[]
+// {
+// "kind", "attribute",
+// "name", "name"
+// });
+//
+// addXSDMapping
+// ((Property&) relationshipType.getProperties().get(RelationshipImpl.PRIMARY_KEY_TABLE),
+// new String[]
+// {
+// "kind", "attribute",
+// "name", "primaryKeyTable"
+// });
+//
+// addXSDMapping
+// ((Property&) relationshipType.getProperties().get(RelationshipImpl.FOREIGN_KEY_TABLE),
+// new String[]
+// {
+// "kind", "attribute",
+// "name", "foreignKeyTable"
+// });
+//
+// addXSDMapping
+// ((Property&) relationshipType.getProperties().get(RelationshipImpl.MANY),
+// new String[]
+// {
+// "kind", "attribute",
+// "name", "many"
+// });
+//
+// addXSDMapping
+// ((Property&) relationshipType.getProperties().get(RelationshipImpl.KEY_RESTRICTED),
+// new String[]
+// {
+// "kind", "attribute",
+// "name", "keyRestricted"
+// });
+//
+// addXSDMapping
+// (resultDescriptorType,
+// new String[]
+// {
+// "name", "ResultDescriptor",
+// "kind", "empty"
+// });
+//
+// addXSDMapping
+// ((Property&) resultDescriptorType.getProperties().get(ResultDescriptorImpl.COLUMN_NAME),
+// new String[]
+// {
+// "kind", "attribute",
+// "name", "columnName"
+// });
+//
+// addXSDMapping
+// ((Property&) resultDescriptorType.getProperties().get(ResultDescriptorImpl.TABLE_NAME),
+// new String[]
+// {
+// "kind", "attribute",
+// "name", "tableName"
+// });
+//
+// addXSDMapping
+// ((Property&) resultDescriptorType.getProperties().get(ResultDescriptorImpl.COLUMN_TYPE),
+// new String[]
+// {
+// "kind", "attribute",
+// "name", "columnType"
+// });
+//
+// addXSDMapping
+// (tableType,
+// new String[]
+// {
+// "name", "Table",
+// "kind", "elementOnly"
+// });
+//
+// addXSDMapping
+// ((Property&) tableType.getProperties().get(TableImpl.COLUMN),
+// new String[]
+// {
+// "kind", "element",
+// "name", "Column",
+// "namespace", "##targetNamespace"
+// });
+//
+// addXSDMapping
+// ((Property&) tableType.getProperties().get(TableImpl.CREATE),
+// new String[]
+// {
+// "kind", "element",
+// "name", "create",
+// "namespace", "##targetNamespace"
+// });
+//
+// addXSDMapping
+// ((Property&) tableType.getProperties().get(TableImpl.UPDATE),
+// new String[]
+// {
+// "kind", "element",
+// "name", "update",
+// "namespace", "##targetNamespace"
+// });
+//
+// addXSDMapping
+// ((Property&) tableType.getProperties().get(TableImpl.DELETE),
+// new String[]
+// {
+// "kind", "element",
+// "name", "delete",
+// "namespace", "##targetNamespace"
+// });
+//
+// addXSDMapping
+// ((Property&) tableType.getProperties().get(TableImpl.TABLE_NAME),
+// new String[]
+// {
+// "kind", "attribute",
+// "name", "tableName"
+// });
+//
+// addXSDMapping
+// ((Property&) tableType.getProperties().get(TableImpl.TYPE_NAME),
+// new String[]
+// {
+// "kind", "attribute",
+// "name", "typeName"
+// });
+//
+// addXSDMapping
+// (updateType,
+// new String[]
+// {
+// "name", "Update",
+// "kind", "empty"
+// });
+//
+// addXSDMapping
+// ((Property&) updateType.getProperties().get(UpdateImpl.SQL),
+// new String[]
+// {
+// "kind", "attribute",
+// "name", "sql"
+// });
+//
+// addXSDMapping
+// ((Property&) updateType.getProperties().get(UpdateImpl.PARAMETERS),
+// new String[]
+// {
+// "kind", "attribute",
+// "name", "parameters"
+// });
+//
+//}
\ No newline at end of file
Added: incubator/tuscany/cpp/das/runtime/core/src/ConfigFactoryImpl.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/ConfigFactoryImpl.h?view=auto&rev=495788
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/ConfigFactoryImpl.h (added)
+++ incubator/tuscany/cpp/das/runtime/core/src/ConfigFactoryImpl.h Fri Jan 12 15:33:46 2007
@@ -0,0 +1,101 @@
+/*
+ * 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_FACTORY_IMPL_H
+#define CONFIG_FACTORY_IMPL_H
+
+#include <string>
+
+#include "ConfigFactory.h"
+
+class ConfigFactoryImpl /*:*/ /*public FactoryBase,*/ /*public ConfigFactory*/ {
+
+ private:
+ static bool isInited/* = false*/;
+
+ bool isCreated/* = false*/;
+ bool isInitialized/* = false*/;
+
+ protected:
+ Type* columnType;
+ Type* commandType;
+ Type* configType;
+ Type* connectionInfoType;
+ Type* createType;
+ Type* deleteType;
+ Type* keyPairType;
+ Type* parameterType;
+ Type* relationshipType;
+ Type* resultDescriptorType;
+ Type* tableType;
+ Type* updateType;
+
+ void initializeVariables(void);
+ //void createXSDMetaData(ModelFactoryImpl* theModelPackageImpl);
+
+ public:
+ const static string NAMESPACE_URI/* = "http:///org.apache.tuscany.das.rdb/config.xsd"*/;
+ const static string NAMESPACE_PREFIX/* = "config"*/;
+ const static int COLUMN = 1;
+ const static int COMMAND = 2;
+ const static int CONFIG = 3;
+ const static int CONNECTION_INFO = 4;
+ const static int CREATE = 5;
+ const static int DELET = 6;
+ const static int KEY_PAIR = 7;
+ const static int PARAMETER = 8;
+ const static int RELATIONSHIP = 9;
+ const static int RESULT_DESCRIPTOR = 10;
+ const static int TABLE = 11;
+ const static int UPDATE = 12;
+
+ static ConfigFactoryImpl* init(void);
+
+ ConfigFactoryImpl(void);
+ virtual ~ConfigFactoryImpl(void);
+ //DataObject* create(int typeNumber);
+ virtual Column* createColumn(void);
+ virtual Command* createCommand(void);
+ virtual Config* createConfig(void);
+ virtual ConnectionInfo* createConnectionInfo(void);
+ virtual Create* createCreate(void);
+ virtual Delete* createDelete(void);
+ virtual KeyPair* createKeyPair(void);
+ virtual Parameter* createParameter(void);
+ virtual Relationship* createRelationship(void);
+ virtual ResultDescriptor* createResultDescriptor(void);
+ virtual Table* createTable(void);
+ virtual Update* createUpdate(void);
+ Type* getColumn(void);
+ Type* getCommand(void);
+ Type* getConfig(void);
+ Type* getConnectionInfo(void);
+ Type* getCreate(void);
+ Type* getDelete(void);
+ Type* getKeyPair(void);
+ Type* getParameter(void);
+ Type* getRelationship(void);
+ Type* getResultDescriptor(void);
+ Type* getTable(void);
+ Type* getUpdate(void);
+ void createMetaData(void);
+ void initializeMetaData(void);
+
+};
+
+#endif //CONFIG_FACTORY_IMPL_H
\ No newline at end of file
Added: incubator/tuscany/cpp/das/runtime/core/src/ConfigHelper.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/ConfigHelper.cpp?view=auto&rev=495788
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/ConfigHelper.cpp (added)
+++ incubator/tuscany/cpp/das/runtime/core/src/ConfigHelper.cpp Fri Jan 12 15:33:46 2007
@@ -0,0 +1,97 @@
+/*
+ * 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.
+ */
+ConfigHelper::ConfigHelper() {
+ factory = ConfigFactory.INSTANCE;
+
+ config = factory->createConfig();
+ configWrapper = MappingWrapper(config);
+
+}
+
+ConfigHelper::ConfigHelper(Config* config) {
+ factory = ConfigFactory.INSTANCE;
+
+ iConfig = aConfig;
+ configWrapper = MappingWrapper(config);
+
+}
+
+ConfigHelper::~ConfigHelper() {
+}
+
+void ConfigHelper::addPrimaryKey(string columnName) {
+ configWrapper->addPrimaryKey(columnName);
+}
+
+Relationship* ConfigHelper::addRelationship(string parentName, string childName){
+ return configWrapper->addRelationship(parentName, childName);
+}
+
+Table* ConfigHelper::addTable(string name, string typeName) {
+ return configWrapper->addTable(name, typeName);
+}
+
+Column* ConfigHelper::addColumn(Table* table, string columnName, string propertyName) {
+ return configWrapper->addColumn(table, columnName, propertyName);
+}
+
+void ConfigHelper::addUpdateStatement(Table* table, string statement, string parameters) {
+ configWrapper->addUpdateStatement(table, statement, parameters);
+}
+
+void ConfigHelper::addCreateStatement(Table* table, string statement, string parameters) {
+ configWrapper->addCreateStatement(table, statement, parameters);
+}
+
+void ConfigHelper::addDeleteStatement(Table* table, string statement, string parameters) {
+ configWrapper->addDeleteStatement(table, statement, parameters);
+}
+
+void ConfigHelper::addConnectionInfo(string dataSourceName, int managedtx) {
+ configWrapper->addConnectionInfo(dataSourceName, managedtx);
+}
+
+void ConfigHelper::addConnectionInfo(string dataSourceName) {
+ configWrapper->addConnectionInfo(dataSourceName, 1);
+}
+
+void ConfigHelper::setDataObjectModel(string dataObjectModel) {
+ configWrapper->getConfig()->setDataObjectModel(dataObjectModel);
+}
+
+Command* ConfigHelper::addSelectCommand(string name, string sql) {
+ return configWrapper->addCommand(name, sql, "select");
+}
+
+Command* ConfigHelper::addUpdateCommand(string name, string sql) {
+ return configWrapper->addCommand(name, sql, "update");
+}
+
+Command* ConfigHelper::addInsertCommand(string name, string sql) {
+ return configWrapper->addCommand(name, sql, "insert");
+}
+
+Command* ConfigHelper::addDeleteCommand(string name, string sql) {
+ return configWrapper->addCommand(name, sql, "delete");
+}
+
+Config* ConfigHelper::getConfig(void) {
+ return config;
+}
+
Added: incubator/tuscany/cpp/das/runtime/core/src/ConfigHelper.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/ConfigHelper.h?view=auto&rev=495788
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/ConfigHelper.h (added)
+++ incubator/tuscany/cpp/das/runtime/core/src/ConfigHelper.h Fri Jan 12 15:33:46 2007
@@ -0,0 +1,61 @@
+/*
+ * 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_HELPER_H
+#define CONFIG_HELPER_H
+
+#include "Config.h"
+#include "MappingWrapper.h"
+#include "ConfigFactory.h"
+#include "Relationship.h"
+#include "Relationship.h"
+#include "Column.h"
+#include "Command.h"
+#include "Config.h"
+#include "Config.h"
+
+class ConfigHelper {
+
+ private:
+ Config* iConfig;
+ MappingWrapper* configWrapper;
+ ConfigFactory* factory;
+
+ public:
+ ConfigHelper(void);
+ ConfigHelper(Config* config);
+ virtual ~ConfigHelper(void);
+ void addPrimaryKey(string columnName);
+ Relationship* addRelationship(string parentName, string childName);
+ Table* addTable(string name, string typeName);
+ Column* addColumn(Table* table, string columnName, string propertyName);
+ void addUpdateStatement(Table* table, string statement, string parameters);
+ void addCreateStatement(Table* table, string statement, string parameters);
+ void addDeleteStatement(Table* table, string statement, string parameters);
+ void addConnectionInfo(string dataSourceName, int managedtx);
+ void addConnectionInfo(string dataSourceName);
+ void setDataObjectModel(string dataObjectModel);
+ Command* addSelectCommand(string name, string sql);
+ Command* addUpdateCommand(string name, string sql);
+ Command* addInsertCommand(string name, string sql);
+ Command* addDeleteCommand(string name, string sql);
+ Config* getConfig(void);
+
+};
+
+#endif //CONFIG_HELPER_H
\ No newline at end of file
Added: incubator/tuscany/cpp/das/runtime/core/src/ConfigImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/ConfigImpl.cpp?view=auto&rev=495788
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/ConfigImpl.cpp (added)
+++ incubator/tuscany/cpp/das/runtime/core/src/ConfigImpl.cpp Fri Jan 12 15:33:46 2007
@@ -0,0 +1,264 @@
+/*
+ * 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::~ConfigImple(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((ConnectionInfo)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_ == NULL ? uri != NULL : strcmp(URI_DEFAULT_, uri) != 0;
+
+ case DATA_OBJECT_MODEL:
+ return DATA_OBJECT_MODEL_DEFAULT_ == NULL ? dataObjectModel != NULL : strcmp(DATA_OBJECT_MODEL_DEFAULT_, dataObjectModel) != 0;
+
+ }
+
+ return DataObjectBase::isSet(propertyIndex);
+
+}
+
+//string ConfigImpl::toString(void) {}
Added: incubator/tuscany/cpp/das/runtime/core/src/ConfigImpl.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/ConfigImpl.h?view=auto&rev=495788
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/ConfigImpl.h (added)
+++ incubator/tuscany/cpp/das/runtime/core/src/ConfigImpl.h Fri Jan 12 15:33:46 2007
@@ -0,0 +1,69 @@
+/*
+ * 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
+
+class ConfigImpl : public DataObjectBase, public Config {
+
+ protected:
+ const static string URI_DEFAULT_ = NULL;
+ const static string DATA_OBJECT_MODEL_DEFAULT_ = NULL;
+
+ list<Command*>* command = NULL;
+ list<Table*>* table = NULL;
+ list<Relationship*>* relationship = NULL;
+ ConnectionInfo* connectionInfo = NULL;
+ string uri = URI_DEFAULT_;
+ string dataObjectModel = DATA_OBJECT_MODEL_DEFAULT_;
+
+ ConfigImpl(void);
+ 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;
+
+ virtual ~ConfigImple(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
\ No newline at end of file
Added: incubator/tuscany/cpp/das/runtime/core/src/ConnectionImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/ConnectionImpl.cpp?view=auto&rev=495788
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/ConnectionImpl.cpp (added)
+++ incubator/tuscany/cpp/das/runtime/core/src/ConnectionImpl.cpp Fri Jan 12 15:33:46 2007
@@ -0,0 +1,136 @@
+/*
+ * 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(HDBC* aConnection) {
+ managingTransaction = true;
+
+ connection = aConnection;
+
+ //try {
+ SQLCHAR sqlDbmsName[255];
+ SQLSMALLINT strLen;
+ SQLGetInfo(connection, SQL_DBMS_NAME, sqlDbmsName, sizeof(sqlDbmsName), &strLen);
+ string dbmsName = sqlDbmsName;
+
+ if (string.find("Oracle") < 0) {
+ boolUseGetGeneratedKeys = false;
+ } else {
+ boolUseGetGeneratedKeys = true;
+ }
+
+ SQLSMALLINT autoCommit;
+ if (SQLGetConnectAttr(connection, SQL_ATTR_AUTOCOMMIT, &autoCommit, sizeof(autoCommit), &strLen) getAutoCommit() == SQL_AUTOCOMMIT_ON) {
+ //throw new RuntimeException("AutoCommit must be off");
+ }
+
+// } catch (SQLException e) {
+ // throw new RuntimeException(e);
+ //}
+
+}
+
+ConnectionImpl::~ConnectionImpl(void) {
+}
+
+Connection* 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");
+ }*/
+
+ SQLPrepare(SQL_HANDLE_DBC, connection, SQL_ROLLBACK);
+
+ }
+
+}
+
+HSTMT* ConnectionImpl::prepareStatement(string queryString, string* returnKeys) {
+
+ /*if (this.logger.isDebugEnabled()) {
+ this.logger.debug("Preparing Statement: " + queryString);
+ }*/
+ HSTMT statement;
+ SQLAllocStmt( connection, &statement);
+
+ if (useGetGeneratedKeys) {
+ SQLPrepare(statement, queryString, SQL_NTS);
+ } else if (returnKeys.length > 0) {
+ SQLPrepare(statement, queryString, SQL_NTS);
+ } else {
+ SQLPrepare(statement, queryString, 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, SQL_CONCUR_READ_ONLY, NULL);
+ SQLSetStmtAttr(connection, SQL_ATTR_CURSOR_SENSITIVITY, SQL_INSENSITIVE, NULL);
+ SQLPrepare(statement, queryString, SQL_NTS);
+
+ return statement;
+
+}
+
+void ConnectionImpl::setManageTransactions(int aManageTransactions) {
+ managingTransaction = aManageTransactions;
+}
+
+HSTMT* ConnectionImpl::prepareCall(string queryString) {
+ HSTMT statement;
+ SQLAllocStmt( connection, &statement);
+ SQLPrepare(statement, queryString, SQL_NTS);
+
+ return statement;
+
+}
+
+bool ConnectionImpl::useGetGeneratedKeys(void) {
+ return boolUseGetGeneratedKeys;
+}
Added: incubator/tuscany/cpp/das/runtime/core/src/ConnectionImpl.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/ConnectionImpl.h?view=auto&rev=495788
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/ConnectionImpl.h (added)
+++ incubator/tuscany/cpp/das/runtime/core/src/ConnectionImpl.h Fri Jan 12 15:33:46 2007
@@ -0,0 +1,53 @@
+/*
+ * 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;
+ bool managingTransaction;
+ bool boolUseGetGeneratedKeys;
+
+ public:
+ ConnectionImpl(HDBC* connection);
+ virtual ~ConnectionImpl(void);
+ HDBC* getODBCConnection(void);
+ void cleanUp(void);
+ void errorCleanUp(void);
+ PreparedStatement* prepareStatement(string queryString, string* returnKeys, int keysCount);
+ PreparedStatement* preparePagedStatement(string queryString);
+ void setManageTransactions(int aManageTransactions);
+ CallableStatement* prepareCall(string queryString);
+ bool useGetGeneratedKeys(void);
+
+};
+
+#endif //CONNECTION_IMPL_H
\ No newline at end of file
Added: incubator/tuscany/cpp/das/runtime/core/src/ConnectionInfo.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/ConnectionInfo.h?view=auto&rev=495788
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/ConnectionInfo.h (added)
+++ incubator/tuscany/cpp/das/runtime/core/src/ConnectionInfo.h Fri Jan 12 15:33:46 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/runtime/core/src/Converter.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/Converter.h?view=auto&rev=495788
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/Converter.h (added)
+++ incubator/tuscany/cpp/das/runtime/core/src/Converter.h Fri Jan 12 15:33:46 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/runtime/core/src/Create.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/Create.h?view=auto&rev=495788
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/Create.h (added)
+++ incubator/tuscany/cpp/das/runtime/core/src/Create.h Fri Jan 12 15:33:46 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
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org