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/02/08 04:57:10 UTC

svn commit: r504778 - in /incubator/tuscany/cpp/das/runtime/core/src/config: ./ Command.h CommandImpl.cpp CommandImpl.h

Author: lresende
Date: Wed Feb  7 19:57:09 2007
New Revision: 504778

URL: http://svn.apache.org/viewvc?view=rev&rev=504778
Log:
Latest patch from Adriano Crestani on C++ DAS

Added:
    incubator/tuscany/cpp/das/runtime/core/src/config/
    incubator/tuscany/cpp/das/runtime/core/src/config/Command.h
    incubator/tuscany/cpp/das/runtime/core/src/config/CommandImpl.cpp
    incubator/tuscany/cpp/das/runtime/core/src/config/CommandImpl.h

Added: incubator/tuscany/cpp/das/runtime/core/src/config/Command.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/config/Command.h?view=auto&rev=504778
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/config/Command.h (added)
+++ incubator/tuscany/cpp/das/runtime/core/src/config/Command.h Wed Feb  7 19:57:09 2007
@@ -0,0 +1,50 @@
+/*
+ * 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_COMMAND_H
+#define CONFIG_COMMAND_H
+
+#include <string>
+#include <list>
+#include <vector>
+
+#include "../Parameter.h"
+#include "../ResultDescriptor.h"
+
+using namespace std;
+
+namespace config {
+
+	virtual class Command {
+
+		public:
+			list<Parameter*>* getParameter(void);
+			vector<ResultDescriptor*>* getResultDescriptor(void);
+			string getName();
+			void setName(string value);
+			string getSQL();
+			void setSQL(string value);
+			string getKind();
+			void setKind(string value);
+
+	};
+
+};
+
+
+#endif //CONFIG_COMMAND_H
\ No newline at end of file

Added: incubator/tuscany/cpp/das/runtime/core/src/config/CommandImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/config/CommandImpl.cpp?view=auto&rev=504778
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/config/CommandImpl.cpp (added)
+++ incubator/tuscany/cpp/das/runtime/core/src/config/CommandImpl.cpp Wed Feb  7 19:57:09 2007
@@ -0,0 +1,71 @@
+/*
+ * 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 "CommandImpl.h"
+
+CommandImpl::CommandImpl(string sqlString) {
+	statement = new 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, DASObject* value) {
+	parameters.setParameter(index, value);
+}
+
+void CommandImpl::addParameter(ParameterImpl* param) {
+	parameters.add(param);
+}
+
+vector<ParameterImpl*>* 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/config/CommandImpl.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/das/runtime/core/src/config/CommandImpl.h?view=auto&rev=504778
==============================================================================
--- incubator/tuscany/cpp/das/runtime/core/src/config/CommandImpl.h (added)
+++ incubator/tuscany/cpp/das/runtime/core/src/config/CommandImpl.h Wed Feb  7 19:57:09 2007
@@ -0,0 +1,84 @@
+/*
+ * 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_COMMAND_IMPL_H
+#define CONFIG_COMMAND_IMPL_H
+
+#include <string>
+#include <list>
+
+#include "../Parameter.h"
+#include "../ResultDescriptor.h"
+#include "../DASObject.h"
+#include "Command.h"
+
+#include "commonj/sdo/Type.h"
+
+using namespace commonj::sdo;
+using namespace std;
+
+namespace config {
+
+	class CommandImpl : public Command {
+
+	protected:
+		const static string NAME_DEFAULT_;
+		const static string SQL_DEFAULT_;
+		const static string KIND_DEFAULT_;
+
+		list<Parameter*>* parameter;
+		list<ResultDescriptor*>* resultDescriptor;
+		string name;
+		string sql;
+		string kind;
+
+		
+
+		public:
+
+			const static int PARAMETER = 0;
+			const static int RESULT_DESCRIPTOR = 1;
+			const static int NAME = 2;
+			const static int SQL = 3;
+			const static int KIND = 4;
+			const static int SDO_PROPERTY_COUNT = 5;
+
+			CommandImpl(void);
+			virtual ~CommandImpl(void);
+			Type* getType(void);
+			list<Parameter*>* getParameter(void);
+			list<ResultDescriptor*>* getResultDescriptor(void);
+			string getName(void);
+			void setName(string newName);
+			string getSQL(void);
+			void setSQL(string newSQL);
+			string getKind(void);
+			void setKind(string newKind);
+			//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_COMMAND_IMPL_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