diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-30 08:36:59 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-30 08:36:59 +0000 |
commit | 0b9d0491fe4fb19c8d2f269c805d0b022ca157f4 (patch) | |
tree | 4c7a7cc35ad96f6a412eca9a1089ed0120ad2039 /sca-cpp/trunk/contrib/tools | |
parent | ff124040623879bc48a0ba5cf06a841642adef53 (diff) |
More build improvements, added a configure option to turn on debugging and profiling, fixed compile and link options to support multithreading where applicable, moved non-building tools to contrib, and adjusted the top readmes and build instructions.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@885350 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/contrib/tools')
4 files changed, 762 insertions, 0 deletions
diff --git a/sca-cpp/trunk/contrib/tools/Makefile.am b/sca-cpp/trunk/contrib/tools/Makefile.am new file mode 100644 index 0000000000..de5c2d1b1e --- /dev/null +++ b/sca-cpp/trunk/contrib/tools/Makefile.am @@ -0,0 +1,17 @@ +# 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. + diff --git a/sca-cpp/trunk/contrib/tools/TuscanyDriver/TuscanyServiceLoader.cpp b/sca-cpp/trunk/contrib/tools/TuscanyDriver/TuscanyServiceLoader.cpp new file mode 100644 index 0000000000..2abdc16c28 --- /dev/null +++ b/sca-cpp/trunk/contrib/tools/TuscanyDriver/TuscanyServiceLoader.cpp @@ -0,0 +1,478 @@ +/* + * 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. + */ + +/* $Rev$ $Date$ */ + +#include <iostream> +#include <string> +#include <sstream> +#include <list> + +#include <tuscany/sca/core/SCARuntime.h> +#include <tuscany/sca/core/Exceptions.h> + +#include <tuscany/sca/model/Composite.h> +#include <tuscany/sca/model/CompositeReference.h> +#include <tuscany/sca/model/CompositeService.h> +#include <tuscany/sca/model/Component.h> +#include <tuscany/sca/model/Binding.h> +#include <tuscany/sca/model/Service.h> +#include <tuscany/sca/model/ServiceType.h> +#include <tuscany/sca/model/WSDLDefinition.h> +#include <tuscany/sca/model/WSDLOperation.h> +#include <tuscany/sca/model/WSDLMessagePart.h> + +#include <commonj/sdo/SDORuntimeException.h> + +#include "TuscanyServiceLoader.h" + +namespace tuscany +{ + namespace sca + { + namespace toys + { + + TuscanyServiceLoader::TuscanyServiceLoader( const std::string &installRoot, + const std::string &systemRoot, + const std::string &systemPath, + const std::string &baseURI, + const std::string &defaultComponent, + bool showModel, // defaults false + bool showWsdl ) : // defaults false + tuscanyRuntime_(0), + tuscanyInstallRoot_(installRoot), + tuscanySystemRoot_(systemRoot), + tuscanySystemPath_(systemPath), + tuscanyBaseURI_(baseURI), + tuscanyDefaultComponent_(defaultComponent), + showModel_(showModel), + showWsdl_(showWsdl) + { + } + + TuscanyServiceLoader::~TuscanyServiceLoader() + { + } + + void TuscanyServiceLoader::load( ) + { + try + { + tuscanyRuntime_ = + tuscany::sca::SCARuntime::initializeSharedRuntime( + tuscanyInstallRoot_, + tuscanySystemRoot_, + tuscanySystemPath_, + tuscanyBaseURI_, + tuscanyDefaultComponent_ ); + + tuscany::sca::model::Composite* systemComposite = tuscanyRuntime_->getSystem(); + + // The system composite shouldnt ever have WSDL namespaces defined on it, + // Its basically a container of included composites + + // + // Iterate through the System included composites + // + std::list<std::string> compositeNameList = systemComposite->getIncludedComposites(); + + if( compositeNameList.empty() ) + { + log( "The SCARuntime system composite has no included composites.", DATA_BOTH ); + } + + std::stringstream logMsg; + + std::list<std::string>::const_iterator cNameIter = compositeNameList.begin(); + std::list<std::string>::const_iterator cNameIterEnd = compositeNameList.end(); + + // Iterate through the Composites included in the System Composite + for( ; cNameIter != cNameIterEnd; ++cNameIter ) + { + tuscany::sca::model::Composite *includedComposite = + systemComposite->findIncludedComposite( *cNameIter ); + + if( 0 == includedComposite ) + { + logMsg << "Skipping NULL System Included composite: " << *cNameIter; + log( logMsg, DATA_BOTH ); + + continue; + } + + logMsg << "System Included composite: " << includedComposite->getName(); + log( logMsg, DATA_BOTH ); + + if( showWsdl_ ) + { + log( "WSDL Data:", DATA_WSDL ); + getOperationsFromComposite( includedComposite ); + } + + if( showModel_ ) + { + log( "MODEL Data:", DATA_WSDL ); + getComponentsFromComposite( includedComposite ); + } + + log( "\nServices loaded correctly.\n", DATA_BOTH ); + } + } + catch (const tuscany::sca::TuscanyRuntimeException &tuscanyE) + { + std::cerr << "Tuscany Runtime Exception: " << tuscanyE.getMessageText() << std::endl; + } + catch (const commonj::sdo::SDORuntimeException &sdoE) + { + std::cerr << "SDO Runtime Exception: " << sdoE.getMessageText() << std::endl; + } + catch (const std::exception &stdE) + { + std::cerr << "Standard Exception: " << stdE.what() << std::endl; + } + } + + // private + void TuscanyServiceLoader::getOperationsFromComposite( tuscany::sca::model::Composite *composite ) + { + std::stringstream logMsg; + + std::list<std::string> namespaceList = composite->getWSDLNamespaces(); + if( namespaceList.empty() ) + { + logMsg << "Composite has no WSDLs to process: " << composite->getName(); + log( logMsg, DATA_WSDL ); + + return; + } + + std::list<std::string>::const_iterator nsIter = namespaceList.begin(); + std::list<std::string>::const_iterator nsIterEnd = namespaceList.end(); + + // Iterate through the composite namespaces + for( ; nsIter != nsIterEnd; ++nsIter ) + { + tuscany::sca::model::WSDLDefinition *wsdlDef = composite->findWSDLDefinition( *nsIter ); + if( 0 == wsdlDef ) + { + logMsg << "Skipping NULL WSDLDefinition for WSDL namespace: " << *nsIter; + log( logMsg, DATA_WSDL ); + + continue; + } + + logMsg << "\t WSDL namespace: " << *nsIter; + log( logMsg, DATA_WSDL ); + + std::list<std::string> ptNameList = wsdlDef->getPortTypes(); + if( ptNameList.empty() ) + { + log( "Skipping WSDLDefinition with no PortTypes defined", DATA_WSDL ); + + continue; + } + + std::list<std::string>::const_iterator ptIter = ptNameList.begin(); + std::list<std::string>::const_iterator ptIterEnd = ptNameList.end(); + + // Iterate through the PortTypes in the WSDLDefinition + for( ; ptIter != ptIterEnd; ++ptIter ) + { + logMsg << "\t\t PortType: " << *ptIter; + log( logMsg, DATA_WSDL ); + + std::list<std::string> operNameList = wsdlDef->getOperations( *ptIter ); + if( operNameList.empty() ) + { + log( "Skipping WSDL PortType with no operations defined", DATA_WSDL ); + + continue; + } + + std::list<std::string>::const_iterator operNameIter = operNameList.begin(); + std::list<std::string>::const_iterator operNameIterEnd = operNameList.end(); + + // Iterate through the Operations in the PortType + for( ; operNameIter != operNameIterEnd; ++operNameIter ) + { + const tuscany::sca::model::WSDLOperation &wsdlOper = + wsdlDef->findOperation( *ptIter, *operNameIter ); + + logMsg + << "\t\t\t Operation Info: " + << "\n\t\t\t\t OperationName: " << wsdlOper.getOperationName() + << "\n\t\t\t\t SOAP Action: " << wsdlOper.getSoapAction() + << "\n\t\t\t\t Endpoint: " << wsdlOper.getEndpoint() + << "\n\t\t\t\t SOAP version: " << wsdlOper.getSoapVersion() + << "\n\t\t\t\t Document Style: " << wsdlOper.isDocumentStyle() + << "\n\t\t\t\t Wrapped Style: " << wsdlOper.isWrappedStyle() + << "\n\t\t\t\t In Encoded Style: " << wsdlOper.isInputEncoded() + << "\n\t\t\t\t Out Encoded Style: " << wsdlOper.isOutputEncoded() + << "\n\t\t\t\t InputMsgURI: " << wsdlOper.getInputMessageUri() + << "\n\t\t\t\t InputMsgName: " << wsdlOper.getInputMessageName() + << "\n\t\t\t\t OutputMsgURI: " << wsdlOper.getOutputMessageUri() + << "\n\t\t\t\t OutputMsgName: " << wsdlOper.getOutputMessageName(); + log( logMsg, DATA_WSDL ); + + std::list<std::string> partList = wsdlOper.getInputMessagePartNames(); + std::list<std::string>::const_iterator partListIter = partList.begin(); + std::list<std::string>::const_iterator partListIterEnd = partList.end(); + for( ; partListIter != partListIterEnd; ++partListIter ) + { + tuscany::sca::model::WSDLMessagePart part = + wsdlOper.getInputMessagePart( *partListIter ); + logMsg + << "\t\t\t\t Input Message Part: " + << "\n\t\t\t\t\t Name: " << part.getPartName() + << "\n\t\t\t\t\t Type: " << part.getPartType() + << "\n\t\t\t\t\t URI: " << part.getPartUri(); + log( logMsg, DATA_WSDL ); + } + + partList = wsdlOper.getOutputMessagePartNames(); + partListIter = partList.begin(); + partListIterEnd = partList.end(); + for( ; partListIter != partListIterEnd; ++partListIter ) + { + tuscany::sca::model::WSDLMessagePart part = + wsdlOper.getOutputMessagePart( *partListIter ); + logMsg + << "\t\t\t\t Output Message Part: " + << "\n\t\t\t\t\t Name: " << part.getPartName() + << "\n\t\t\t\t\t Type: " << part.getPartType() + << "\n\t\t\t\t\t URI: " << part.getPartUri(); + log( logMsg, DATA_WSDL ); + } + } + } + } + } + + // private + void TuscanyServiceLoader::getComponentsFromComposite( tuscany::sca::model::Composite *composite ) + { + std::stringstream logMsg; + + std::list<std::string> topLevelComponentList = composite->getComponents(); + if( topLevelComponentList.empty() ) + { + logMsg << "Top level Composite has no Components to process: " << composite->getName(); + log( logMsg, DATA_MODEL ); + + return; + } + + std::list<std::string>::const_iterator tlclIter = topLevelComponentList.begin(); + std::list<std::string>::const_iterator tlclIterEnd = topLevelComponentList.end(); + + // Iterate through the top level composite components + for( ; tlclIter != tlclIterEnd; ++tlclIter ) + { + tuscany::sca::model::Component *topLevelComponent = composite->findComponent( *tlclIter ); + if( 0 == topLevelComponent ) + { + logMsg << "Skipping NULL Component: " << *tlclIter; + log( logMsg, DATA_MODEL ); + + continue; + } + + logMsg << "\t Top Level Component: " << topLevelComponent->getName(); + log( logMsg, DATA_MODEL ); + + // Top level composites will just include lower composites + // Get the actual implementation composite + tuscany::sca::model::Composite *impComposite = + (tuscany::sca::model::Composite*)topLevelComponent->getType(); + if( 0 == impComposite ) + { + logMsg << "Couldn't get implemetation composite for top level component: " << *tlclIter; + log( logMsg, DATA_MODEL ); + + continue; + } + + logMsg << "\t\t Implemetation Composite: " << topLevelComponent->getName(); + log( logMsg, DATA_MODEL ); + + std::list<std::string> componentList = impComposite->getComponents(); + if( componentList.empty() ) + { + log( "\t\t Implemetation Composite has no components", DATA_MODEL ); + + continue; + } + + std::list<std::string>::const_iterator clIter = componentList.begin(); + std::list<std::string>::const_iterator clIterEnd = componentList.end(); + + // Iterate through the components + for( ; clIter != clIterEnd; ++clIter ) + { + + tuscany::sca::model::Component *component = impComposite->findComponent( *clIter ); + if( 0 == component ) + { + logMsg << "Skipping NULL Component: " << *clIter; + log( logMsg, DATA_MODEL ); + + continue; + } + + std::string bindingType; + std::string bindingURI; + std::string componentType = "\t\t\t Component: "; + + tuscany::sca::model::CompositeService *compositeService = + dynamic_cast<tuscany::sca::model::CompositeService*>(component); + if (compositeService) + { + componentType = "\t\t\t Service: "; + tuscany::sca::model::Reference *reference = compositeService->getReference(); + bindingType = reference->getBinding()->getType(); + bindingURI = reference->getBinding()->getURI(); + } + else + { + tuscany::sca::model::CompositeReference *compositeReference = + dynamic_cast<tuscany::sca::model::CompositeReference*>(component); + if (compositeReference) + { + componentType = "\t\t\t Reference: "; + tuscany::sca::model::Service *service = compositeReference->getService(); + bindingType = service->getBinding()->getType(); + bindingURI = service->getBinding()->getURI(); + + } + } + + logMsg << componentType << component->getName(); + log( logMsg, DATA_MODEL ); + logMsg << "\t\t\t\t Component Type: " << component->getType()->getName(); + log( logMsg, DATA_MODEL ); + + if (!bindingType.empty()) + { + logMsg << "\t\t\t\t Binding Type: " << bindingType; + log( logMsg, DATA_MODEL ); + } + if (!bindingURI.empty()) + { + logMsg << "\t\t\t\t Binding URI: " << bindingURI; + log( logMsg, DATA_MODEL ); + } + + const tuscany::sca::model::Component::SERVICE_MAP &serviceMap = component->getServices(); + if( serviceMap.empty() ) + { + + continue; + } + + tuscany::sca::model::Component::SERVICE_MAP::const_iterator smIter = serviceMap.begin(); + tuscany::sca::model::Component::SERVICE_MAP::const_iterator smIterEnd = serviceMap.end(); + + for( ; smIter != smIterEnd; ++smIter ) + { + const tuscany::sca::model::Service *service = smIter->second; + + if( 0 == service ) + { + logMsg << "Skipping NULL Service: " << smIter->second; + log( logMsg, DATA_MODEL ); + + continue; + } + + // A ServiceType defines the characteristics of the Service + tuscany::sca::model::ServiceType *serviceType = service->getType(); + logMsg << "\t\t\t\t Service: " << serviceType->getName(); + log( logMsg, DATA_MODEL ); + } + + const tuscany::sca::model::Component::REFERENCE_MAP &referenceMap = component->getReferences(); + if( referenceMap.empty() ) + { + continue; + } + + tuscany::sca::model::Component::REFERENCE_MAP::const_iterator rmIter = referenceMap.begin(); + tuscany::sca::model::Component::REFERENCE_MAP::const_iterator rmIterEnd = referenceMap.end(); + + for( ; rmIter != rmIterEnd; ++rmIter ) + { + const tuscany::sca::model::Reference *reference = rmIter->second; + + if( 0 == reference ) + { + logMsg << "Skipping NULL Reference: " << rmIter->second; + log( logMsg, DATA_MODEL ); + + continue; + } + + // A ReferenceType defines the characteristics of the Service + logMsg << "\t\t\t\t Reference: " << reference->getType()->getName(); + log( logMsg, DATA_MODEL ); + + } + } + } + } + + // private + void TuscanyServiceLoader::log( std::stringstream &msg, TuscanyServiceLoader::DataType type ) + { + log( msg.str(), type ); + msg.str( "" ); // clear it to be able to use the same one again + } + + // private + void TuscanyServiceLoader::log( const std::string &msg, TuscanyServiceLoader::DataType type ) + { + bool doLog = false; + + if( type == DATA_BOTH ) + { + doLog = true; + } + else if( type == DATA_BOTH && (showModel_ || showWsdl_) ) + { + doLog = true; + } + else if( type == DATA_WSDL && showWsdl_ ) + { + doLog = true; + } + else if( type == DATA_MODEL && showModel_ ) + { + doLog = true; + } + + if( doLog ) + { + std::cout << msg << std::endl; + } + + } + + } // namespace toys + } // namespace sca +} // namespace tuscany diff --git a/sca-cpp/trunk/contrib/tools/TuscanyDriver/TuscanyServiceLoader.h b/sca-cpp/trunk/contrib/tools/TuscanyDriver/TuscanyServiceLoader.h new file mode 100644 index 0000000000..de35c38119 --- /dev/null +++ b/sca-cpp/trunk/contrib/tools/TuscanyDriver/TuscanyServiceLoader.h @@ -0,0 +1,86 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* $Rev$ $Date$ */ + +#ifndef tuscany_sca_toys_service_loader_h +#define tuscany_sca_toys_service_loader_h + +#include <string> +#include <sstream> + +#include <tuscany/sca/core/SCARuntime.h> +#include <tuscany/sca/model/Composite.h> + + +namespace tuscany +{ + namespace sca + { + namespace toys + { + class TuscanyServiceLoader + { + public: + TuscanyServiceLoader( const std::string &installRoot, + const std::string &systemRoot, + const std::string &systemPath, + const std::string &baseURI, + const std::string &defaultComponentName, + bool showModel = false, + bool showWsdl = false ); + + ~TuscanyServiceLoader(); + + void load(); + + private: + enum DataType + { + DATA_WSDL = 0, + DATA_MODEL, + DATA_BOTH + }; + + TuscanyServiceLoader(); + + void log( std::stringstream &msg, TuscanyServiceLoader::DataType type ); + void log( const std::string &msg, TuscanyServiceLoader::DataType type ); + void getOperationsFromComposite( tuscany::sca::model::Composite *composite ); + void getComponentsFromComposite( tuscany::sca::model::Composite *composite ); + + tuscany::sca::SCARuntime *tuscanyRuntime_; + + bool showModel_; + bool showWsdl_; + std::string tuscanyInstallRoot_; + std::string tuscanySystemRoot_; + std::string tuscanySystemPath_; + std::string tuscanyBaseURI_; + std::string tuscanyDefaultComponent_; + }; + + } // namespace toys + + } // namespace sca + +} // namespace tuscany + +#endif // tuscany_sca_toys_service_loader_h + diff --git a/sca-cpp/trunk/contrib/tools/TuscanyDriver/main.cpp b/sca-cpp/trunk/contrib/tools/TuscanyDriver/main.cpp new file mode 100644 index 0000000000..7fdde27177 --- /dev/null +++ b/sca-cpp/trunk/contrib/tools/TuscanyDriver/main.cpp @@ -0,0 +1,181 @@ +/* + * 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. + */ + +/* $Rev$ $Date$ */ + +#include <iostream> +#include <string> + +#include <tuscany/sca/core/Exceptions.h> +#include <commonj/sdo/SDORuntimeException.h> + +#include "TuscanyServiceLoader.h" + +struct InputArgs +{ + std::string installRoot_; + std::string systemRoot_; + std::string systemPath_; + std::string baseURI_; + std::string defaultComponentName_; + bool showWsdl_; + bool showModel_; + + InputArgs() : + showWsdl_(false), + showModel_(false) + {} +}; + +const std::string ARG_INSTALL_ROOT = "-ir"; +const std::string ARG_SYSTEM_ROOT = "-sr"; +const std::string ARG_SYSTEM_PATH = "-sp"; +const std::string ARG_BASE_URI = "-uri"; +const std::string ARG_DEFAULT_COMPONENT = "-dc"; +const std::string ARG_VERBOSE = "-v"; +const std::string ARG_SHOW_MODEL = "-model"; +const std::string ARG_SHOW_WSDL = "-wsdl"; +const std::string ARG_HELP_H = "-h"; +const std::string ARG_HELP_HELP = "-help"; +const std::string ARG_HELP_QMARK = "-?"; + + +void +printUsage() +{ + std::cout + << "\nUsage\ntuscanyDriver\n\t" + << ARG_INSTALL_ROOT << " Mandatory: Installation root where extensions are located: ${TUSCANY_SCACPP}\n\t" + << ARG_SYSTEM_ROOT << " Mandatory: System root where projects are located: ${TUSCANY_SCACPP}/samples\n\t" + << ARG_SYSTEM_PATH << " Optional: System path\n\t" + << ARG_BASE_URI << " Optional: Base URI\n\t" + << ARG_DEFAULT_COMPONENT << " Optional: Default Component name\n\t" + << ARG_SHOW_MODEL << " Optional: Display SCA Model Hierarchy\n\t" + << ARG_SHOW_WSDL << " Optional: Display WSDL information\n\t" + << ARG_VERBOSE << " Optional: Same as specifying both: " + << ARG_SHOW_MODEL << " and " << ARG_SHOW_WSDL + << std::endl; +} + +bool +parseArgs( int argc, char *argv[], InputArgs &input ) +{ + if( argc < 5 ) + { + std::cerr << "\nInvalid number of input arguments: " << argc << std::endl; + printUsage(); + return false; + } + + for( int i = 1; i < argc; i++ ) + { + if( argv[i] == ARG_INSTALL_ROOT ) + { + input.installRoot_ = argv[++i]; + } + else if( argv[i] == ARG_SYSTEM_ROOT ) + { + input.systemRoot_ = argv[++i]; + } + else if( argv[i] == ARG_SYSTEM_PATH ) + { + input.systemPath_ = argv[++i]; + } + else if( argv[i] == ARG_BASE_URI ) + { + input.baseURI_ = argv[++i]; + } + else if( argv[i] == ARG_DEFAULT_COMPONENT ) + { + input.defaultComponentName_ = argv[++i]; + } + else if( argv[i] == ARG_VERBOSE ) + { + input.showWsdl_ = true; + input.showModel_ = true; + } + else if( argv[i] == ARG_SHOW_MODEL ) + { + input.showModel_ = true; + } + else if( argv[i] == ARG_SHOW_WSDL ) + { + input.showWsdl_ = true; + } + else if( argv[i] == ARG_HELP_H || + argv[i] == ARG_HELP_QMARK || + argv[i] == ARG_HELP_HELP ) + { + printUsage(); + return false; + } + else + { + std::cerr << "\nUnrecognized argument: " << argv[i]; + printUsage(); + return false; + } + } + + if( input.installRoot_.empty() ) + { + std::cerr << "\nMissing mandatory argument: Install root " << ARG_INSTALL_ROOT << std::endl; + return false; + } + + if( input.systemRoot_.empty() ) + { + std::cerr << "\nMissing mandatory argument: System root " << ARG_SYSTEM_ROOT << std::endl; + return false; + } + + return true; +} + +int +main(int argc, char* argv[]) +{ + try + { + InputArgs input; + if( ! parseArgs( argc, argv, input ) ) + { + return 1; + } + + tuscany::sca::toys::TuscanyServiceLoader + tuscany( input.installRoot_, + input.systemRoot_, + input.systemPath_, + input.baseURI_, + input.defaultComponentName_, + input.showModel_, + input.showWsdl_ ); + + tuscany.load( ); + } + catch (...) + { + std::cerr << "Caught unknown exception." << std::endl; + return 1; + } + + return 0; +} + |