You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ro...@apache.org on 2003/10/11 08:12:16 UTC

cvs commit: ws-axis/c/src/server/web_services/cpp_deployment_wrapper CPP_Deployment.cpp CPP_DeploymentWrapper.cpp CPP_DeploymentWrapper.h

roshan      2003/10/10 23:12:16

  Added:       c/src/server/web_services/cpp_deployment CPP_Deployment.h
                        CPP_Deployment.cpp
               c/src/server/web_services/cpp_deployment_wrapper
                        CPP_Deployment.cpp CPP_DeploymentWrapper.cpp
                        CPP_DeploymentWrapper.h
  Log:
  wfiles for the deployment tool
  
  Revision  Changes    Path
  1.1                  ws-axis/c/src/server/web_services/cpp_deployment/CPP_Deployment.h
  
  Index: CPP_Deployment.h
  ===================================================================
  /* -*- C++ -*- */
  
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "SOAP" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   *
   *
   *
   * @author Roshan Weerasuriya (roshan@jkcs.slt.lk, roshan@opensource.lk)
   *
   */
  
  // CPP_Deployment.h: interface for the CPP_Deployment class.
  //
  //////////////////////////////////////////////////////////////////////
  
  #if !defined(AFX_DEPLOYMENT_H__176C6B0A_CBF3_416E_B078_D47637447135__INCLUDED_)
  #define AFX_DEPLOYMENT_H__176C6B0A_CBF3_416E_B078_D47637447135__INCLUDED_
  
  #if _MSC_VER > 1000
  #pragma once
  #endif // _MSC_VER > 1000
  
  #include <common/GDefine.h>
  #include <string>
  #include <list>
  
  using namespace std;
  
  typedef struct Axis_String_ArrayTag
  {
  	string* m_Array;
  	int m_Size;
  } Axis_String_Array;
  
  class CPP_Deployment
  {
  public:
  	int deploy(string sServiceName, string sDllPath, Axis_String_Array sAllowedMethods);
  	CPP_Deployment();
  	virtual ~CPP_Deployment();
  
  };
  
  #endif // !defined(AFX_DEPLOYMENT_H__176C6B0A_CBF3_416E_B078_D47637447135__INCLUDED_)
  
  
  
  1.1                  ws-axis/c/src/server/web_services/cpp_deployment/CPP_Deployment.cpp
  
  Index: CPP_Deployment.cpp
  ===================================================================
  /* -*- C++ -*- */
  
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "SOAP" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   *
   *
   *
   * @author Roshan Weerasuriya (roshan@jkcs.slt.lk, roshan@opensource.lk)
   *
   */
  
  // CPP_Deployment.cpp: implementation of the CPP_Deployment class.
  //
  //////////////////////////////////////////////////////////////////////
  
  #include "CPP_Deployment.h"
  #include <iostream>
  
  //////////////////////////////////////////////////////////////////////
  // Construction/Destruction
  //////////////////////////////////////////////////////////////////////
  
  CPP_Deployment::CPP_Deployment()
  {
  
  }
  
  CPP_Deployment::~CPP_Deployment()
  {
  
  }
  
  int CPP_Deployment::deploy(string sServiceName, string sDllPath, Axis_String_Array sAllowedMethods)
  {
  	printf("hi I am in the deploy method\n");
  	printf("added right now\n");
  	printf("asServiceName = %s\n", sServiceName.c_str());
  	printf("asDllPath = %s\n", sDllPath.c_str());
  
  	
  	string* itAllowedMethods = sAllowedMethods.m_Array;
  
  	for (int i=0; i<sAllowedMethods.m_Size; i++ ) {
  		printf("Allowed method = %s\n", "(itAllowedMethods[i]).c_str()");
  		cout<<": = "<<itAllowedMethods[i]<<endl;
  		i++;
  	}
  	
  	return SUCCESS;
  }
  
  
  
  1.1                  ws-axis/c/src/server/web_services/cpp_deployment_wrapper/CPP_Deployment.cpp
  
  Index: CPP_Deployment.cpp
  ===================================================================
  /* -*- C++ -*- */
  
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "SOAP" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   *
   *
   *
   * @author Roshan Weerasuriya (roshan@jkcs.slt.lk, roshan@opensource.lk)
   *
   */
  
  //This file is automatically generated by the Axis C++ Wrapper Class Generator
  //Service file containing the two export functions of the Web service Library
  #ifdef WIN32
  #define STORAGE_CLASS_INFO __declspec(dllexport)
  #else
  #define STORAGE_CLASS_INFO 
  #endif
  
  #include "CPP_DeploymentWrapper.h"
  
  extern "C" {
  
  STORAGE_CLASS_INFO
  int GetClassInstance(BasicHandler **inst)
  {
  	WrapperClassHandler* pWCH = new CPP_DeploymentWrapper();
  	if (pWCH) 
  	{
  		pWCH->Init();
  		*inst = pWCH;
  		return SUCCESS;
  	}
  	return FAIL;
  }
  STORAGE_CLASS_INFO 
  int DestroyInstance(BasicHandler *inst)
  {
  	if (inst) 
  	{
  		WrapperClassHandler* pWCH = static_cast<CPP_DeploymentWrapper*>(inst);
  		pWCH->Fini();
  		delete pWCH;
  		return SUCCESS;
  	}
  	return FAIL;
  }
  }
  
  
  
  1.1                  ws-axis/c/src/server/web_services/cpp_deployment_wrapper/CPP_DeploymentWrapper.cpp
  
  Index: CPP_DeploymentWrapper.cpp
  ===================================================================
  /* -*- C++ -*- */
  
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "SOAP" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   *
   *
   *
   * @author Roshan Weerasuriya (roshan@jkcs.slt.lk, roshan@opensource.lk)
   *
   */
  
  // CPP_DeploymentWrapper.cpp: implementation of the CPP_DeploymentWrapper class.
  //
  //////////////////////////////////////////////////////////////////////
  
  #include "CPP_DeploymentWrapper.h"
  
  //////////////////////////////////////////////////////////////////////
  // Construction/Destruction
  //////////////////////////////////////////////////////////////////////
  
  CPP_DeploymentWrapper::CPP_DeploymentWrapper()
  {
  	pWs = new CPP_Deployment();
  }
  
  CPP_DeploymentWrapper::~CPP_DeploymentWrapper()
  {
  
  }
  
  int CPP_DeploymentWrapper::Invoke(IMessageData *mc)
  {
  	deploy(mc);
  
  	return SUCCESS;
  }
  
  void CPP_DeploymentWrapper::OnFault(IMessageData *pMsg)
  {
  
  }
  
  int CPP_DeploymentWrapper::Init()
  {
  	return SUCCESS;
  }
  
  int CPP_DeploymentWrapper::Fini()
  {
  	return SUCCESS;
  }
  
  int CPP_DeploymentWrapper::deploy(IMessageData *pIMessageData)
  {
  	IWrapperSoapSerializer* pIWSSZ = NULL;
  	pIMessageData->getSoapSerializer(&pIWSSZ);
  	if (!pIWSSZ) return FAIL;
  	IWrapperSoapDeSerializer* pIWSDZ = NULL;
  	pIMessageData->getSoapDeSerializer(&pIWSDZ);
  	if (!pIWSDZ) return FAIL;
  
  	setResponseMethod(pIMessageData, "deployResponse");
  
  	IParam *param0 = pIWSDZ->GetParam();
  	string asServiceName = string(param0->GetString());
  
  	IParam *param1 = pIWSDZ->GetParam();
  	string asDllPath = param1->GetString();
  
  	
  	IParam *param2 = pIWSDZ->GetParam(); // we know that this is an array
  	Axis_String_Array inArray;
  	inArray.m_Size = param2->GetArraySize();
  	if (inArray.m_Size > 0)
  		inArray.m_Array = new string[inArray.m_Size];
  	else 
  		return FAIL; //CF_ZERO_ARRAY_SIZE_ERROR
  	
  	param2->SetArrayElements((void*)(inArray.m_Array));
  	pIWSDZ->Deserialize(param2,0);
  	
  	int iResult = pWs->deploy(asServiceName, asDllPath, inArray);
  
  	IParam* pRetParam = pIWSSZ->AddOutputParam(iResult);
  	pRetParam->SetName("deployReturn");
  
  	return SUCCESS;
  }
  
  int CPP_DeploymentWrapper::setResponseMethod(IMessageData *mc, const AxisChar *name)
  {
  	IWrapperSoapSerializer* pIWSSZ = NULL;
  	mc->getSoapSerializer(&pIWSSZ);
  	if (!pIWSSZ) return FAIL;
  	ISoapMethod* pMethod = pIWSSZ->createSoapMethod();
  	pMethod->setLocalName(name);
  	pMethod->setPrefix(pIWSSZ->getNewNamespacePrefix());
  	pMethod->setUri("http://www.opensource.lk/CPP_Deployment");
  	return SUCCESS;
  }
  
  
  
  1.1                  ws-axis/c/src/server/web_services/cpp_deployment_wrapper/CPP_DeploymentWrapper.h
  
  Index: CPP_DeploymentWrapper.h
  ===================================================================
  /* -*- C++ -*- */
  
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "SOAP" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   *
   *
   *
   * @author Roshan Weerasuriya (roshan@jkcs.slt.lk, roshan@opensource.lk)
   *
   */
  
  // CPP_DeploymentWrapper.h: interface for the CPP_DeploymentWrapper class.
  //
  //////////////////////////////////////////////////////////////////////
  
  #if !defined(AFX_DEPLOYMENTWRAPPER_H__6F0D0872_56A3_4492_9AF1_E9139EB212EB__INCLUDED_)
  #define AFX_DEPLOYMENTWRAPPER_H__6F0D0872_56A3_4492_9AF1_E9139EB212EB__INCLUDED_
  
  #if _MSC_VER > 1000
  #pragma once
  #endif // _MSC_VER > 1000
  
  #include <common/WrapperClassHandler.h>
  #include <common/IParam.h>
  #include <common/ISoapMethod.h>
  #include <common/IArrayBean.h>
  #include "../cpp_deployment/CPP_Deployment.h"
  
  class CPP_DeploymentWrapper : public WrapperClassHandler
  {
  public:
  	CPP_DeploymentWrapper();
  	virtual ~CPP_DeploymentWrapper();
  public:	//implementation of WrapperClassHandler interface	
  	int Fini();
  	int Init();
  	void OnFault(IMessageData* pMsg);
  	int Invoke(IMessageData* mc);	
  private: //Methods corresponding to the web service methods
  	int deploy(IMessageData* pIMessageData);
  private:
  	int setResponseMethod(IMessageData* mc, const AxisChar* name);
  private: //Actual web service object
  	CPP_Deployment *pWs;
  };
  
  #endif // !defined(AFX_DEPLOYMENTWRAPPER_H__6F0D0872_56A3_4492_9AF1_E9139EB212EB__INCLUDED_)