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 sa...@apache.org on 2008/06/08 15:25:39 UTC
svn commit: r664506 [1/2] - in /webservices/axis2/trunk/c/src/core:
clientapi/ deployment/ transport/ transport/amqp/ transport/amqp/receiver/
transport/amqp/receiver/qpid_receiver/
transport/amqp/receiver/qpid_receiver/request_processor/ transport/amq...
Author: samisa
Date: Sun Jun 8 06:25:38 2008
New Revision: 664506
URL: http://svn.apache.org/viewvc?rev=664506&view=rev
Log:
Added the AMQP related files given by Dhanushka
Added:
webservices/axis2/trunk/c/src/core/transport/amqp/
webservices/axis2/trunk/c/src/core/transport/amqp/Makefile.am
webservices/axis2/trunk/c/src/core/transport/amqp/receiver/
webservices/axis2/trunk/c/src/core/transport/amqp/receiver/Makefile.am
webservices/axis2/trunk/c/src/core/transport/amqp/receiver/axis2_amqp_receiver.c
webservices/axis2/trunk/c/src/core/transport/amqp/receiver/axis2_amqp_receiver.h
webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/
webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/Makefile.am
webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/axis2_qpid_receiver.cpp
webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/axis2_qpid_receiver.h
webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/axis2_qpid_receiver_interface.cpp
webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/axis2_qpid_receiver_interface.h
webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/request_processor/
webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/request_processor/Makefile.am
webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/request_processor/axis2_amqp_request_processor.c
webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/request_processor/axis2_amqp_request_processor.h
webservices/axis2/trunk/c/src/core/transport/amqp/sender/
webservices/axis2/trunk/c/src/core/transport/amqp/sender/Makefile.am
webservices/axis2/trunk/c/src/core/transport/amqp/sender/axis2_amqp_sender.c
webservices/axis2/trunk/c/src/core/transport/amqp/sender/axis2_amqp_sender.h
webservices/axis2/trunk/c/src/core/transport/amqp/sender/qpid_sender/
webservices/axis2/trunk/c/src/core/transport/amqp/sender/qpid_sender/Makefile.am
webservices/axis2/trunk/c/src/core/transport/amqp/sender/qpid_sender/axis2_qpid_sender.cpp
webservices/axis2/trunk/c/src/core/transport/amqp/sender/qpid_sender/axis2_qpid_sender.h
webservices/axis2/trunk/c/src/core/transport/amqp/sender/qpid_sender/axis2_qpid_sender_interface.cpp
webservices/axis2/trunk/c/src/core/transport/amqp/sender/qpid_sender/axis2_qpid_sender_interface.h
webservices/axis2/trunk/c/src/core/transport/amqp/server/
webservices/axis2/trunk/c/src/core/transport/amqp/server/Makefile.am
webservices/axis2/trunk/c/src/core/transport/amqp/server/axis2_amqp_server/
webservices/axis2/trunk/c/src/core/transport/amqp/server/axis2_amqp_server/Makefile.am
webservices/axis2/trunk/c/src/core/transport/amqp/server/axis2_amqp_server/axis2_amqp_server.c
webservices/axis2/trunk/c/src/core/transport/amqp/server/axis2_amqp_server/axis2_amqp_server.h
webservices/axis2/trunk/c/src/core/transport/amqp/util/
webservices/axis2/trunk/c/src/core/transport/amqp/util/Makefile.am
webservices/axis2/trunk/c/src/core/transport/amqp/util/axis2_amqp_defines.h
webservices/axis2/trunk/c/src/core/transport/amqp/util/axis2_amqp_util.c
webservices/axis2/trunk/c/src/core/transport/amqp/util/axis2_amqp_util.h
Modified:
webservices/axis2/trunk/c/src/core/clientapi/op_client.c
webservices/axis2/trunk/c/src/core/deployment/conf_builder.c
webservices/axis2/trunk/c/src/core/transport/Makefile.am
Modified: webservices/axis2/trunk/c/src/core/clientapi/op_client.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/clientapi/op_client.c?rev=664506&r1=664505&r2=664506&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/clientapi/op_client.c (original)
+++ webservices/axis2/trunk/c/src/core/clientapi/op_client.c Sun Jun 8 06:25:38 2008
@@ -897,6 +897,10 @@
{
transport_enum = AXIS2_TRANSPORT_ENUM_TCP;
}
+ else if (!axutil_strcmp(transport, AXIS2_TRANSPORT_AMQP))
+ {
+ transport_enum = AXIS2_TRANSPORT_ENUM_AMQP;
+ }
conf_ctx = axis2_svc_ctx_get_conf_ctx(op_client->svc_ctx, env);
if (conf_ctx)
Modified: webservices/axis2/trunk/c/src/core/deployment/conf_builder.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/deployment/conf_builder.c?rev=664506&r1=664505&r2=664506&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/deployment/conf_builder.c (original)
+++ webservices/axis2/trunk/c/src/core/deployment/conf_builder.c Sun Jun 8 06:25:38 2008
@@ -791,6 +791,10 @@
{
transport_enum = AXIS2_TRANSPORT_ENUM_HTTPS;
}
+ else if (!axutil_strcmp(name, AXIS2_TRANSPORT_AMQP))
+ {
+ transport_enum = AXIS2_TRANSPORT_ENUM_AMQP;
+ }
else
{
AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI,
@@ -1139,6 +1143,10 @@
{
transport_enum = AXIS2_TRANSPORT_ENUM_HTTPS;
}
+ else if (!axutil_strcmp(name, AXIS2_TRANSPORT_AMQP))
+ {
+ transport_enum = AXIS2_TRANSPORT_ENUM_AMQP;
+ }
else
{
AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI,
@@ -1460,3 +1468,4 @@
return AXIS2_SUCCESS;
}
+
Modified: webservices/axis2/trunk/c/src/core/transport/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/Makefile.am?rev=664506&r1=664505&r2=664506&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/Makefile.am (original)
+++ webservices/axis2/trunk/c/src/core/transport/Makefile.am Sun Jun 8 06:25:38 2008
@@ -1,2 +1,2 @@
-SUBDIRS=http $(TCP_DIR)
+SUBDIRS=http $(TCP_DIR) $(AMQP_DIR)
EXTRA_DIST=Makefile.am
Added: webservices/axis2/trunk/c/src/core/transport/amqp/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/amqp/Makefile.am?rev=664506&view=auto
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/amqp/Makefile.am (added)
+++ webservices/axis2/trunk/c/src/core/transport/amqp/Makefile.am Sun Jun 8 06:25:38 2008
@@ -0,0 +1,8 @@
+SUBDIRS = util \
+ receiver \
+ server \
+ sender
+SUBDIRS = util \
+ receiver \
+ server \
+ sender
Added: webservices/axis2/trunk/c/src/core/transport/amqp/receiver/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/amqp/receiver/Makefile.am?rev=664506&view=auto
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/amqp/receiver/Makefile.am (added)
+++ webservices/axis2/trunk/c/src/core/transport/amqp/receiver/Makefile.am Sun Jun 8 06:25:38 2008
@@ -0,0 +1,46 @@
+SUBDIRS = qpid_receiver
+
+lib_LTLIBRARIES = libaxis2_amqp_receiver.la
+
+libaxis2_amqp_receiver_la_SOURCES = axis2_amqp_receiver.c
+
+libaxis2_amqp_receiver_la_LIBADD = $(top_builddir)/util/src/libaxutil.la \
+ $(top_builddir)/src/core/transport/amqp/util/libaxis2_amqp_util.la \
+ $(top_builddir)/src/core/transport/amqp/receiver/qpid_receiver/libaxis2_qpid_receiver.la
+
+libaxis2_amqp_receiver_la_LDFLAGS = -version-info $(VERSION_NO)
+
+INCLUDES = -I$(top_builddir)/include \
+ -I$(top_builddir)/src/core/transport/amqp/util \
+ -I$(top_builddir)/src/core/transport/amqp/receiver \
+ -I$(top_builddir)/src/core/transport/amqp/receiver/qpid_receiver \
+ -I$(top_builddir)/src/core/description \
+ -I$(top_builddir)/src/core/context \
+ -I$(top_builddir)/src/core/phaseresolver \
+ -I$(top_builddir)/src/core/engine \
+ -I$(top_builddir)/src/core/deployment \
+ -I$(top_builddir)/util/include \
+ -I$(top_builddir)/axiom/include
+SUBDIRS = qpid_receiver
+
+lib_LTLIBRARIES = libaxis2_amqp_receiver.la
+
+libaxis2_amqp_receiver_la_SOURCES = axis2_amqp_receiver.c
+
+libaxis2_amqp_receiver_la_LIBADD = $(top_builddir)/util/src/libaxutil.la \
+ $(top_builddir)/src/core/transport/amqp/util/libaxis2_amqp_util.la \
+ $(top_builddir)/src/core/transport/amqp/receiver/qpid_receiver/libaxis2_qpid_receiver.la
+
+libaxis2_amqp_receiver_la_LDFLAGS = -version-info $(VERSION_NO)
+
+INCLUDES = -I$(top_builddir)/include \
+ -I$(top_builddir)/src/core/transport/amqp/util \
+ -I$(top_builddir)/src/core/transport/amqp/receiver \
+ -I$(top_builddir)/src/core/transport/amqp/receiver/qpid_receiver \
+ -I$(top_builddir)/src/core/description \
+ -I$(top_builddir)/src/core/context \
+ -I$(top_builddir)/src/core/phaseresolver \
+ -I$(top_builddir)/src/core/engine \
+ -I$(top_builddir)/src/core/deployment \
+ -I$(top_builddir)/util/include \
+ -I$(top_builddir)/axiom/include
Added: webservices/axis2/trunk/c/src/core/transport/amqp/receiver/axis2_amqp_receiver.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/amqp/receiver/axis2_amqp_receiver.c?rev=664506&view=auto
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/amqp/receiver/axis2_amqp_receiver.c (added)
+++ webservices/axis2/trunk/c/src/core/transport/amqp/receiver/axis2_amqp_receiver.c Sun Jun 8 06:25:38 2008
@@ -0,0 +1,471 @@
+/*
+* 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.
+*/
+
+#include <axis2_amqp_util.h>
+#include <axis2_amqp_receiver.h>
+
+static const axis2_transport_receiver_ops_t amqp_receiver_ops = {
+ axis2_amqp_receiver_init,
+ axis2_amqp_receiver_start,
+ axis2_amqp_receiver_get_reply_to_epr,
+ axis2_amqp_receiver_get_conf_ctx,
+ axis2_amqp_receiver_is_running,
+ axis2_amqp_receiver_stop,
+ axis2_amqp_receiver_free};
+
+
+axis2_transport_receiver_t* AXIS2_CALL
+axis2_amqp_receiver_create (const axutil_env_t* env,
+ const axis2_char_t* repo,
+ const axis2_char_t* qpid_broker_ip,
+ int qpid_broker_port)
+{
+ AXIS2_ENV_CHECK (env, NULL);
+
+ axis2_amqp_receiver_resource_pack_t* receiver_resource_pack = NULL;
+
+ receiver_resource_pack = (axis2_amqp_receiver_resource_pack_t*)
+ AXIS2_MALLOC(env->allocator,
+ sizeof (axis2_amqp_receiver_resource_pack_t));
+
+ if (!receiver_resource_pack)
+ {
+ AXIS2_ERROR_SET (env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
+ receiver_resource_pack->receiver.ops = &amqp_receiver_ops;
+ receiver_resource_pack->qpid_receiver = NULL;
+ receiver_resource_pack->conf_ctx = NULL;
+ receiver_resource_pack->conf_ctx_private = NULL;
+ receiver_resource_pack->qpid_broker_ip = qpid_broker_ip ? qpid_broker_ip :
+ AXIS2_QPID_BROKER_IP;
+ receiver_resource_pack->qpid_broker_port = (qpid_broker_port != -1) ?
+ qpid_broker_port : AXIS2_QPID_BROKER_PORT;
+
+ if (repo)
+ {
+ /**
+ * We first create a private conf ctx which is owned by this server
+ * we only free this private conf context. We should never free the
+ * receiver_impl->conf_ctx because it may be owned by any other object which
+ * may lead to double free
+ */
+ receiver_resource_pack->conf_ctx_private = axis2_build_conf_ctx (env, repo);
+ if (!receiver_resource_pack->conf_ctx_private)
+ {
+ axis2_amqp_receiver_free ((axis2_transport_receiver_t *)receiver_resource_pack, env);
+ return NULL;
+ }
+
+ receiver_resource_pack->conf_ctx = receiver_resource_pack->conf_ctx_private;
+ }
+
+ return &(receiver_resource_pack->receiver);
+}
+
+
+axis2_status_t AXIS2_CALL
+axis2_amqp_receiver_init (axis2_transport_receiver_t* receiver,
+ const axutil_env_t* env,
+ axis2_conf_ctx_t* conf_ctx,
+ axis2_transport_in_desc_t* in_desc)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ axis2_amqp_receiver_resource_pack_t* receiver_resource_pack = NULL;
+
+ receiver_resource_pack = AXIS2_AMQP_RECEIVER_TO_RESOURCE_PACK (receiver);
+ receiver_resource_pack->conf_ctx = conf_ctx;
+ receiver_resource_pack->qpid_broker_ip = axis2_amqp_util_get_conf_value_string (in_desc,
+ env,
+ AXIS2_AMQP_CONF_QPID_BROKER_IP);
+ receiver_resource_pack->qpid_broker_port = axis2_amqp_util_get_conf_value_int (in_desc,
+ env,
+ AXIS2_AMQP_CONF_QPID_BROKER_PORT);
+
+ return AXIS2_SUCCESS;
+}
+
+
+axis2_status_t AXIS2_CALL
+axis2_amqp_receiver_start (axis2_transport_receiver_t* receiver,
+ const axutil_env_t* env)
+{
+ AXIS2_ENV_CHECK (env, AXIS2_FAILURE);
+
+ axis2_status_t status = AXIS2_FAILURE;
+
+ axis2_amqp_receiver_resource_pack_t* amqp_receiver_resource_pack = NULL;
+ axis2_qpid_receiver_resource_pack_t* qpid_receiver_resource_pack = NULL;
+
+ amqp_receiver_resource_pack = AXIS2_AMQP_RECEIVER_TO_RESOURCE_PACK (receiver);
+
+ /* Create Qpid Receiver */
+ qpid_receiver_resource_pack = axis2_qpid_receiver_create (env,
+ amqp_receiver_resource_pack->conf_ctx,
+ amqp_receiver_resource_pack->qpid_broker_ip,
+ amqp_receiver_resource_pack->qpid_broker_port);
+ if (qpid_receiver_resource_pack)
+ {
+ amqp_receiver_resource_pack->qpid_receiver = qpid_receiver_resource_pack;
+
+ status = axis2_qpid_receiver_start (qpid_receiver_resource_pack, env);
+ }
+
+ return status;
+}
+
+
+axis2_endpoint_ref_t* AXIS2_CALL
+axis2_amqp_receiver_get_reply_to_epr (axis2_transport_receiver_t* receiver,
+ const axutil_env_t* env,
+ const axis2_char_t* svc_name)
+{
+ return NULL;
+}
+
+
+axis2_conf_ctx_t* AXIS2_CALL
+axis2_amqp_receiver_get_conf_ctx (axis2_transport_receiver_t* receiver,
+ const axutil_env_t* env)
+{
+ AXIS2_ENV_CHECK (env, NULL);
+
+ return AXIS2_AMQP_RECEIVER_TO_RESOURCE_PACK (receiver)->conf_ctx;
+}
+
+
+axis2_bool_t AXIS2_CALL
+axis2_amqp_receiver_is_running (axis2_transport_receiver_t* receiver,
+ const axutil_env_t* env)
+{
+ return AXIS2_TRUE;
+}
+
+
+axis2_status_t AXIS2_CALL
+axis2_amqp_receiver_stop (axis2_transport_receiver_t* receiver,
+ const axutil_env_t* env)
+{
+ return AXIS2_SUCCESS;
+}
+
+
+void AXIS2_CALL
+axis2_amqp_receiver_free (axis2_transport_receiver_t* receiver,
+ const axutil_env_t* env)
+{
+ AXIS2_ENV_CHECK (env, void);
+
+ axis2_amqp_receiver_resource_pack_t* receiver_resource_pack = NULL;
+ receiver_resource_pack = AXIS2_AMQP_RECEIVER_TO_RESOURCE_PACK (receiver);
+
+ if (receiver_resource_pack->qpid_receiver)
+ {
+ axis2_qpid_receiver_free (receiver_resource_pack->qpid_receiver, env);
+ receiver_resource_pack->qpid_receiver = NULL;
+ }
+
+ if (receiver_resource_pack->conf_ctx_private)
+ {
+ axis2_conf_ctx_free (receiver_resource_pack->conf_ctx_private, env);
+ receiver_resource_pack->conf_ctx_private = NULL;
+ }
+
+ receiver_resource_pack->conf_ctx = NULL; /* Do not free this. It may be owned by some other object */
+
+ AXIS2_FREE (env->allocator, receiver_resource_pack);
+}
+
+
+/* Library Exports */
+
+AXIS2_EXPORT int
+#ifndef AXIS2_STATIC_DEPLOY
+axis2_get_instance (
+#else
+axis2_amqp_receiver_get_instance (
+#endif
+ struct axis2_transport_receiver** inst,
+ const axutil_env_t* env)
+{
+ int status = AXIS2_SUCCESS;
+
+ *inst = axis2_amqp_receiver_create (env, NULL, NULL, -1);
+ if (!(*inst))
+ {
+ status = AXIS2_FAILURE;
+ }
+
+ return status;
+}
+
+
+AXIS2_EXPORT int
+#ifndef AXIS2_STATIC_DEPLOY
+axis2_remove_instance (
+#else
+axis2_amqp_receiver_remove_instance (
+#endif
+ axis2_transport_receiver_t* inst,
+ const axutil_env_t* env)
+{
+ if (inst)
+ {
+ axis2_transport_receiver_free (inst, env);
+ }
+
+ return AXIS2_SUCCESS;
+}
+
+/*
+* 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.
+*/
+
+#include <axis2_amqp_util.h>
+#include <axis2_amqp_receiver.h>
+
+static const axis2_transport_receiver_ops_t amqp_receiver_ops = {
+ axis2_amqp_receiver_init,
+ axis2_amqp_receiver_start,
+ axis2_amqp_receiver_get_reply_to_epr,
+ axis2_amqp_receiver_get_conf_ctx,
+ axis2_amqp_receiver_is_running,
+ axis2_amqp_receiver_stop,
+ axis2_amqp_receiver_free};
+
+
+axis2_transport_receiver_t* AXIS2_CALL
+axis2_amqp_receiver_create (const axutil_env_t* env,
+ const axis2_char_t* repo,
+ const axis2_char_t* qpid_broker_ip,
+ int qpid_broker_port)
+{
+ AXIS2_ENV_CHECK (env, NULL);
+
+ axis2_amqp_receiver_resource_pack_t* receiver_resource_pack = NULL;
+
+ receiver_resource_pack = (axis2_amqp_receiver_resource_pack_t*)
+ AXIS2_MALLOC(env->allocator,
+ sizeof (axis2_amqp_receiver_resource_pack_t));
+
+ if (!receiver_resource_pack)
+ {
+ AXIS2_ERROR_SET (env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
+ receiver_resource_pack->receiver.ops = &amqp_receiver_ops;
+ receiver_resource_pack->qpid_receiver = NULL;
+ receiver_resource_pack->conf_ctx = NULL;
+ receiver_resource_pack->conf_ctx_private = NULL;
+ receiver_resource_pack->qpid_broker_ip = qpid_broker_ip ? qpid_broker_ip :
+ AXIS2_QPID_BROKER_IP;
+ receiver_resource_pack->qpid_broker_port = (qpid_broker_port != -1) ?
+ qpid_broker_port : AXIS2_QPID_BROKER_PORT;
+
+ if (repo)
+ {
+ /**
+ * We first create a private conf ctx which is owned by this server
+ * we only free this private conf context. We should never free the
+ * receiver_impl->conf_ctx because it may be owned by any other object which
+ * may lead to double free
+ */
+ receiver_resource_pack->conf_ctx_private = axis2_build_conf_ctx (env, repo);
+ if (!receiver_resource_pack->conf_ctx_private)
+ {
+ axis2_amqp_receiver_free ((axis2_transport_receiver_t *)receiver_resource_pack, env);
+ return NULL;
+ }
+
+ receiver_resource_pack->conf_ctx = receiver_resource_pack->conf_ctx_private;
+ }
+
+ return &(receiver_resource_pack->receiver);
+}
+
+
+axis2_status_t AXIS2_CALL
+axis2_amqp_receiver_init (axis2_transport_receiver_t* receiver,
+ const axutil_env_t* env,
+ axis2_conf_ctx_t* conf_ctx,
+ axis2_transport_in_desc_t* in_desc)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ axis2_amqp_receiver_resource_pack_t* receiver_resource_pack = NULL;
+
+ receiver_resource_pack = AXIS2_AMQP_RECEIVER_TO_RESOURCE_PACK (receiver);
+ receiver_resource_pack->conf_ctx = conf_ctx;
+ receiver_resource_pack->qpid_broker_ip = axis2_amqp_util_get_conf_value_string (in_desc,
+ env,
+ AXIS2_AMQP_CONF_QPID_BROKER_IP);
+ receiver_resource_pack->qpid_broker_port = axis2_amqp_util_get_conf_value_int (in_desc,
+ env,
+ AXIS2_AMQP_CONF_QPID_BROKER_PORT);
+
+ return AXIS2_SUCCESS;
+}
+
+
+axis2_status_t AXIS2_CALL
+axis2_amqp_receiver_start (axis2_transport_receiver_t* receiver,
+ const axutil_env_t* env)
+{
+ AXIS2_ENV_CHECK (env, AXIS2_FAILURE);
+
+ axis2_status_t status = AXIS2_FAILURE;
+
+ axis2_amqp_receiver_resource_pack_t* amqp_receiver_resource_pack = NULL;
+ axis2_qpid_receiver_resource_pack_t* qpid_receiver_resource_pack = NULL;
+
+ amqp_receiver_resource_pack = AXIS2_AMQP_RECEIVER_TO_RESOURCE_PACK (receiver);
+
+ /* Create Qpid Receiver */
+ qpid_receiver_resource_pack = axis2_qpid_receiver_create (env,
+ amqp_receiver_resource_pack->conf_ctx,
+ amqp_receiver_resource_pack->qpid_broker_ip,
+ amqp_receiver_resource_pack->qpid_broker_port);
+ if (qpid_receiver_resource_pack)
+ {
+ amqp_receiver_resource_pack->qpid_receiver = qpid_receiver_resource_pack;
+
+ status = axis2_qpid_receiver_start (qpid_receiver_resource_pack, env);
+ }
+
+ return status;
+}
+
+
+axis2_endpoint_ref_t* AXIS2_CALL
+axis2_amqp_receiver_get_reply_to_epr (axis2_transport_receiver_t* receiver,
+ const axutil_env_t* env,
+ const axis2_char_t* svc_name)
+{
+ return NULL;
+}
+
+
+axis2_conf_ctx_t* AXIS2_CALL
+axis2_amqp_receiver_get_conf_ctx (axis2_transport_receiver_t* receiver,
+ const axutil_env_t* env)
+{
+ AXIS2_ENV_CHECK (env, NULL);
+
+ return AXIS2_AMQP_RECEIVER_TO_RESOURCE_PACK (receiver)->conf_ctx;
+}
+
+
+axis2_bool_t AXIS2_CALL
+axis2_amqp_receiver_is_running (axis2_transport_receiver_t* receiver,
+ const axutil_env_t* env)
+{
+ return AXIS2_TRUE;
+}
+
+
+axis2_status_t AXIS2_CALL
+axis2_amqp_receiver_stop (axis2_transport_receiver_t* receiver,
+ const axutil_env_t* env)
+{
+ return AXIS2_SUCCESS;
+}
+
+
+void AXIS2_CALL
+axis2_amqp_receiver_free (axis2_transport_receiver_t* receiver,
+ const axutil_env_t* env)
+{
+ AXIS2_ENV_CHECK (env, void);
+
+ axis2_amqp_receiver_resource_pack_t* receiver_resource_pack = NULL;
+ receiver_resource_pack = AXIS2_AMQP_RECEIVER_TO_RESOURCE_PACK (receiver);
+
+ if (receiver_resource_pack->qpid_receiver)
+ {
+ axis2_qpid_receiver_free (receiver_resource_pack->qpid_receiver, env);
+ receiver_resource_pack->qpid_receiver = NULL;
+ }
+
+ if (receiver_resource_pack->conf_ctx_private)
+ {
+ axis2_conf_ctx_free (receiver_resource_pack->conf_ctx_private, env);
+ receiver_resource_pack->conf_ctx_private = NULL;
+ }
+
+ receiver_resource_pack->conf_ctx = NULL; /* Do not free this. It may be owned by some other object */
+
+ AXIS2_FREE (env->allocator, receiver_resource_pack);
+}
+
+
+/* Library Exports */
+
+AXIS2_EXPORT int
+#ifndef AXIS2_STATIC_DEPLOY
+axis2_get_instance (
+#else
+axis2_amqp_receiver_get_instance (
+#endif
+ struct axis2_transport_receiver** inst,
+ const axutil_env_t* env)
+{
+ int status = AXIS2_SUCCESS;
+
+ *inst = axis2_amqp_receiver_create (env, NULL, NULL, -1);
+ if (!(*inst))
+ {
+ status = AXIS2_FAILURE;
+ }
+
+ return status;
+}
+
+
+AXIS2_EXPORT int
+#ifndef AXIS2_STATIC_DEPLOY
+axis2_remove_instance (
+#else
+axis2_amqp_receiver_remove_instance (
+#endif
+ axis2_transport_receiver_t* inst,
+ const axutil_env_t* env)
+{
+ if (inst)
+ {
+ axis2_transport_receiver_free (inst, env);
+ }
+
+ return AXIS2_SUCCESS;
+}
+
+
Added: webservices/axis2/trunk/c/src/core/transport/amqp/receiver/axis2_amqp_receiver.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/amqp/receiver/axis2_amqp_receiver.h?rev=664506&view=auto
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/amqp/receiver/axis2_amqp_receiver.h (added)
+++ webservices/axis2/trunk/c/src/core/transport/amqp/receiver/axis2_amqp_receiver.h Sun Jun 8 06:25:38 2008
@@ -0,0 +1,162 @@
+/*
+* 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.
+*/
+
+#ifndef AXIS2_AMQP_RECEIVER_H
+#define AXIS2_AMQP_RECEIVER_H
+
+#include <axis2_transport_receiver.h>
+#include <axis2_conf_init.h>
+#include <axis2_qpid_receiver_interface.h>
+
+#define AXIS2_AMQP_CONF_QPID_BROKER_IP "qpid_broker_ip"
+#define AXIS2_AMQP_CONF_QPID_BROKER_PORT "qpid_broker_port"
+#define AXIS2_QPID_BROKER_IP "127.0.0.1"
+#define AXIS2_QPID_BROKER_PORT 5672
+
+typedef struct axis2_amqp_receiver_resource_pack
+{
+ axis2_transport_receiver_t receiver;
+ axis2_qpid_receiver_resource_pack_t* qpid_receiver;
+ axis2_conf_ctx_t* conf_ctx;
+ axis2_conf_ctx_t* conf_ctx_private;
+ const axis2_char_t* qpid_broker_ip;
+ int qpid_broker_port;
+}
+axis2_amqp_receiver_resource_pack_t;
+
+#define AXIS2_AMQP_RECEIVER_TO_RESOURCE_PACK(amqp_receiver) \
+ ((axis2_amqp_receiver_resource_pack_t*)(amqp_receiver))
+
+axis2_transport_receiver_t* AXIS2_CALL
+axis2_amqp_receiver_create (const axutil_env_t* env,
+ const axis2_char_t* repo,
+ const axis2_char_t* qpid_broker_ip,
+ int qpid_broker_port);
+
+axis2_status_t AXIS2_CALL
+axis2_amqp_receiver_init (axis2_transport_receiver_t* receiver,
+ const axutil_env_t* env,
+ axis2_conf_ctx_t* conf_ctx,
+ axis2_transport_in_desc_t* in_desc);
+
+axis2_status_t AXIS2_CALL
+axis2_amqp_receiver_start (axis2_transport_receiver_t* receiver,
+ const axutil_env_t* env);
+
+axis2_endpoint_ref_t* AXIS2_CALL
+axis2_amqp_receiver_get_reply_to_epr (axis2_transport_receiver_t* receiver,
+ const axutil_env_t* env,
+ const axis2_char_t* svc_name);
+
+axis2_conf_ctx_t* AXIS2_CALL
+axis2_amqp_receiver_get_conf_ctx (axis2_transport_receiver_t* receiver,
+ const axutil_env_t* env);
+
+axis2_bool_t AXIS2_CALL
+axis2_amqp_receiver_is_running (axis2_transport_receiver_t* receiver,
+ const axutil_env_t* env);
+
+axis2_status_t AXIS2_CALL
+axis2_amqp_receiver_stop (axis2_transport_receiver_t* receiver,
+ const axutil_env_t* env);
+
+void AXIS2_CALL
+axis2_amqp_receiver_free (axis2_transport_receiver_t* receiver,
+ const axutil_env_t* env);
+
+#endif
+/*
+* 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.
+*/
+
+#ifndef AXIS2_AMQP_RECEIVER_H
+#define AXIS2_AMQP_RECEIVER_H
+
+#include <axis2_transport_receiver.h>
+#include <axis2_conf_init.h>
+#include <axis2_qpid_receiver_interface.h>
+
+#define AXIS2_AMQP_CONF_QPID_BROKER_IP "qpid_broker_ip"
+#define AXIS2_AMQP_CONF_QPID_BROKER_PORT "qpid_broker_port"
+#define AXIS2_QPID_BROKER_IP "127.0.0.1"
+#define AXIS2_QPID_BROKER_PORT 5672
+
+typedef struct axis2_amqp_receiver_resource_pack
+{
+ axis2_transport_receiver_t receiver;
+ axis2_qpid_receiver_resource_pack_t* qpid_receiver;
+ axis2_conf_ctx_t* conf_ctx;
+ axis2_conf_ctx_t* conf_ctx_private;
+ const axis2_char_t* qpid_broker_ip;
+ int qpid_broker_port;
+}
+axis2_amqp_receiver_resource_pack_t;
+
+#define AXIS2_AMQP_RECEIVER_TO_RESOURCE_PACK(amqp_receiver) \
+ ((axis2_amqp_receiver_resource_pack_t*)(amqp_receiver))
+
+axis2_transport_receiver_t* AXIS2_CALL
+axis2_amqp_receiver_create (const axutil_env_t* env,
+ const axis2_char_t* repo,
+ const axis2_char_t* qpid_broker_ip,
+ int qpid_broker_port);
+
+axis2_status_t AXIS2_CALL
+axis2_amqp_receiver_init (axis2_transport_receiver_t* receiver,
+ const axutil_env_t* env,
+ axis2_conf_ctx_t* conf_ctx,
+ axis2_transport_in_desc_t* in_desc);
+
+axis2_status_t AXIS2_CALL
+axis2_amqp_receiver_start (axis2_transport_receiver_t* receiver,
+ const axutil_env_t* env);
+
+axis2_endpoint_ref_t* AXIS2_CALL
+axis2_amqp_receiver_get_reply_to_epr (axis2_transport_receiver_t* receiver,
+ const axutil_env_t* env,
+ const axis2_char_t* svc_name);
+
+axis2_conf_ctx_t* AXIS2_CALL
+axis2_amqp_receiver_get_conf_ctx (axis2_transport_receiver_t* receiver,
+ const axutil_env_t* env);
+
+axis2_bool_t AXIS2_CALL
+axis2_amqp_receiver_is_running (axis2_transport_receiver_t* receiver,
+ const axutil_env_t* env);
+
+axis2_status_t AXIS2_CALL
+axis2_amqp_receiver_stop (axis2_transport_receiver_t* receiver,
+ const axutil_env_t* env);
+
+void AXIS2_CALL
+axis2_amqp_receiver_free (axis2_transport_receiver_t* receiver,
+ const axutil_env_t* env);
+
+#endif
Added: webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/Makefile.am?rev=664506&view=auto
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/Makefile.am (added)
+++ webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/Makefile.am Sun Jun 8 06:25:38 2008
@@ -0,0 +1,50 @@
+SUBDIRS = request_processor
+
+lib_LTLIBRARIES = libaxis2_qpid_receiver.la
+
+libaxis2_qpid_receiver_la_SOURCES = axis2_qpid_receiver.cpp \
+ axis2_qpid_receiver_interface.cpp
+
+libaxis2_qpid_receiver_la_LIBADD = $(top_builddir)/util/src/libaxutil.la \
+ $(QPID_HOME)/lib/libqpidclient.la \
+ $(top_builddir)/src/core/transport/amqp/receiver/qpid_receiver/request_processor/libaxis2_amqp_request_processor.la
+
+libaxis2_qpid_receiver_la_LDFLAGS = g++ -version-info $(VERSION_NO)
+
+INCLUDES = -I$(top_builddir)/include \
+ -I$(top_builddir)/src/core/transport/amqp/receiver/qpid_receiver \
+ -I$(top_builddir)/src/core/transport/amqp/receiver/qpid_receiver/request_processor \
+ -I$(top_builddir)/src/core/transport/amqp/util \
+ -I$(top_builddir)/src/core/description \
+ -I$(top_builddir)/src/core/context \
+ -I$(top_builddir)/src/core/phaseresolver \
+ -I$(top_builddir)/src/core/engine \
+ -I$(top_builddir)/src/core/deployment \
+ -I$(top_builddir)/util/include \
+ -I$(top_builddir)/axiom/include \
+ -I$(QPID_HOME)/include
+SUBDIRS = request_processor
+
+lib_LTLIBRARIES = libaxis2_qpid_receiver.la
+
+libaxis2_qpid_receiver_la_SOURCES = axis2_qpid_receiver.cpp \
+ axis2_qpid_receiver_interface.cpp
+
+libaxis2_qpid_receiver_la_LIBADD = $(top_builddir)/util/src/libaxutil.la \
+ $(QPID_HOME)/lib/libqpidclient.la \
+ $(top_builddir)/src/core/transport/amqp/receiver/qpid_receiver/request_processor/libaxis2_amqp_request_processor.la
+
+libaxis2_qpid_receiver_la_LDFLAGS = g++ -version-info $(VERSION_NO)
+
+INCLUDES = -I$(top_builddir)/include \
+ -I$(top_builddir)/src/core/transport/amqp/receiver/qpid_receiver \
+ -I$(top_builddir)/src/core/transport/amqp/receiver/qpid_receiver/request_processor \
+ -I$(top_builddir)/src/core/transport/amqp/util \
+ -I$(top_builddir)/src/core/description \
+ -I$(top_builddir)/src/core/context \
+ -I$(top_builddir)/src/core/phaseresolver \
+ -I$(top_builddir)/src/core/engine \
+ -I$(top_builddir)/src/core/deployment \
+ -I$(top_builddir)/util/include \
+ -I$(top_builddir)/axiom/include \
+ -I$(QPID_HOME)/include
Added: webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/axis2_qpid_receiver.cpp
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/axis2_qpid_receiver.cpp?rev=664506&view=auto
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/axis2_qpid_receiver.cpp (added)
+++ webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/axis2_qpid_receiver.cpp Sun Jun 8 06:25:38 2008
@@ -0,0 +1,386 @@
+/*
+ * 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
+ *
+ * tcp://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.
+ */
+
+#include <axis2_amqp_request_processor.h>
+#include <axis2_amqp_defines.h>
+#include <axis2_qpid_receiver.h>
+
+#define AXIS2_AMQP_RECEIVER_QUEUE_NAME "axis2.amqp.receiver.queue"
+
+Axis2QpidReceiver::Axis2QpidReceiver (const axutil_env_t* env,
+ axis2_conf_ctx_t* conf_ctx,
+ string qpidBrokerIP,
+ int qpidBrokerPort)
+{
+ this->env = env;
+ this->conf_ctx = conf_ctx;
+ this->qpidBrokerIP = qpidBrokerIP;
+ this->qpidBrokerPort = qpidBrokerPort;
+ this->dispatcher = NULL;
+}
+
+
+Axis2QpidReceiver::~Axis2QpidReceiver (void)
+{
+ if (dispatcher)
+ delete dispatcher;
+}
+
+
+bool Axis2QpidReceiver::start (void)
+{
+ bool status = false;
+
+ while (true)
+ {
+ try
+ {
+ /* Create Connection to Qpid Broker */
+ std::cout << "Connecting to Qpid Broker on " << qpidBrokerIP
+ << ":" << qpidBrokerPort << " ... ";
+
+ connection.open (qpidBrokerIP, qpidBrokerPort);
+
+ session = connection.newSession ();
+
+ string request_queue = AXIS2_AMQP_RECEIVER_QUEUE_NAME;
+
+ session.queueDeclare (arg::queue = request_queue);
+ session.exchangeBind (arg::exchange = AXIS2_AMQP_EXCHANGE_DIRECT,
+ arg::queue = request_queue,
+ arg::bindingKey = AXIS2_AMQP_RECEIVER_QUEUE_BIND_KEY);
+
+ /* Create Dispatcher */
+ dispatcher = new Dispatcher (session);
+
+ status = true;
+
+ std::cout << "CONNECTED" << std::endl;
+
+ break;
+ }
+ catch (const std::exception& e)
+ {
+ std::cout << "FAILED" << std::endl;
+ connection.close ();
+
+ sleep (5);
+ }
+ }
+
+ /* Listen and Wait */
+ if (status)
+ {
+ std::cout << "Started Axis2 AMQP Server ..." << std::endl;
+
+ listen ();
+ wait ();
+ }
+
+ return status;
+}
+
+
+bool Axis2QpidReceiver::shutdown (void)
+{
+ connection.close ();
+
+ return true;
+}
+
+
+void Axis2QpidReceiver::received (Message& message)
+{
+ AXIS2_ENV_CHECK (env, void);
+
+ axis2_amqp_request_processor_resource_pack_t* request_data = NULL;
+#ifdef AXIS2_SVR_MULTI_THREADED
+ axutil_thread_t* worker_thread = NULL;
+#endif
+
+ request_data = (axis2_amqp_request_processor_resource_pack_t*)
+ AXIS2_MALLOC (env->allocator,
+ sizeof (axis2_amqp_request_processor_resource_pack_t));
+
+ if (!request_data)
+ {
+ AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, "Memory Allocation Error");
+ return;
+ }
+
+ request_data->env = (axutil_env_t*)env;
+ request_data->conf_ctx = conf_ctx;
+
+ /* Create a Local Copy of Request Content */
+ std::string message_data = message.getData ();
+ axis2_char_t* request_content = (axis2_char_t*)AXIS2_MALLOC (env->allocator,
+ message_data.size () + 1);
+ strcpy (request_content, message_data.c_str ());
+
+ request_data->request_content = request_content;
+
+ /* Set ReplyTo */
+ request_data->reply_to = NULL;
+ if (message.getMessageProperties ().hasReplyTo ())
+ {
+ /* Create a Local Copy of ReplyTo */
+ std::string reply_to_tmp = message.getMessageProperties ().getReplyTo ().getRoutingKey ();
+ axis2_char_t* reply_to = (axis2_char_t*)AXIS2_MALLOC (env->allocator,
+ reply_to_tmp.size () + 1);
+ strcpy (reply_to, reply_to_tmp.c_str ());
+
+ request_data->reply_to = reply_to;
+ }
+
+ /* Set Qpid Broker IP/Port */
+ request_data->qpid_broker_ip = (axis2_char_t*)qpidBrokerIP.c_str ();
+ request_data->qpid_broker_port = qpidBrokerPort;
+
+#ifdef AXIS2_SVR_MULTI_THREADED
+ worker_thread = axutil_thread_pool_get_thread (env->thread_pool,
+ axis2_amqp_request_processor_thread_function,
+ (void*)request_data);
+
+ if (!worker_thread)
+ {
+ AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, "Failed to Create Thread");
+ return;
+ }
+
+ axutil_thread_pool_thread_detach (env->thread_pool, worker_thread);
+#else
+ axis2_amqp_request_processor_thread_function (NULL, (void*)request_data);
+#endif
+}
+
+
+void Axis2QpidReceiver::listen (void)
+{
+ if (!dispatcher)
+ return;
+
+ string request_queue = AXIS2_AMQP_RECEIVER_QUEUE_NAME;
+
+ session.messageSubscribe (arg::queue = request_queue, arg::destination = request_queue);
+
+ session.messageFlow (arg::destination = request_queue, arg::unit = MESSAGE_CREDIT, arg::value = 1);
+ session.messageFlow (arg::destination = request_queue, arg::unit = BYTE_CREDIT, arg::value = UNLIMITED_CREDIT);
+
+ dispatcher->listen (request_queue, this);
+}
+
+
+void Axis2QpidReceiver::wait (void)
+{
+ if (!dispatcher)
+ return;
+
+ dispatcher->run ();
+}
+/*
+ * 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
+ *
+ * tcp://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.
+ */
+
+#include <axis2_amqp_request_processor.h>
+#include <axis2_amqp_defines.h>
+#include <axis2_qpid_receiver.h>
+
+#define AXIS2_AMQP_RECEIVER_QUEUE_NAME "axis2.amqp.receiver.queue"
+
+Axis2QpidReceiver::Axis2QpidReceiver (const axutil_env_t* env,
+ axis2_conf_ctx_t* conf_ctx,
+ string qpidBrokerIP,
+ int qpidBrokerPort)
+{
+ this->env = env;
+ this->conf_ctx = conf_ctx;
+ this->qpidBrokerIP = qpidBrokerIP;
+ this->qpidBrokerPort = qpidBrokerPort;
+ this->dispatcher = NULL;
+}
+
+
+Axis2QpidReceiver::~Axis2QpidReceiver (void)
+{
+ if (dispatcher)
+ delete dispatcher;
+}
+
+
+bool Axis2QpidReceiver::start (void)
+{
+ bool status = false;
+
+ while (true)
+ {
+ try
+ {
+ /* Create Connection to Qpid Broker */
+ std::cout << "Connecting to Qpid Broker on " << qpidBrokerIP
+ << ":" << qpidBrokerPort << " ... ";
+
+ connection.open (qpidBrokerIP, qpidBrokerPort);
+
+ session = connection.newSession ();
+
+ string request_queue = AXIS2_AMQP_RECEIVER_QUEUE_NAME;
+
+ session.queueDeclare (arg::queue = request_queue);
+ session.exchangeBind (arg::exchange = AXIS2_AMQP_EXCHANGE_DIRECT,
+ arg::queue = request_queue,
+ arg::bindingKey = AXIS2_AMQP_RECEIVER_QUEUE_BIND_KEY);
+
+ /* Create Dispatcher */
+ dispatcher = new Dispatcher (session);
+
+ status = true;
+
+ std::cout << "CONNECTED" << std::endl;
+
+ break;
+ }
+ catch (const std::exception& e)
+ {
+ std::cout << "FAILED" << std::endl;
+ connection.close ();
+
+ sleep (5);
+ }
+ }
+
+ /* Listen and Wait */
+ if (status)
+ {
+ std::cout << "Started Axis2 AMQP Server ..." << std::endl;
+
+ listen ();
+ wait ();
+ }
+
+ return status;
+}
+
+
+bool Axis2QpidReceiver::shutdown (void)
+{
+ connection.close ();
+
+ return true;
+}
+
+
+void Axis2QpidReceiver::received (Message& message)
+{
+ AXIS2_ENV_CHECK (env, void);
+
+ axis2_amqp_request_processor_resource_pack_t* request_data = NULL;
+#ifdef AXIS2_SVR_MULTI_THREADED
+ axutil_thread_t* worker_thread = NULL;
+#endif
+
+ request_data = (axis2_amqp_request_processor_resource_pack_t*)
+ AXIS2_MALLOC (env->allocator,
+ sizeof (axis2_amqp_request_processor_resource_pack_t));
+
+ if (!request_data)
+ {
+ AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, "Memory Allocation Error");
+ return;
+ }
+
+ request_data->env = (axutil_env_t*)env;
+ request_data->conf_ctx = conf_ctx;
+
+ /* Create a Local Copy of Request Content */
+ std::string message_data = message.getData ();
+ axis2_char_t* request_content = (axis2_char_t*)AXIS2_MALLOC (env->allocator,
+ message_data.size () + 1);
+ strcpy (request_content, message_data.c_str ());
+
+ request_data->request_content = request_content;
+
+ /* Set ReplyTo */
+ request_data->reply_to = NULL;
+ if (message.getMessageProperties ().hasReplyTo ())
+ {
+ /* Create a Local Copy of ReplyTo */
+ std::string reply_to_tmp = message.getMessageProperties ().getReplyTo ().getRoutingKey ();
+ axis2_char_t* reply_to = (axis2_char_t*)AXIS2_MALLOC (env->allocator,
+ reply_to_tmp.size () + 1);
+ strcpy (reply_to, reply_to_tmp.c_str ());
+
+ request_data->reply_to = reply_to;
+ }
+
+ /* Set Qpid Broker IP/Port */
+ request_data->qpid_broker_ip = (axis2_char_t*)qpidBrokerIP.c_str ();
+ request_data->qpid_broker_port = qpidBrokerPort;
+
+#ifdef AXIS2_SVR_MULTI_THREADED
+ worker_thread = axutil_thread_pool_get_thread (env->thread_pool,
+ axis2_amqp_request_processor_thread_function,
+ (void*)request_data);
+
+ if (!worker_thread)
+ {
+ AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, "Failed to Create Thread");
+ return;
+ }
+
+ axutil_thread_pool_thread_detach (env->thread_pool, worker_thread);
+#else
+ axis2_amqp_request_processor_thread_function (NULL, (void*)request_data);
+#endif
+}
+
+
+void Axis2QpidReceiver::listen (void)
+{
+ if (!dispatcher)
+ return;
+
+ string request_queue = AXIS2_AMQP_RECEIVER_QUEUE_NAME;
+
+ session.messageSubscribe (arg::queue = request_queue, arg::destination = request_queue);
+
+ session.messageFlow (arg::destination = request_queue, arg::unit = MESSAGE_CREDIT, arg::value = 1);
+ session.messageFlow (arg::destination = request_queue, arg::unit = BYTE_CREDIT, arg::value = UNLIMITED_CREDIT);
+
+ dispatcher->listen (request_queue, this);
+}
+
+
+void Axis2QpidReceiver::wait (void)
+{
+ if (!dispatcher)
+ return;
+
+ dispatcher->run ();
+}
Added: webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/axis2_qpid_receiver.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/axis2_qpid_receiver.h?rev=664506&view=auto
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/axis2_qpid_receiver.h (added)
+++ webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/axis2_qpid_receiver.h Sun Jun 8 06:25:38 2008
@@ -0,0 +1,122 @@
+/*
+ * 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
+ *
+ * tcp://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.
+ */
+
+#ifndef AXIS2_QPID_RECEIVER_H
+#define AXIS2_QPID_RECEIVER_H
+
+#include <qpid/client/Connection.h>
+#include <qpid/client/Dispatcher.h>
+#include <qpid/client/Session.h>
+#include <qpid/client/Message.h>
+#include <qpid/client/MessageListener.h>
+#include <axutil_env.h>
+#include <axis2_conf_init.h>
+
+#include <string>
+
+using namespace qpid::client;
+using namespace qpid::framing;
+using std::string;
+
+class Axis2QpidReceiver : public MessageListener
+{
+ public:
+ Axis2QpidReceiver (const axutil_env_t* env,
+ axis2_conf_ctx_t* conf_ctx,
+ string qpidBrokerIP,
+ int qpidBrokerPort);
+ ~Axis2QpidReceiver (void);
+
+ bool start (void);
+ bool shutdown (void);
+
+ private:
+ virtual void received (Message& message);
+ virtual void listen (void);
+ virtual void wait (void);
+
+ const axutil_env_t* env;
+ axis2_conf_ctx_t* conf_ctx;
+ string qpidBrokerIP;
+ int qpidBrokerPort;
+ Connection connection;
+ Dispatcher* dispatcher;
+ Session session;
+};
+
+#endif
+/*
+ * 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
+ *
+ * tcp://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.
+ */
+
+#ifndef AXIS2_QPID_RECEIVER_H
+#define AXIS2_QPID_RECEIVER_H
+
+#include <qpid/client/Connection.h>
+#include <qpid/client/Dispatcher.h>
+#include <qpid/client/Session.h>
+#include <qpid/client/Message.h>
+#include <qpid/client/MessageListener.h>
+#include <axutil_env.h>
+#include <axis2_conf_init.h>
+
+#include <string>
+
+using namespace qpid::client;
+using namespace qpid::framing;
+using std::string;
+
+class Axis2QpidReceiver : public MessageListener
+{
+ public:
+ Axis2QpidReceiver (const axutil_env_t* env,
+ axis2_conf_ctx_t* conf_ctx,
+ string qpidBrokerIP,
+ int qpidBrokerPort);
+ ~Axis2QpidReceiver (void);
+
+ bool start (void);
+ bool shutdown (void);
+
+ private:
+ virtual void received (Message& message);
+ virtual void listen (void);
+ virtual void wait (void);
+
+ const axutil_env_t* env;
+ axis2_conf_ctx_t* conf_ctx;
+ string qpidBrokerIP;
+ int qpidBrokerPort;
+ Connection connection;
+ Dispatcher* dispatcher;
+ Session session;
+};
+
+#endif
Added: webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/axis2_qpid_receiver_interface.cpp
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/axis2_qpid_receiver_interface.cpp?rev=664506&view=auto
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/axis2_qpid_receiver_interface.cpp (added)
+++ webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/axis2_qpid_receiver_interface.cpp Sun Jun 8 06:25:38 2008
@@ -0,0 +1,206 @@
+/*
+* 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.
+*/
+
+#include <axis2_qpid_receiver.h>
+#include <axis2_qpid_receiver_interface.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+axis2_qpid_receiver_resource_pack_t* AXIS2_CALL
+axis2_qpid_receiver_create (const axutil_env_t* env,
+ axis2_conf_ctx_t* conf_ctx,
+ const axis2_char_t* qpid_broker_ip,
+ int qpid_broker_port)
+{
+ AXIS2_ENV_CHECK (env, NULL);
+
+ axis2_qpid_receiver_resource_pack_t* resource_pack = NULL;
+
+ resource_pack = (axis2_qpid_receiver_resource_pack_t*)AXIS2_MALLOC
+ (env->allocator, sizeof (axis2_qpid_receiver_resource_pack_t));
+
+ if (!resource_pack)
+ {
+ AXIS2_ERROR_SET (env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
+ /* Create Qpid Receiver */
+ Axis2QpidReceiver* qpid_receiver = new Axis2QpidReceiver(env,
+ conf_ctx,
+ qpid_broker_ip,
+ qpid_broker_port);
+
+ resource_pack->qpid_receiver = qpid_receiver;
+
+ return resource_pack;
+}
+
+
+axis2_status_t AXIS2_CALL
+axis2_qpid_receiver_start (axis2_qpid_receiver_resource_pack_t* receiver_resource_pack,
+ const axutil_env_t* env)
+{
+ AXIS2_ENV_CHECK (env, AXIS2_FAILURE);
+
+ axis2_status_t status = AXIS2_FAILURE;
+
+ /* Start Qpid Receiver */
+ Axis2QpidReceiver* qpid_receiver = (Axis2QpidReceiver*)receiver_resource_pack->qpid_receiver;
+
+ if ((qpid_receiver) && (qpid_receiver->start ()))
+ {
+ status = AXIS2_SUCCESS;
+ }
+
+ return status;
+}
+
+
+axis2_bool_t AXIS2_CALL
+axis2_qpid_receiver_is_running (axis2_qpid_receiver_resource_pack_t* receiver_resource_pack,
+ const axutil_env_t* env)
+{
+ return AXIS2_TRUE;
+}
+
+
+void AXIS2_CALL
+axis2_qpid_receiver_free (axis2_qpid_receiver_resource_pack_t* receiver_resource_pack,
+ const axutil_env_t* env)
+{
+ AXIS2_ENV_CHECK (env, void);
+
+ if (receiver_resource_pack)
+ {
+ Axis2QpidReceiver* qpid_receiver = (Axis2QpidReceiver*)receiver_resource_pack->qpid_receiver;
+ if (qpid_receiver)
+ delete qpid_receiver;
+
+ AXIS2_FREE (env->allocator, receiver_resource_pack);
+ }
+}
+
+#ifdef __cplusplus
+}
+#endif
+/*
+* 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.
+*/
+
+#include <axis2_qpid_receiver.h>
+#include <axis2_qpid_receiver_interface.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+axis2_qpid_receiver_resource_pack_t* AXIS2_CALL
+axis2_qpid_receiver_create (const axutil_env_t* env,
+ axis2_conf_ctx_t* conf_ctx,
+ const axis2_char_t* qpid_broker_ip,
+ int qpid_broker_port)
+{
+ AXIS2_ENV_CHECK (env, NULL);
+
+ axis2_qpid_receiver_resource_pack_t* resource_pack = NULL;
+
+ resource_pack = (axis2_qpid_receiver_resource_pack_t*)AXIS2_MALLOC
+ (env->allocator, sizeof (axis2_qpid_receiver_resource_pack_t));
+
+ if (!resource_pack)
+ {
+ AXIS2_ERROR_SET (env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
+ /* Create Qpid Receiver */
+ Axis2QpidReceiver* qpid_receiver = new Axis2QpidReceiver(env,
+ conf_ctx,
+ qpid_broker_ip,
+ qpid_broker_port);
+
+ resource_pack->qpid_receiver = qpid_receiver;
+
+ return resource_pack;
+}
+
+
+axis2_status_t AXIS2_CALL
+axis2_qpid_receiver_start (axis2_qpid_receiver_resource_pack_t* receiver_resource_pack,
+ const axutil_env_t* env)
+{
+ AXIS2_ENV_CHECK (env, AXIS2_FAILURE);
+
+ axis2_status_t status = AXIS2_FAILURE;
+
+ /* Start Qpid Receiver */
+ Axis2QpidReceiver* qpid_receiver = (Axis2QpidReceiver*)receiver_resource_pack->qpid_receiver;
+
+ if ((qpid_receiver) && (qpid_receiver->start ()))
+ {
+ status = AXIS2_SUCCESS;
+ }
+
+ return status;
+}
+
+
+axis2_bool_t AXIS2_CALL
+axis2_qpid_receiver_is_running (axis2_qpid_receiver_resource_pack_t* receiver_resource_pack,
+ const axutil_env_t* env)
+{
+ return AXIS2_TRUE;
+}
+
+
+void AXIS2_CALL
+axis2_qpid_receiver_free (axis2_qpid_receiver_resource_pack_t* receiver_resource_pack,
+ const axutil_env_t* env)
+{
+ AXIS2_ENV_CHECK (env, void);
+
+ if (receiver_resource_pack)
+ {
+ Axis2QpidReceiver* qpid_receiver = (Axis2QpidReceiver*)receiver_resource_pack->qpid_receiver;
+ if (qpid_receiver)
+ delete qpid_receiver;
+
+ AXIS2_FREE (env->allocator, receiver_resource_pack);
+ }
+}
+
+#ifdef __cplusplus
+}
+#endif
Added: webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/axis2_qpid_receiver_interface.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/axis2_qpid_receiver_interface.h?rev=664506&view=auto
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/axis2_qpid_receiver_interface.h (added)
+++ webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/axis2_qpid_receiver_interface.h Sun Jun 8 06:25:38 2008
@@ -0,0 +1,114 @@
+/*
+* 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.
+*/
+
+#ifndef AXIS2_QPID_RECEIVER_INTERFACE_H
+#define AXIS2_QPID_RECEIVER_INTERFACE_H
+
+#include <axis2_util.h>
+#include <axis2_conf_init.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+typedef struct axis2_qpid_receiver_resource_pack
+{
+ void* qpid_receiver;
+}
+axis2_qpid_receiver_resource_pack_t;
+
+axis2_qpid_receiver_resource_pack_t* AXIS2_CALL
+axis2_qpid_receiver_create (const axutil_env_t* env,
+ axis2_conf_ctx_t* conf_ctx,
+ const axis2_char_t* qpid_broker_ip,
+ int qpid_broker_port);
+
+axis2_status_t AXIS2_CALL
+axis2_qpid_receiver_start (axis2_qpid_receiver_resource_pack_t* receiver_resource_pack,
+ const axutil_env_t* env);
+
+axis2_bool_t AXIS2_CALL
+axis2_qpid_receiver_is_running (axis2_qpid_receiver_resource_pack_t* receiver_resource_pack,
+ const axutil_env_t* env);
+
+void AXIS2_CALL
+axis2_qpid_receiver_free (axis2_qpid_receiver_resource_pack_t* receiver_resource_pack,
+ const axutil_env_t* env);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/*
+* 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.
+*/
+
+#ifndef AXIS2_QPID_RECEIVER_INTERFACE_H
+#define AXIS2_QPID_RECEIVER_INTERFACE_H
+
+#include <axis2_util.h>
+#include <axis2_conf_init.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+typedef struct axis2_qpid_receiver_resource_pack
+{
+ void* qpid_receiver;
+}
+axis2_qpid_receiver_resource_pack_t;
+
+axis2_qpid_receiver_resource_pack_t* AXIS2_CALL
+axis2_qpid_receiver_create (const axutil_env_t* env,
+ axis2_conf_ctx_t* conf_ctx,
+ const axis2_char_t* qpid_broker_ip,
+ int qpid_broker_port);
+
+axis2_status_t AXIS2_CALL
+axis2_qpid_receiver_start (axis2_qpid_receiver_resource_pack_t* receiver_resource_pack,
+ const axutil_env_t* env);
+
+axis2_bool_t AXIS2_CALL
+axis2_qpid_receiver_is_running (axis2_qpid_receiver_resource_pack_t* receiver_resource_pack,
+ const axutil_env_t* env);
+
+void AXIS2_CALL
+axis2_qpid_receiver_free (axis2_qpid_receiver_resource_pack_t* receiver_resource_pack,
+ const axutil_env_t* env);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
Added: webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/request_processor/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/request_processor/Makefile.am?rev=664506&view=auto
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/request_processor/Makefile.am (added)
+++ webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/request_processor/Makefile.am Sun Jun 8 06:25:38 2008
@@ -0,0 +1,36 @@
+lib_LTLIBRARIES = libaxis2_amqp_request_processor.la
+
+libaxis2_amqp_request_processor_la_SOURCES = axis2_amqp_request_processor.c
+
+libaxis2_amqp_request_processor_la_LIBADD = $(top_builddir)/util/src/libaxutil.la
+
+libaxis2_amqp_request_processor_la_LDFLAGS = -version-info $(VERSION_NO)
+
+INCLUDES = -I$(top_builddir)/include \
+ -I$(top_builddir)/src/core/transport/amqp/receiver/qpid_receiver/request_processor \
+ -I$(top_builddir)/src/core/transport/amqp/util \
+ -I$(top_builddir)/src/core/description \
+ -I$(top_builddir)/src/core/context \
+ -I$(top_builddir)/src/core/phaseresolver \
+ -I$(top_builddir)/src/core/engine \
+ -I$(top_builddir)/src/core/deployment \
+ -I$(top_builddir)/util/include \
+ -I$(top_builddir)/axiom/include
+lib_LTLIBRARIES = libaxis2_amqp_request_processor.la
+
+libaxis2_amqp_request_processor_la_SOURCES = axis2_amqp_request_processor.c
+
+libaxis2_amqp_request_processor_la_LIBADD = $(top_builddir)/util/src/libaxutil.la
+
+libaxis2_amqp_request_processor_la_LDFLAGS = -version-info $(VERSION_NO)
+
+INCLUDES = -I$(top_builddir)/include \
+ -I$(top_builddir)/src/core/transport/amqp/receiver/qpid_receiver/request_processor \
+ -I$(top_builddir)/src/core/transport/amqp/util \
+ -I$(top_builddir)/src/core/description \
+ -I$(top_builddir)/src/core/context \
+ -I$(top_builddir)/src/core/phaseresolver \
+ -I$(top_builddir)/src/core/engine \
+ -I$(top_builddir)/src/core/deployment \
+ -I$(top_builddir)/util/include \
+ -I$(top_builddir)/axiom/include
Added: webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/request_processor/axis2_amqp_request_processor.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/request_processor/axis2_amqp_request_processor.c?rev=664506&view=auto
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/request_processor/axis2_amqp_request_processor.c (added)
+++ webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/request_processor/axis2_amqp_request_processor.c Sun Jun 8 06:25:38 2008
@@ -0,0 +1,342 @@
+/*
+ * 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.
+ */
+
+#include <signal.h>
+#include <axiom.h>
+#include <axiom_soap.h>
+#include <axis2_engine.h>
+#include <axis2_amqp_defines.h>
+#include <axis2_amqp_request_processor.h>
+
+void* AXIS2_THREAD_FUNC
+axis2_amqp_request_processor_thread_function (axutil_thread_t* thread,
+ void* request_data)
+{
+ axis2_status_t status = AXIS2_FAILURE;
+ axutil_env_t* env = NULL;
+ axutil_env_t* thread_env = NULL;
+ axis2_amqp_request_processor_resource_pack_t* request_resource_pack = NULL;
+
+#ifndef WIN32
+#ifdef AXIS2_SVR_MULTI_THREADED
+ signal (SIGPIPE, SIG_IGN);
+#endif
+#endif
+
+ request_resource_pack = (axis2_amqp_request_processor_resource_pack_t*)request_data;
+
+ env = request_resource_pack->env;
+ thread_env = axutil_init_thread_env (env);
+
+ /* Process Request */
+ status = axis2_amqp_process_request (thread_env, request_resource_pack);
+
+ if (status == AXIS2_SUCCESS)
+ {
+ AXIS2_LOG_INFO (thread_env->log, "Request Processed Successfully");
+ }
+ else
+ {
+ AXIS2_LOG_WARNING (thread_env->log, AXIS2_LOG_SI, "Error while Processing Request");
+ }
+
+ AXIS2_FREE (thread_env->allocator, request_resource_pack->request_content);
+ AXIS2_FREE (thread_env->allocator, request_resource_pack->reply_to);
+ AXIS2_FREE (thread_env->allocator, request_resource_pack);
+
+ if (thread_env)
+ {
+ thread_env = NULL;
+ }
+
+#ifdef AXIS2_SVR_MULTI_THREADED
+ axutil_thread_pool_exit_thread (env->thread_pool, thread);
+#endif
+
+ return NULL;
+}
+
+
+axis2_status_t
+axis2_amqp_process_request (const axutil_env_t* env,
+ axis2_amqp_request_processor_resource_pack_t* request_resource_pack)
+{
+ axiom_xml_reader_t* xml_reader = NULL;
+ axiom_stax_builder_t* stax_builder = NULL;
+ axiom_soap_builder_t* soap_builder = NULL;
+ axis2_transport_out_desc_t* out_desc = NULL;
+ axis2_transport_in_desc_t* in_desc = NULL;
+ axis2_msg_ctx_t* msg_ctx = NULL;
+ axiom_soap_envelope_t* soap_envelope = NULL;
+ axutil_property_t* property = NULL;
+ axis2_engine_t* engine = NULL;
+
+ xml_reader = axiom_xml_reader_create_for_memory (env,
+ request_resource_pack->request_content,
+ axutil_strlen (request_resource_pack->request_content),
+ NULL,
+ AXIS2_XML_PARSER_TYPE_BUFFER);
+ if (!xml_reader)
+ {
+ AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, "Failed to Create XML Reader");
+ return AXIS2_FAILURE;
+ }
+
+ stax_builder = axiom_stax_builder_create (env, xml_reader);
+ if (!stax_builder)
+ {
+ AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, "Failed to Create StAX Builder");
+ return AXIS2_FAILURE;
+ }
+
+ soap_builder = axiom_soap_builder_create (env,
+ stax_builder,
+ AXIOM_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI);
+ if (!soap_builder)
+ {
+ AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, "Failed to Create SOAP Builder");
+ return AXIS2_FAILURE;
+ }
+
+ if (!request_resource_pack->conf_ctx)
+ {
+ AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, "Conf Context not Available");
+ return AXIS2_FAILURE;
+ }
+
+ out_desc = axis2_conf_get_transport_out (axis2_conf_ctx_get_conf (request_resource_pack->conf_ctx,
+ env),
+ env,
+ AXIS2_TRANSPORT_ENUM_AMQP);
+ if (!out_desc)
+ {
+ AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, "Transport Out Descriptor not Found");
+ return AXIS2_FAILURE;
+ }
+
+ in_desc = axis2_conf_get_transport_in (axis2_conf_ctx_get_conf (request_resource_pack->conf_ctx,
+ env),
+ env,
+ AXIS2_TRANSPORT_ENUM_AMQP);
+ if (!in_desc)
+ {
+ AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, "Transport In Descriptor not Found");
+ return AXIS2_FAILURE;
+ }
+
+ msg_ctx = axis2_msg_ctx_create (env,
+ request_resource_pack->conf_ctx,
+ in_desc,
+ out_desc);
+ axis2_msg_ctx_set_server_side (msg_ctx, env, AXIS2_TRUE);
+
+ soap_envelope = axiom_soap_builder_get_soap_envelope (soap_builder, env);
+ axis2_msg_ctx_set_soap_envelope (msg_ctx, env, soap_envelope);
+
+ /* Set ReplyTo in the msg_ctx */
+ property = axutil_property_create (env);
+ axutil_property_set_scope (property, env, AXIS2_SCOPE_REQUEST);
+ axutil_property_set_value (property, env, request_resource_pack->reply_to);
+ axis2_msg_ctx_set_property (msg_ctx, env, AXIS2_AMQP_MSG_CTX_PROPERTY_REPLY_TO, property);
+
+ /* Set Qpid Broker IP in the msg_ctx */
+ property = axutil_property_create (env);
+ axutil_property_set_scope (property, env, AXIS2_SCOPE_REQUEST);
+ axutil_property_set_value (property, env, request_resource_pack->qpid_broker_ip);
+ axis2_msg_ctx_set_property (msg_ctx, env, AXIS2_AMQP_MSG_CTX_PROPERTY_QPID_BROKER_IP, property);
+
+ /* Set Qpid Broker Port in the msg_ctx */
+ property = axutil_property_create (env);
+ axutil_property_set_scope (property, env, AXIS2_SCOPE_REQUEST);
+ axutil_property_set_value (property, env, &request_resource_pack->qpid_broker_port);
+ axis2_msg_ctx_set_property (msg_ctx, env, AXIS2_AMQP_MSG_CTX_PROPERTY_QPID_BROKER_PORT, property);
+
+ engine = axis2_engine_create (env, request_resource_pack->conf_ctx);
+
+ return axis2_engine_receive (engine, env, msg_ctx);
+}
+/*
+ * 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.
+ */
+
+#include <signal.h>
+#include <axiom.h>
+#include <axiom_soap.h>
+#include <axis2_engine.h>
+#include <axis2_amqp_defines.h>
+#include <axis2_amqp_request_processor.h>
+
+void* AXIS2_THREAD_FUNC
+axis2_amqp_request_processor_thread_function (axutil_thread_t* thread,
+ void* request_data)
+{
+ axis2_status_t status = AXIS2_FAILURE;
+ axutil_env_t* env = NULL;
+ axutil_env_t* thread_env = NULL;
+ axis2_amqp_request_processor_resource_pack_t* request_resource_pack = NULL;
+
+#ifndef WIN32
+#ifdef AXIS2_SVR_MULTI_THREADED
+ signal (SIGPIPE, SIG_IGN);
+#endif
+#endif
+
+ request_resource_pack = (axis2_amqp_request_processor_resource_pack_t*)request_data;
+
+ env = request_resource_pack->env;
+ thread_env = axutil_init_thread_env (env);
+
+ /* Process Request */
+ status = axis2_amqp_process_request (thread_env, request_resource_pack);
+
+ if (status == AXIS2_SUCCESS)
+ {
+ AXIS2_LOG_INFO (thread_env->log, "Request Processed Successfully");
+ }
+ else
+ {
+ AXIS2_LOG_WARNING (thread_env->log, AXIS2_LOG_SI, "Error while Processing Request");
+ }
+
+ AXIS2_FREE (thread_env->allocator, request_resource_pack->request_content);
+ AXIS2_FREE (thread_env->allocator, request_resource_pack->reply_to);
+ AXIS2_FREE (thread_env->allocator, request_resource_pack);
+
+ if (thread_env)
+ {
+ thread_env = NULL;
+ }
+
+#ifdef AXIS2_SVR_MULTI_THREADED
+ axutil_thread_pool_exit_thread (env->thread_pool, thread);
+#endif
+
+ return NULL;
+}
+
+
+axis2_status_t
+axis2_amqp_process_request (const axutil_env_t* env,
+ axis2_amqp_request_processor_resource_pack_t* request_resource_pack)
+{
+ axiom_xml_reader_t* xml_reader = NULL;
+ axiom_stax_builder_t* stax_builder = NULL;
+ axiom_soap_builder_t* soap_builder = NULL;
+ axis2_transport_out_desc_t* out_desc = NULL;
+ axis2_transport_in_desc_t* in_desc = NULL;
+ axis2_msg_ctx_t* msg_ctx = NULL;
+ axiom_soap_envelope_t* soap_envelope = NULL;
+ axutil_property_t* property = NULL;
+ axis2_engine_t* engine = NULL;
+
+ xml_reader = axiom_xml_reader_create_for_memory (env,
+ request_resource_pack->request_content,
+ axutil_strlen (request_resource_pack->request_content),
+ NULL,
+ AXIS2_XML_PARSER_TYPE_BUFFER);
+ if (!xml_reader)
+ {
+ AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, "Failed to Create XML Reader");
+ return AXIS2_FAILURE;
+ }
+
+ stax_builder = axiom_stax_builder_create (env, xml_reader);
+ if (!stax_builder)
+ {
+ AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, "Failed to Create StAX Builder");
+ return AXIS2_FAILURE;
+ }
+
+ soap_builder = axiom_soap_builder_create (env,
+ stax_builder,
+ AXIOM_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI);
+ if (!soap_builder)
+ {
+ AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, "Failed to Create SOAP Builder");
+ return AXIS2_FAILURE;
+ }
+
+ if (!request_resource_pack->conf_ctx)
+ {
+ AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, "Conf Context not Available");
+ return AXIS2_FAILURE;
+ }
+
+ out_desc = axis2_conf_get_transport_out (axis2_conf_ctx_get_conf (request_resource_pack->conf_ctx,
+ env),
+ env,
+ AXIS2_TRANSPORT_ENUM_AMQP);
+ if (!out_desc)
+ {
+ AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, "Transport Out Descriptor not Found");
+ return AXIS2_FAILURE;
+ }
+
+ in_desc = axis2_conf_get_transport_in (axis2_conf_ctx_get_conf (request_resource_pack->conf_ctx,
+ env),
+ env,
+ AXIS2_TRANSPORT_ENUM_AMQP);
+ if (!in_desc)
+ {
+ AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, "Transport In Descriptor not Found");
+ return AXIS2_FAILURE;
+ }
+
+ msg_ctx = axis2_msg_ctx_create (env,
+ request_resource_pack->conf_ctx,
+ in_desc,
+ out_desc);
+ axis2_msg_ctx_set_server_side (msg_ctx, env, AXIS2_TRUE);
+
+ soap_envelope = axiom_soap_builder_get_soap_envelope (soap_builder, env);
+ axis2_msg_ctx_set_soap_envelope (msg_ctx, env, soap_envelope);
+
+ /* Set ReplyTo in the msg_ctx */
+ property = axutil_property_create (env);
+ axutil_property_set_scope (property, env, AXIS2_SCOPE_REQUEST);
+ axutil_property_set_value (property, env, request_resource_pack->reply_to);
+ axis2_msg_ctx_set_property (msg_ctx, env, AXIS2_AMQP_MSG_CTX_PROPERTY_REPLY_TO, property);
+
+ /* Set Qpid Broker IP in the msg_ctx */
+ property = axutil_property_create (env);
+ axutil_property_set_scope (property, env, AXIS2_SCOPE_REQUEST);
+ axutil_property_set_value (property, env, request_resource_pack->qpid_broker_ip);
+ axis2_msg_ctx_set_property (msg_ctx, env, AXIS2_AMQP_MSG_CTX_PROPERTY_QPID_BROKER_IP, property);
+
+ /* Set Qpid Broker Port in the msg_ctx */
+ property = axutil_property_create (env);
+ axutil_property_set_scope (property, env, AXIS2_SCOPE_REQUEST);
+ axutil_property_set_value (property, env, &request_resource_pack->qpid_broker_port);
+ axis2_msg_ctx_set_property (msg_ctx, env, AXIS2_AMQP_MSG_CTX_PROPERTY_QPID_BROKER_PORT, property);
+
+ engine = axis2_engine_create (env, request_resource_pack->conf_ctx);
+
+ return axis2_engine_receive (engine, env, msg_ctx);
+}
Added: webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/request_processor/axis2_amqp_request_processor.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/request_processor/axis2_amqp_request_processor.h?rev=664506&view=auto
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/request_processor/axis2_amqp_request_processor.h (added)
+++ webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/request_processor/axis2_amqp_request_processor.h Sun Jun 8 06:25:38 2008
@@ -0,0 +1,106 @@
+/*
+ * 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.
+ */
+
+#ifndef AXIS2_AMQP_REQUEST_PROCESSOR_H
+#define AXIS2_AMQP_REQUEST_PROCESSOR_H
+
+#include <axutil_env.h>
+#include <axis2_conf_init.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+typedef struct axis2_amqp_request_processor_resource_pack
+{
+ axutil_env_t* env;
+ axis2_conf_ctx_t* conf_ctx;
+ axis2_char_t* request_content;
+ axis2_char_t* reply_to;
+ axis2_char_t* qpid_broker_ip;
+ int qpid_broker_port;
+}
+axis2_amqp_request_processor_resource_pack_t;
+
+/* The worker thread function */
+void* AXIS2_THREAD_FUNC
+axis2_amqp_request_processor_thread_function (axutil_thread_t* thread,
+ void* request_data);
+
+axis2_status_t
+axis2_amqp_process_request (const axutil_env_t* env,
+ axis2_amqp_request_processor_resource_pack_t* request_resource_pack);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/*
+ * 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.
+ */
+
+#ifndef AXIS2_AMQP_REQUEST_PROCESSOR_H
+#define AXIS2_AMQP_REQUEST_PROCESSOR_H
+
+#include <axutil_env.h>
+#include <axis2_conf_init.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+typedef struct axis2_amqp_request_processor_resource_pack
+{
+ axutil_env_t* env;
+ axis2_conf_ctx_t* conf_ctx;
+ axis2_char_t* request_content;
+ axis2_char_t* reply_to;
+ axis2_char_t* qpid_broker_ip;
+ int qpid_broker_port;
+}
+axis2_amqp_request_processor_resource_pack_t;
+
+/* The worker thread function */
+void* AXIS2_THREAD_FUNC
+axis2_amqp_request_processor_thread_function (axutil_thread_t* thread,
+ void* request_data);
+
+axis2_status_t
+axis2_amqp_process_request (const axutil_env_t* env,
+ axis2_amqp_request_processor_resource_pack_t* request_resource_pack);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
Added: webservices/axis2/trunk/c/src/core/transport/amqp/sender/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/amqp/sender/Makefile.am?rev=664506&view=auto
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/amqp/sender/Makefile.am (added)
+++ webservices/axis2/trunk/c/src/core/transport/amqp/sender/Makefile.am Sun Jun 8 06:25:38 2008
@@ -0,0 +1,46 @@
+SUBDIRS = qpid_sender
+
+lib_LTLIBRARIES = libaxis2_amqp_sender.la
+
+libaxis2_amqp_sender_la_SOURCES = axis2_amqp_sender.c
+
+libaxis2_amqp_sender_la_LIBADD = $(top_builddir)/util/src/libaxutil.la \
+ $(top_builddir)/src/core/transport/amqp/util/libaxis2_amqp_util.la \
+ $(top_builddir)/src/core/transport/amqp/sender/qpid_sender/libaxis2_qpid_sender.la
+
+libaxis2_amqp_sender_la_LDFLAGS = -version-info $(VERSION_NO)
+
+INCLUDES = -I$(top_builddir)/include \
+ -I$(top_builddir)/src/core/transport/amqp/util \
+ -I$(top_builddir)/src/core/transport/amqp/sender \
+ -I$(top_builddir)/src/core/transport/amqp/sender/qpid_sender \
+ -I$(top_builddir)/src/core/description \
+ -I$(top_builddir)/src/core/context \
+ -I$(top_builddir)/src/core/phaseresolver \
+ -I$(top_builddir)/src/core/engine \
+ -I$(top_builddir)/src/core/deployment \
+ -I$(top_builddir)/util/include \
+ -I$(top_builddir)/axiom/include
+SUBDIRS = qpid_sender
+
+lib_LTLIBRARIES = libaxis2_amqp_sender.la
+
+libaxis2_amqp_sender_la_SOURCES = axis2_amqp_sender.c
+
+libaxis2_amqp_sender_la_LIBADD = $(top_builddir)/util/src/libaxutil.la \
+ $(top_builddir)/src/core/transport/amqp/util/libaxis2_amqp_util.la \
+ $(top_builddir)/src/core/transport/amqp/sender/qpid_sender/libaxis2_qpid_sender.la
+
+libaxis2_amqp_sender_la_LDFLAGS = -version-info $(VERSION_NO)
+
+INCLUDES = -I$(top_builddir)/include \
+ -I$(top_builddir)/src/core/transport/amqp/util \
+ -I$(top_builddir)/src/core/transport/amqp/sender \
+ -I$(top_builddir)/src/core/transport/amqp/sender/qpid_sender \
+ -I$(top_builddir)/src/core/description \
+ -I$(top_builddir)/src/core/context \
+ -I$(top_builddir)/src/core/phaseresolver \
+ -I$(top_builddir)/src/core/engine \
+ -I$(top_builddir)/src/core/deployment \
+ -I$(top_builddir)/util/include \
+ -I$(top_builddir)/axiom/include