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 su...@apache.org on 2003/10/26 09:03:00 UTC

cvs commit: ws-axis/c/src/server/web_services/cpp_deployment CPP_DeploymentWrapper.h CPP_DeploymentWrapper.cpp CPP_DeploymentService.cpp

susantha    2003/10/26 01:03:00

  Added:       c/src/server/web_services/cpp_deployment
                        CPP_DeploymentWrapper.h CPP_DeploymentWrapper.cpp
                        CPP_DeploymentService.cpp
  Log:
  moved deployment web services source files to one folder
  
  Revision  Changes    Path
  1.1                  ws-axis/c/src/server/web_services/cpp_deployment/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 <axis/common/WrapperClassHandler.h>
  #include <axis/common/IParam.h>
  #include <axis/common/ISoapMethod.h>
  #include <axis/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 unDeploy(IMessageData* pIMessageData);
  	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: //Actual web service object
  	/*CPP_Deployment *pWs;*/
  };
  
  #endif // !defined(AFX_DEPLOYMENTWRAPPER_H__6F0D0872_56A3_4492_9AF1_E9139EB212EB__INCLUDED_)
  
  
  
  1.1                  ws-axis/c/src/server/web_services/cpp_deployment/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"
  #include <axis/common/IDeployerUtils.h>
  #ifdef _DEBUG
  	#include <axis/common/AxisTrace.h>
  #endif
  
  //////////////////////////////////////////////////////////////////////
  // Construction/Destruction
  //////////////////////////////////////////////////////////////////////
  
  CPP_DeploymentWrapper::CPP_DeploymentWrapper()
  {
  	//pWs = new CPP_Deployment();
  }
  
  CPP_DeploymentWrapper::~CPP_DeploymentWrapper()
  {
  
  }
  
  int CPP_DeploymentWrapper::Invoke(IMessageData *mc)
  {
  	IWrapperSoapDeSerializer* pIWSDZ = NULL;
  	mc->getSoapDeSerializer(&pIWSDZ);
  	if (!pIWSDZ) return FAIL;
  	const AxisChar* method = pIWSDZ->GetMethodName();
  	if (0 == strcmp(method, "deploy"))
  		return deploy(mc);
  	else if (0 == strcmp(method, "undeploy"))
  		return unDeploy(mc);
  	else return FAIL; //CF_METHOD_NOT_FOUND_IN_LIBRARY
  }
  
  void CPP_DeploymentWrapper::OnFault(IMessageData *pMsg)
  {
  
  }
  
  int CPP_DeploymentWrapper::Init()
  {
  	return SUCCESS;
  }
  
  int CPP_DeploymentWrapper::Fini()
  {
  	return SUCCESS;
  }
  
  int CPP_DeploymentWrapper::deploy(IMessageData *pIMessageData)
  {
  	#ifdef _DEBUG
  		AXISTRACE3("start of the wrapper deploy method");
  	#endif
  
  	IWrapperSoapSerializer* pIWSSZ = NULL;
  	pIMessageData->getSoapSerializer(&pIWSSZ);
  	if (!pIWSSZ) return FAIL;
  	IWrapperSoapDeSerializer* pIWSDZ = NULL;
  	pIMessageData->getSoapDeSerializer(&pIWSDZ);
  	if (!pIWSDZ) return FAIL;
  
  	pIWSSZ->createSoapMethod("deployResponse", pIWSSZ->getNewNamespacePrefix(), "http://www.opensource.lk/CPP_Deployment");
  
  	IParam *param0 = pIWSDZ->GetParam();
  	string asServiceName = string(param0->GetString());
  
  	IParam *param1 = pIWSDZ->GetParam();
  	string asDllPath = string(param1->GetString());
  	
  	IParam *param2 = pIWSDZ->GetParam(); // we know that this is an array
  	Axis_ArrayTag 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 = 1;
  
  	//int iResult = pWs->deploy(asServiceName, asDllPath, inArray, iDepoy);
  	IDeployerUtils* pIDeployerUtils;
  	pIMessageData->getWSDDDeployment(&pIDeployerUtils);
  	pIDeployerUtils->deploy(asServiceName, asDllPath, inArray);
  
  	return pIWSSZ->AddOutputParam("deployReturn", iResult, XSD_INT);
  
  	return SUCCESS;
  }
  
  int CPP_DeploymentWrapper::unDeploy(IMessageData *pIMessageData)
  {
  	#ifdef _DEBUG
  		AXISTRACE3("start of the wrapper unDeploy method");
  	#endif
  
  	IWrapperSoapSerializer* pIWSSZ = NULL;
  	pIMessageData->getSoapSerializer(&pIWSSZ);
  	if (!pIWSSZ) return FAIL;
  	IWrapperSoapDeSerializer* pIWSDZ = NULL;
  	pIMessageData->getSoapDeSerializer(&pIWSDZ);
  	if (!pIWSDZ) return FAIL;
  
  	pIWSSZ->createSoapMethod("unDeployResponse", pIWSSZ->getNewNamespacePrefix(), "http://www.opensource.lk/CPP_Deployment");
  
  	IParam *param0 = pIWSDZ->GetParam();
  	string asServiceName = string(param0->GetString());
  	
  	int iResult = 1;
  
  	//int iResult = pWs->deploy(asServiceName, asDllPath, inArray, iDepoy);
  	IDeployerUtils* pIDeployerUtils;
  	pIMessageData->getWSDDDeployment(&pIDeployerUtils);
  	pIDeployerUtils->unDeploy(asServiceName);
  
  	return pIWSSZ->AddOutputParam("deployReturn", iResult, XSD_INT);
  
  	return SUCCESS;
  }
  
  
  
  1.1                  ws-axis/c/src/server/web_services/cpp_deployment/CPP_DeploymentService.cpp
  
  Index: CPP_DeploymentService.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;
  }
  }