Example #1
0
bool Axis2UtilsRemoveVirtualService(const std::string& sServiceName, 
                                    const struct axutil_env* pEnv,
                                    struct axis2_conf* pConf,
                                    bool bIsShuttingDown)
{
  axis2_svc* pService = axis2_conf_get_svc(pConf, pEnv, sServiceName.c_str());
  if (!pService)
  {
    staff::LogError() << "axis2_conf_get_svc";
    return false;
  }

  if (!bIsShuttingDown)
  {
    std::string sServiceGroupName = sServiceName.c_str();
    sServiceGroupName += "SvcGroup";

    // removing from conf
    axis2_svc_grp* pServiceGroup = axis2_conf_get_svc_grp(pConf, pEnv, sServiceGroupName.c_str());
    if (!pServiceGroup)
    {
      staff::LogError() << "axis2_conf_get_svc_grp";
      return false;
    }

    axutil_hash_t* pAllServiceGroups = axis2_conf_get_all_svc_grps(pConf, pEnv);
    if (!pAllServiceGroups)
    {
      staff::LogError() << "axis2_conf_get_all_svc_grps";
      return false;
    }

    axutil_hash_set(pAllServiceGroups, sServiceGroupName.c_str(), AXIS2_HASH_KEY_STRING, NULL);

    axis2_svc_grp_free(pServiceGroup, pEnv);
  }

  // axis2_svc_grp_free does not destroy the services in group
  if (axis2_conf_remove_svc(pConf, pEnv, sServiceName.c_str()) != AXIS2_SUCCESS)
  {
    staff::LogError() << "axis2_conf_remove_svc";
    return false;
  }

  axis2_svc_free(pService, pEnv);

  return true;
}
Example #2
0
AXIS2_EXTERN axis2_svc_grp_t* AXIS2_CALL
service_admin_util_get_service_group(
	axutil_env_t *env,
	axis2_msg_ctx_t *msg_ctx,
	axis2_char_t *svc_grp_name)
{
	axis2_conf_ctx_t *conf_ctx = NULL;
	axis2_conf_t *conf = NULL;
	axis2_svc_grp_t *service_grp = NULL;
	conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
	conf = axis2_conf_ctx_get_conf(conf_ctx, env);
	service_grp = axis2_conf_get_svc_grp(conf, env, svc_grp_name);
	if(service_grp)
	{
		return service_grp;
	}else
	{
		AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI , "service not found");
	}
	return NULL;

}