diff options
Diffstat (limited to '')
7 files changed, 0 insertions, 599 deletions
diff --git a/tags/cpp-0.1.incubating-M1-RC3b/sdo/runtime/core/sdo_axiom/Makefile.am b/tags/cpp-0.1.incubating-M1-RC3b/sdo/runtime/core/sdo_axiom/Makefile.am deleted file mode 100644 index 7339b49e97..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3b/sdo/runtime/core/sdo_axiom/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -SUBDIRS = - -nobase_include_HEADERS = sdo_axiom.h \ -sdo_axiom_export.h - -lib_LTLIBRARIES = libtuscany_sdo_axiom.la -AM_CPPFLAGS = $(CPPFLAGS) - -libtuscany_sdo_axiom_la_SOURCES = \ - sdo_axiom.cpp - -libtuscany_sdo_axiom_la_LIBADD = \ - -L$(top_builddir)/runtime/core/src/commonj/sdo -ltuscany_sdo \ - -L$(AXIS2C_HOME)/lib \ - -laxis2_util \ - -laxis2_axiom \ - -laxis2_parser - -INCLUDES = -I$(top_builddir)/runtime/core/src \ - -I$(top_builddir)/runtime/core/sdo_axiom \ - -I${AXIS2C_HOME}/include -
\ No newline at end of file diff --git a/tags/cpp-0.1.incubating-M1-RC3b/sdo/runtime/core/sdo_axiom/sdo_axiom.cpp b/tags/cpp-0.1.incubating-M1-RC3b/sdo/runtime/core/sdo_axiom/sdo_axiom.cpp deleted file mode 100644 index 0d71d9802e..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3b/sdo/runtime/core/sdo_axiom/sdo_axiom.cpp +++ /dev/null @@ -1,264 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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. - */ - -/* $Rev$ $Date$ */ - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif - -#include "sdo_axiom.h" - -using namespace commonj::sdo; -using namespace std; - - -namespace commonj -{ - namespace sdo_axiom - { - - int AxiomHelper::axiswritercount = 0; - - AxiomHelper* AxiomHelper::getHelper() - { - return new AxiomHelper(); - } - - void AxiomHelper::releaseHelper(AxiomHelper* h) - { - if (h) delete h; - } - - void AxiomHelper::deleteEnv() - { - if (the_env)axis2_env_free(the_env); - } - - void AxiomHelper::createEnv() - { - - the_allocator = axis2_allocator_init (NULL); - if (the_allocator == NULL) return; - - the_env = axis2_env_create(the_allocator); - - if (the_env == 0) return; - - return; - } - - - AxiomHelper::AxiomHelper() - { - createEnv(); - } - - AxiomHelper::~AxiomHelper() - { - deleteEnv(); - } - - - axis2_env_t* AxiomHelper::getEnv() - { - return the_env; - } - - axiom_node_t* AxiomHelper::toAxiomNode(DataObjectPtr dob) - { - - axiom_document_t* doc = toAxiomDoc(dob); - - if (!doc) - { - return 0; - } - - axiom_node_t* root_node = - AXIOM_DOCUMENT_GET_ROOT_ELEMENT(doc, the_env); - if (!root_node) - { - cout << "No Root Element in the document" << endl; - return 0; - } - - - return root_node; - } - - axiom_document_t* AxiomHelper::toAxiomDoc(DataObjectPtr dob) - { - - DataFactory* df = dob->getDataFactory(); - XSDHelperPtr xs = HelperProvider::getXSDHelper(df); - XMLHelperPtr xm = HelperProvider::getXMLHelper(df); - if (!the_env) - { - cout << "No Axis Environment" << endl; - return 0; - } - char * str = - xm->save( - dob, - dob->getType().getURI(), - dob->getType().getName()); - - // if (str) cout << str << endl; - - axiom_xml_reader_t * reader = - axiom_xml_reader_create_for_memory(the_env, - (void*)str, - strlen(str), - (const axis2_char_t *)"UTF-8", - AXIS2_XML_PARSER_TYPE_BUFFER); - - if (!reader) - { - cout << "No Axis Reader" << endl; - return 0; - } - - axiom_stax_builder_t* builder = - axiom_stax_builder_create(the_env, reader); - - if (!builder) - { - cout << "No Axis Builder" << endl; - AXIOM_XML_READER_FREE(reader, the_env); - return 0; - } - - axiom_document_t* document = - AXIOM_STAX_BUILDER_GET_DOCUMENT(builder, the_env); - - if (!document) - { - cout << "No Axis Document" << endl; - AXIOM_STAX_BUILDER_FREE(builder, the_env); - return 0; - } - - axiom_node_t* root_node = - AXIOM_DOCUMENT_GET_ROOT_ELEMENT(document, the_env); - if (!root_node) - { - cout << "No Root Element in the document" << endl; - AXIOM_STAX_BUILDER_FREE(builder, the_env); - return 0; - } - - - AXIOM_DOCUMENT_BUILD_ALL(document, the_env); - - return document; - } - - DataObjectPtr AxiomHelper::toSdo(axiom_document_t* document, - DataFactoryPtr factory) - { - - if (!the_env) - { - cout << "No Axis Environment" << endl; - return 0; - } - - axiom_node_t* root_node = - AXIOM_DOCUMENT_GET_ROOT_ELEMENT(document, the_env); - - return toSdo(root_node,factory); - } - - DataObjectPtr AxiomHelper::toSdo(axiom_node_t* root_node, - DataFactoryPtr factory) - { - - if (!the_env) - { - cout << "No Axis Environment" << endl; - return 0; - } - - XMLHelperPtr helper = HelperProvider::getXMLHelper(factory); - - axiom_xml_writer_t* writer = axiom_xml_writer_create_for_memory( - the_env, NULL, AXIS2_TRUE, 0, - AXIS2_XML_PARSER_TYPE_BUFFER); - - axiom_output_t* output = axiom_output_create(the_env, writer); - - - if (!root_node) - { - cout << "No Root Element in the document" << endl; - AXIOM_OUTPUT_FREE(output, the_env); - return 0; - } - - AXIOM_NODE_SERIALIZE(root_node, the_env, output); - - axis2_char_t* buffer = (axis2_char_t*)AXIOM_XML_WRITER_GET_XML(writer, the_env); - - XMLDocumentPtr theXMLDocument = helper->load(buffer); - - if (theXMLDocument != 0) - { - return theXMLDocument->getRootDataObject(); - } - cout << "The XML document returned from load was zero" << endl; - return 0; - } - - void AxiomHelper::output(axiom_document_t* document) - { - - if (!the_env) - { - cout << "No Axis Environment" << endl; - return; - } - - axiom_xml_writer_t* writer = axiom_xml_writer_create_for_memory( - the_env, NULL, AXIS2_TRUE, 0, - AXIS2_XML_PARSER_TYPE_BUFFER); - - axiom_output_t* output = axiom_output_create(the_env, writer); - - axiom_node_t* root_node = - AXIOM_DOCUMENT_GET_ROOT_ELEMENT(document, the_env); - - if (!root_node) - { - cout << "No Root Element in the document" << endl; - AXIOM_OUTPUT_FREE(output, the_env); - return; - } - - AXIOM_NODE_SERIALIZE(root_node, the_env, output); - - axis2_char_t* buffer = (axis2_char_t*)AXIOM_XML_WRITER_GET_XML(writer, the_env); - - printf("Output XML:n %s ", buffer); - - AXIOM_OUTPUT_FREE(output, the_env); - - return; - } - } -} - diff --git a/tags/cpp-0.1.incubating-M1-RC3b/sdo/runtime/core/sdo_axiom/sdo_axiom.h b/tags/cpp-0.1.incubating-M1-RC3b/sdo/runtime/core/sdo_axiom/sdo_axiom.h deleted file mode 100644 index 631c1c9437..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3b/sdo/runtime/core/sdo_axiom/sdo_axiom.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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. - */ - -/* $Rev$ $Date$ */ - -#ifndef _SDO_AXIOM_H_ -#define _SDO_AXIOM_H_ - -#include "sdo_axiom_export.h" - -#include "axiom.h" -//#include "axis2_om_document.h" -//#include "axis2_om_stax_builder.h" - - -#include "commonj/sdo/SDO.h" - -using namespace commonj::sdo; - -namespace commonj -{ - namespace sdo_axiom - { - -/** - * AxiomHelper writes a data object tree to XML - */ - class AxiomHelper - { - - public: - - SDO_AXIOM_API AxiomHelper(); - - SDO_AXIOM_API virtual ~AxiomHelper(); - - SDO_AXIOM_API static AxiomHelper* getHelper(); - - SDO_AXIOM_API static void releaseHelper(AxiomHelper* ax); - - SDO_AXIOM_API axiom_document_t* toAxiomDoc(DataObjectPtr dob); - SDO_AXIOM_API axiom_node_t* toAxiomNode(DataObjectPtr dob); - - SDO_AXIOM_API DataObjectPtr toSdo(axiom_document_t* doc,DataFactoryPtr factory); - SDO_AXIOM_API DataObjectPtr toSdo(axiom_node_t* root_node,DataFactoryPtr factory); - - SDO_AXIOM_API axis2_env_t* getEnv(); - - SDO_AXIOM_API void output(axiom_document_t* document); - - - protected: - private: - - void deleteEnv(); - - void createEnv(); - - static int axiswritercount; - - axis2_env_t *the_env; - axis2_allocator_t *the_allocator; - - - - }; - } // End - namespace sdo_axiom -} // End - namespace commonj - - -#endif //_SDO_AXIOM_H_ diff --git a/tags/cpp-0.1.incubating-M1-RC3b/sdo/runtime/core/sdo_axiom/sdo_axiom_export.h b/tags/cpp-0.1.incubating-M1-RC3b/sdo/runtime/core/sdo_axiom/sdo_axiom_export.h deleted file mode 100644 index 70d6b813f7..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3b/sdo/runtime/core/sdo_axiom/sdo_axiom_export.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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. - */ - -/* $Rev$ $Date$ */ - - -#ifdef WIN32 - -#ifdef SDO_AXIOM_EXPORTS -# define SDO_AXIOM_API __declspec(dllexport) -# define SDO_AXIOM_EXPIMP -#else -# define SDO_AXIOM_API __declspec(dllimport) -# define SDO_AXIOM_EXPIMP extern -#endif - -#else - -# define SDO_AXIOM_API -# define SDO_AXIOM_EXPIMP - -#endif - diff --git a/tags/cpp-0.1.incubating-M1-RC3b/sdo/runtime/core/sdo_axiom_test/Makefile.am b/tags/cpp-0.1.incubating-M1-RC3b/sdo/runtime/core/sdo_axiom_test/Makefile.am deleted file mode 100644 index 69acb6e9da..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3b/sdo/runtime/core/sdo_axiom_test/Makefile.am +++ /dev/null @@ -1,23 +0,0 @@ -prgbindir=$(prefix)/bin/test -prgbin_PROGRAMS = tuscany_sdo_axiom_test -SUBDIRS = -AM_CPPFLAGS = $(CPPFLAGS) -tuscany_sdo_axiom_test_SOURCES = sdo_axiom_test.cpp - -noinst_HEADERS=*.h - -tuscany_sdo_axiom_test_LDADD = \ - -L$(top_builddir)/runtime/core/src/commonj/sdo -ltuscany_sdo \ - -L$(top_builddir)/runtime/core/sdo_axiom -ltuscany_sdo_axiom \ - -L${LIBXML2_LIB} -lxml2 \ - -L$(AXIS2C_HOME)/lib \ - -laxis2_util \ - -laxis2_axiom \ - -laxis2_parser \ - -laxis2_minizip - -INCLUDES = -I$(top_builddir)/runtime/core/sdo_axiom_test \ - -I$(top_builddir)/runtime/core/src \ - -I$(top_builddir)/runtime/core/sdo_axiom \ - -I${AXIS2C_HOME}/include -
\ No newline at end of file diff --git a/tags/cpp-0.1.incubating-M1-RC3b/sdo/runtime/core/sdo_axiom_test/sdo_axiom_test.cpp b/tags/cpp-0.1.incubating-M1-RC3b/sdo/runtime/core/sdo_axiom_test/sdo_axiom_test.cpp deleted file mode 100644 index 31d4e2b029..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3b/sdo/runtime/core/sdo_axiom_test/sdo_axiom_test.cpp +++ /dev/null @@ -1,132 +0,0 @@ -/* - * - * Copyright 2006 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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. - */ - -/* $Id: main.cpp,v 1.1 2006/03/16 10:54:16 slattery Exp $ */ - -#include <stdio.h> - -#pragma warning(disable:4786) - -#include <iostream> - -#include "sdo_axiom_test.h" - - -void axiomtest::axiom_test() -{ - - DataFactoryPtr mdg = DataFactory::getDataFactory(); - - mdg->addType("myspace","Company"); - - mdg->addType("myspace","Department"); - - mdg->addType("myspace","Employee"); - - mdg->addPropertyToType("myspace","Company","name", - "commonj.sdo","String", false, false, false); - - mdg->addPropertyToType("myspace","Company","norbert", - "commonj.sdo","String", false, false, false); - - mdg->addPropertyToType("myspace","Company","departments", - "myspace","Department", true, false, true); - - mdg->addPropertyToType("myspace","Department","name", - "commonj.sdo","String", false, false, false); - - mdg->addPropertyToType("myspace","Department","employees", - "myspace","Employee", true, false, true); - - mdg->addPropertyToType("myspace","Employee","name", - "commonj.sdo","String", false, false, false); - - const Type& tcc = mdg->getType("myspace","Company"); - - DataObjectPtr company = mdg->create((Type&)tcc); - company->setCString("name","The VDB Company Inc"); - company->setCString("norbert","Spandex Courvette"); - - - DataObjectPtr dept1 = company->createDataObject("departments"); - dept1->setCString("name","Accounts"); - - DataObjectPtr dept2 = company->createDataObject("departments"); - dept2->setCString("name","Billing"); - - DataObjectPtr emp1 = dept1->createDataObject("employees"); - emp1->setCString("name","Albert"); - - DataObjectPtr emp2 = dept1->createDataObject("employees"); - emp2->setCString("name","Ben"); - - DataObjectPtr emp3 = dept2->createDataObject("employees"); - emp3->setCString("name","Cyril"); - - DataObjectPtr emp4 = dept2->createDataObject("employees"); - emp4->setCString("name","Dominic"); - - AxiomHelper* ax = AxiomHelper::getHelper(); - - if (ax) - { - axiom_document_t* doc = ax->toAxiomDoc(company); - - if (doc) - { - ax->output(doc); - - DataObjectPtr newdob = ax->toSdo(doc,mdg); - - if (newdob) - { - cout << "Printing first data object..." << endl; - SDOUtils::printDataObject(cout,newdob); - cout << "Finished" << endl; - } - - axiom_node_t* node = - AXIOM_DOCUMENT_GET_ROOT_ELEMENT(doc, ax->getEnv()); - - - DataObjectPtr newdob2 = ax->toSdo(node,mdg); - - if (newdob2) - { - cout << "Printing second data object..." << endl; - SDOUtils::printDataObject(cout,newdob2); - cout << "Finished" << endl; - } - - - } - - } - - return; - -} - -extern "C"{ - -int main (int argc, char** argv) -{ - axiomtest::axiom_test(); - return 0; -} - -} diff --git a/tags/cpp-0.1.incubating-M1-RC3b/sdo/runtime/core/sdo_axiom_test/sdo_axiom_test.h b/tags/cpp-0.1.incubating-M1-RC3b/sdo/runtime/core/sdo_axiom_test/sdo_axiom_test.h deleted file mode 100644 index d4756546b7..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3b/sdo/runtime/core/sdo_axiom_test/sdo_axiom_test.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * - * Copyright 2006 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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. - */ - -/* $Id: sdotest.h,v 1.21 2006/03/16 12:21:04 slattery Exp $ */ - -#include "sdo_axiom.h" -#include "commonj/sdo/SDO.h" - - -using namespace commonj::sdo; -using namespace commonj::sdo_axiom; -using namespace std; - - - -// test - -class axiomtest { - public: - - static void axiom_test(); -}; |