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 [2/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...
Added: webservices/axis2/trunk/c/src/core/transport/amqp/sender/axis2_amqp_sender.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/amqp/sender/axis2_amqp_sender.c?rev=664506&view=auto
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/amqp/sender/axis2_amqp_sender.c (added)
+++ webservices/axis2/trunk/c/src/core/transport/amqp/sender/axis2_amqp_sender.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 <axiom_soap.h>
+#include <axis2_amqp_defines.h>
+#include <axis2_amqp_util.h>
+#include <axis2_amqp_sender.h>
+
+static const axis2_transport_sender_ops_t amqp_sender_ops = {
+ axis2_amqp_sender_init,
+ axis2_amqp_sender_invoke,
+ axis2_amqp_sender_clean_up,
+ axis2_amqp_sender_free};
+
+axis2_transport_sender_t* AXIS2_CALL
+axis2_amqp_sender_create (const axutil_env_t* env)
+{
+ AXIS2_ENV_CHECK (env, NULL);
+
+ axis2_amqp_sender_resource_pack_t* sender_resource_pack = NULL;
+
+ sender_resource_pack = (axis2_amqp_sender_resource_pack_t*)
+ AXIS2_MALLOC (env->allocator,
+ sizeof (axis2_amqp_sender_resource_pack_t));
+
+ if (!sender_resource_pack)
+ {
+ AXIS2_ERROR_SET (env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
+ sender_resource_pack->sender.ops = &amqp_sender_ops;
+
+ return &(sender_resource_pack->sender);
+}
+
+
+axis2_status_t AXIS2_CALL
+axis2_amqp_sender_init (axis2_transport_sender_t* sender,
+ const axutil_env_t* env,
+ axis2_conf_ctx_t* conf_ctx,
+ axis2_transport_out_desc_t* out_desc)
+{
+ return AXIS2_SUCCESS;
+}
+
+
+axis2_status_t AXIS2_CALL
+axis2_amqp_sender_invoke (axis2_transport_sender_t* sender,
+ const axutil_env_t* env,
+ axis2_msg_ctx_t* msg_ctx)
+{
+ AXIS2_ENV_CHECK (env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK (env->error, msg_ctx, AXIS2_FAILURE);
+
+ axiom_soap_envelope_t* request_soap_envelope = NULL;
+ axiom_xml_writer_t* xml_writer = NULL;
+ axiom_output_t* request_om_output = NULL;
+ axis2_char_t* request_content = NULL;
+ axis2_char_t* response_content = NULL;
+ axiom_soap_envelope_t* response_soap_envelope = NULL;
+ axis2_op_t* op = NULL;
+ const axis2_char_t* mep = NULL;
+ axis2_bool_t is_server = AXIS2_TRUE;
+ axis2_char_t* qpid_broker_ip = NULL;
+ int qpid_broker_port = 0;
+ axis2_char_t* send_to = NULL;
+
+ request_soap_envelope = axis2_msg_ctx_get_soap_envelope (msg_ctx, env);
+
+ xml_writer = axiom_xml_writer_create_for_memory (env,
+ NULL,
+ AXIS2_TRUE,
+ 0,
+ AXIS2_XML_PARSER_TYPE_BUFFER);
+ if (!xml_writer)
+ {
+ AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, "Failed to Create XML Writer");
+ return AXIS2_FAILURE;
+ }
+
+ request_om_output = axiom_output_create (env, xml_writer);
+ if (!request_om_output)
+ {
+ AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, "Failed to Create OM Output");
+ axiom_xml_writer_free (xml_writer, env);
+ xml_writer = NULL;
+ return AXIS2_FAILURE;
+ }
+
+ axiom_soap_envelope_serialize (request_soap_envelope, env, request_om_output, AXIS2_FALSE);
+
+ request_content = (axis2_char_t*)axiom_xml_writer_get_xml (xml_writer, env);
+ if (!request_content)
+ {
+ AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, "Failed to Serialize the SOAP Envelope");
+ return AXIS2_FAILURE;
+ }
+
+ op = axis2_msg_ctx_get_op (msg_ctx, env);
+ mep = axis2_op_get_msg_exchange_pattern (op, env);
+
+ is_server = axis2_msg_ctx_get_server_side (msg_ctx, env);
+
+ if (is_server)
+ {
+ /* Get Qpid Broker IP/Port/ReplyTo from the msg_ctx */
+ qpid_broker_ip = (axis2_char_t*)axis2_msg_ctx_get_property_value (msg_ctx,
+ env,
+ AXIS2_AMQP_MSG_CTX_PROPERTY_QPID_BROKER_IP);
+
+ qpid_broker_port = *(int*)axis2_msg_ctx_get_property_value (msg_ctx,
+ env,
+ AXIS2_AMQP_MSG_CTX_PROPERTY_QPID_BROKER_PORT);
+
+ send_to = (axis2_char_t*)axis2_msg_ctx_get_property_value (msg_ctx,
+ env,
+ AXIS2_AMQP_MSG_CTX_PROPERTY_REPLY_TO);
+
+ axis2_qpid_server_send (request_content,
+ qpid_broker_ip,
+ qpid_broker_port,
+ send_to);
+ }
+ else
+ {
+ /* Get Qpid Broker IP/Port from the Request URI */
+ qpid_broker_ip = axis2_amqp_util_get_qpid_broker_ip (msg_ctx, env);
+ qpid_broker_port = axis2_amqp_util_get_qpid_broker_port (msg_ctx, env);
+
+ if (axutil_strcmp (mep, AXIS2_MEP_URI_OUT_ONLY) == 0 ||
+ axutil_strcmp (mep, AXIS2_MEP_URI_ROBUST_OUT_ONLY) == 0)
+ {
+ axis2_qpid_client_send (request_content,
+ qpid_broker_ip,
+ qpid_broker_port);
+ }
+ else
+ {
+ response_content = axis2_qpid_client_request (request_content,
+ qpid_broker_ip,
+ qpid_broker_port,
+ env);
+
+ if (response_content)
+ {
+ response_soap_envelope = axis2_amqp_util_get_soap_envelope (response_content, env);
+
+ if (response_soap_envelope)
+ axis2_msg_ctx_set_response_soap_envelope (msg_ctx, env, response_soap_envelope);
+
+ /*AXIS2_FREE (env->allocator, response_content);*/
+ }
+ }
+ }
+
+ return AXIS2_SUCCESS;
+}
+
+
+axis2_status_t AXIS2_CALL
+axis2_amqp_sender_clean_up (axis2_transport_sender_t* sender,
+ const axutil_env_t* env,
+ axis2_msg_ctx_t* msg_ctx)
+{
+ return AXIS2_SUCCESS;
+}
+
+
+void AXIS2_CALL
+axis2_amqp_sender_free (axis2_transport_sender_t* sender,
+ const axutil_env_t* env)
+{
+ AXIS2_ENV_CHECK (env, void);
+
+ axis2_amqp_sender_resource_pack_t* sender_resource_pack = NULL;
+ sender_resource_pack = AXIS2_AMQP_SENDER_TO_RESOURCE_PACK (sender);
+
+ AXIS2_FREE (env->allocator, sender_resource_pack);
+}
+
+/* Library Exports */
+
+AXIS2_EXPORT int
+#ifndef AXIS2_STATIC_DEPLOY
+axis2_get_instance (
+#else
+axis2_amqp_sender_get_instance (
+#endif
+ struct axis2_transport_sender** inst,
+ const axutil_env_t* env)
+{
+ int status = AXIS2_SUCCESS;
+
+ *inst = axis2_amqp_sender_create (env);
+ if (!(*inst))
+ {
+ status = AXIS2_FAILURE;
+ }
+
+ return status;
+}
+
+
+AXIS2_EXPORT int
+#ifndef AXIS2_STATIC_DEPLOY
+axis2_remove_instance (
+#else
+axis2_amqp_sender_remove_instance (
+#endif
+ axis2_transport_sender_t* inst,
+ const axutil_env_t* env)
+{
+ if (inst)
+ {
+ axis2_transport_sender_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 <axiom_soap.h>
+#include <axis2_amqp_defines.h>
+#include <axis2_amqp_util.h>
+#include <axis2_amqp_sender.h>
+
+static const axis2_transport_sender_ops_t amqp_sender_ops = {
+ axis2_amqp_sender_init,
+ axis2_amqp_sender_invoke,
+ axis2_amqp_sender_clean_up,
+ axis2_amqp_sender_free};
+
+axis2_transport_sender_t* AXIS2_CALL
+axis2_amqp_sender_create (const axutil_env_t* env)
+{
+ AXIS2_ENV_CHECK (env, NULL);
+
+ axis2_amqp_sender_resource_pack_t* sender_resource_pack = NULL;
+
+ sender_resource_pack = (axis2_amqp_sender_resource_pack_t*)
+ AXIS2_MALLOC (env->allocator,
+ sizeof (axis2_amqp_sender_resource_pack_t));
+
+ if (!sender_resource_pack)
+ {
+ AXIS2_ERROR_SET (env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
+ sender_resource_pack->sender.ops = &amqp_sender_ops;
+
+ return &(sender_resource_pack->sender);
+}
+
+
+axis2_status_t AXIS2_CALL
+axis2_amqp_sender_init (axis2_transport_sender_t* sender,
+ const axutil_env_t* env,
+ axis2_conf_ctx_t* conf_ctx,
+ axis2_transport_out_desc_t* out_desc)
+{
+ return AXIS2_SUCCESS;
+}
+
+
+axis2_status_t AXIS2_CALL
+axis2_amqp_sender_invoke (axis2_transport_sender_t* sender,
+ const axutil_env_t* env,
+ axis2_msg_ctx_t* msg_ctx)
+{
+ AXIS2_ENV_CHECK (env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK (env->error, msg_ctx, AXIS2_FAILURE);
+
+ axiom_soap_envelope_t* request_soap_envelope = NULL;
+ axiom_xml_writer_t* xml_writer = NULL;
+ axiom_output_t* request_om_output = NULL;
+ axis2_char_t* request_content = NULL;
+ axis2_char_t* response_content = NULL;
+ axiom_soap_envelope_t* response_soap_envelope = NULL;
+ axis2_op_t* op = NULL;
+ const axis2_char_t* mep = NULL;
+ axis2_bool_t is_server = AXIS2_TRUE;
+ axis2_char_t* qpid_broker_ip = NULL;
+ int qpid_broker_port = 0;
+ axis2_char_t* send_to = NULL;
+
+ request_soap_envelope = axis2_msg_ctx_get_soap_envelope (msg_ctx, env);
+
+ xml_writer = axiom_xml_writer_create_for_memory (env,
+ NULL,
+ AXIS2_TRUE,
+ 0,
+ AXIS2_XML_PARSER_TYPE_BUFFER);
+ if (!xml_writer)
+ {
+ AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, "Failed to Create XML Writer");
+ return AXIS2_FAILURE;
+ }
+
+ request_om_output = axiom_output_create (env, xml_writer);
+ if (!request_om_output)
+ {
+ AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, "Failed to Create OM Output");
+ axiom_xml_writer_free (xml_writer, env);
+ xml_writer = NULL;
+ return AXIS2_FAILURE;
+ }
+
+ axiom_soap_envelope_serialize (request_soap_envelope, env, request_om_output, AXIS2_FALSE);
+
+ request_content = (axis2_char_t*)axiom_xml_writer_get_xml (xml_writer, env);
+ if (!request_content)
+ {
+ AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, "Failed to Serialize the SOAP Envelope");
+ return AXIS2_FAILURE;
+ }
+
+ op = axis2_msg_ctx_get_op (msg_ctx, env);
+ mep = axis2_op_get_msg_exchange_pattern (op, env);
+
+ is_server = axis2_msg_ctx_get_server_side (msg_ctx, env);
+
+ if (is_server)
+ {
+ /* Get Qpid Broker IP/Port/ReplyTo from the msg_ctx */
+ qpid_broker_ip = (axis2_char_t*)axis2_msg_ctx_get_property_value (msg_ctx,
+ env,
+ AXIS2_AMQP_MSG_CTX_PROPERTY_QPID_BROKER_IP);
+
+ qpid_broker_port = *(int*)axis2_msg_ctx_get_property_value (msg_ctx,
+ env,
+ AXIS2_AMQP_MSG_CTX_PROPERTY_QPID_BROKER_PORT);
+
+ send_to = (axis2_char_t*)axis2_msg_ctx_get_property_value (msg_ctx,
+ env,
+ AXIS2_AMQP_MSG_CTX_PROPERTY_REPLY_TO);
+
+ axis2_qpid_server_send (request_content,
+ qpid_broker_ip,
+ qpid_broker_port,
+ send_to);
+ }
+ else
+ {
+ /* Get Qpid Broker IP/Port from the Request URI */
+ qpid_broker_ip = axis2_amqp_util_get_qpid_broker_ip (msg_ctx, env);
+ qpid_broker_port = axis2_amqp_util_get_qpid_broker_port (msg_ctx, env);
+
+ if (axutil_strcmp (mep, AXIS2_MEP_URI_OUT_ONLY) == 0 ||
+ axutil_strcmp (mep, AXIS2_MEP_URI_ROBUST_OUT_ONLY) == 0)
+ {
+ axis2_qpid_client_send (request_content,
+ qpid_broker_ip,
+ qpid_broker_port);
+ }
+ else
+ {
+ response_content = axis2_qpid_client_request (request_content,
+ qpid_broker_ip,
+ qpid_broker_port,
+ env);
+
+ if (response_content)
+ {
+ response_soap_envelope = axis2_amqp_util_get_soap_envelope (response_content, env);
+
+ if (response_soap_envelope)
+ axis2_msg_ctx_set_response_soap_envelope (msg_ctx, env, response_soap_envelope);
+
+ /*AXIS2_FREE (env->allocator, response_content);*/
+ }
+ }
+ }
+
+ return AXIS2_SUCCESS;
+}
+
+
+axis2_status_t AXIS2_CALL
+axis2_amqp_sender_clean_up (axis2_transport_sender_t* sender,
+ const axutil_env_t* env,
+ axis2_msg_ctx_t* msg_ctx)
+{
+ return AXIS2_SUCCESS;
+}
+
+
+void AXIS2_CALL
+axis2_amqp_sender_free (axis2_transport_sender_t* sender,
+ const axutil_env_t* env)
+{
+ AXIS2_ENV_CHECK (env, void);
+
+ axis2_amqp_sender_resource_pack_t* sender_resource_pack = NULL;
+ sender_resource_pack = AXIS2_AMQP_SENDER_TO_RESOURCE_PACK (sender);
+
+ AXIS2_FREE (env->allocator, sender_resource_pack);
+}
+
+/* Library Exports */
+
+AXIS2_EXPORT int
+#ifndef AXIS2_STATIC_DEPLOY
+axis2_get_instance (
+#else
+axis2_amqp_sender_get_instance (
+#endif
+ struct axis2_transport_sender** inst,
+ const axutil_env_t* env)
+{
+ int status = AXIS2_SUCCESS;
+
+ *inst = axis2_amqp_sender_create (env);
+ if (!(*inst))
+ {
+ status = AXIS2_FAILURE;
+ }
+
+ return status;
+}
+
+
+AXIS2_EXPORT int
+#ifndef AXIS2_STATIC_DEPLOY
+axis2_remove_instance (
+#else
+axis2_amqp_sender_remove_instance (
+#endif
+ axis2_transport_sender_t* inst,
+ const axutil_env_t* env)
+{
+ if (inst)
+ {
+ axis2_transport_sender_free (inst, env);
+ }
+
+ return AXIS2_SUCCESS;
+}
+
+
Added: webservices/axis2/trunk/c/src/core/transport/amqp/sender/axis2_amqp_sender.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/amqp/sender/axis2_amqp_sender.h?rev=664506&view=auto
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/amqp/sender/axis2_amqp_sender.h (added)
+++ webservices/axis2/trunk/c/src/core/transport/amqp/sender/axis2_amqp_sender.h Sun Jun 8 06:25:38 2008
@@ -0,0 +1,116 @@
+/*
+ * 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_SENDER_H
+#define AXIS2_AMQP_SENDER_H
+
+#include <axutil_env.h>
+#include <axis2_conf_ctx.h>
+#include <axis2_transport_sender.h>
+#include <axis2_qpid_sender_interface.h>
+
+typedef struct axis2_amqp_sender_resource_pack
+{
+ axis2_transport_sender_t sender;
+}
+axis2_amqp_sender_resource_pack_t;
+
+#define AXIS2_AMQP_SENDER_TO_RESOURCE_PACK(amqp_sender) \
+ ((axis2_amqp_sender_resource_pack_t*)(amqp_sender))
+
+axis2_transport_sender_t* AXIS2_CALL
+axis2_amqp_sender_create (const axutil_env_t* env);
+
+axis2_status_t AXIS2_CALL
+axis2_amqp_sender_init (axis2_transport_sender_t* sender,
+ const axutil_env_t* env,
+ axis2_conf_ctx_t* conf_ctx,
+ axis2_transport_out_desc_t* out_desc);
+
+axis2_status_t AXIS2_CALL
+axis2_amqp_sender_invoke (axis2_transport_sender_t* sender,
+ const axutil_env_t* env,
+ axis2_msg_ctx_t* msg_ctx);
+
+axis2_status_t AXIS2_CALL
+axis2_amqp_sender_clean_up (axis2_transport_sender_t* sender,
+ const axutil_env_t* env,
+ axis2_msg_ctx_t* msg_ctx);
+
+void AXIS2_CALL
+axis2_amqp_sender_free (axis2_transport_sender_t* sender,
+ 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_SENDER_H
+#define AXIS2_AMQP_SENDER_H
+
+#include <axutil_env.h>
+#include <axis2_conf_ctx.h>
+#include <axis2_transport_sender.h>
+#include <axis2_qpid_sender_interface.h>
+
+typedef struct axis2_amqp_sender_resource_pack
+{
+ axis2_transport_sender_t sender;
+}
+axis2_amqp_sender_resource_pack_t;
+
+#define AXIS2_AMQP_SENDER_TO_RESOURCE_PACK(amqp_sender) \
+ ((axis2_amqp_sender_resource_pack_t*)(amqp_sender))
+
+axis2_transport_sender_t* AXIS2_CALL
+axis2_amqp_sender_create (const axutil_env_t* env);
+
+axis2_status_t AXIS2_CALL
+axis2_amqp_sender_init (axis2_transport_sender_t* sender,
+ const axutil_env_t* env,
+ axis2_conf_ctx_t* conf_ctx,
+ axis2_transport_out_desc_t* out_desc);
+
+axis2_status_t AXIS2_CALL
+axis2_amqp_sender_invoke (axis2_transport_sender_t* sender,
+ const axutil_env_t* env,
+ axis2_msg_ctx_t* msg_ctx);
+
+axis2_status_t AXIS2_CALL
+axis2_amqp_sender_clean_up (axis2_transport_sender_t* sender,
+ const axutil_env_t* env,
+ axis2_msg_ctx_t* msg_ctx);
+
+void AXIS2_CALL
+axis2_amqp_sender_free (axis2_transport_sender_t* sender,
+ const axutil_env_t* env);
+
+#endif
Added: webservices/axis2/trunk/c/src/core/transport/amqp/sender/qpid_sender/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/amqp/sender/qpid_sender/Makefile.am?rev=664506&view=auto
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/amqp/sender/qpid_sender/Makefile.am (added)
+++ webservices/axis2/trunk/c/src/core/transport/amqp/sender/qpid_sender/Makefile.am Sun Jun 8 06:25:38 2008
@@ -0,0 +1,42 @@
+lib_LTLIBRARIES = libaxis2_qpid_sender.la
+
+libaxis2_qpid_sender_la_SOURCES = axis2_qpid_sender.cpp \
+ axis2_qpid_sender_interface.cpp
+
+libaxis2_qpid_sender_la_LIBADD = $(top_builddir)/util/src/libaxutil.la \
+ $(QPID_HOME)/lib/libqpidclient.la
+
+libaxis2_qpid_sender_la_LDFLAGS = g++ -version-info $(VERSION_NO)
+
+INCLUDES = -I$(top_builddir)/include \
+ -I$(top_builddir)/src/core/transport/amqp/sender/qpid_sender \
+ -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
+lib_LTLIBRARIES = libaxis2_qpid_sender.la
+
+libaxis2_qpid_sender_la_SOURCES = axis2_qpid_sender.cpp \
+ axis2_qpid_sender_interface.cpp
+
+libaxis2_qpid_sender_la_LIBADD = $(top_builddir)/util/src/libaxutil.la \
+ $(QPID_HOME)/lib/libqpidclient.la
+
+libaxis2_qpid_sender_la_LDFLAGS = g++ -version-info $(VERSION_NO)
+
+INCLUDES = -I$(top_builddir)/include \
+ -I$(top_builddir)/src/core/transport/amqp/sender/qpid_sender \
+ -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/sender/qpid_sender/axis2_qpid_sender.cpp
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/amqp/sender/qpid_sender/axis2_qpid_sender.cpp?rev=664506&view=auto
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/amqp/sender/qpid_sender/axis2_qpid_sender.cpp (added)
+++ webservices/axis2/trunk/c/src/core/transport/amqp/sender/qpid_sender/axis2_qpid_sender.cpp Sun Jun 8 06:25:38 2008
@@ -0,0 +1,316 @@
+/*
+ * 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_defines.h>
+#include <axis2_qpid_sender.h>
+
+Axis2QpidSender::Axis2QpidSender (string qpidBrokerIP,
+ int qpidBrokerPort)
+{
+ this->qpidBrokerIP = qpidBrokerIP;
+ this->qpidBrokerPort = qpidBrokerPort;
+ this->dispatcher = NULL;
+ this->responseContent = "";
+ this->responseQueue.clear ();
+}
+
+
+Axis2QpidSender::~Axis2QpidSender (void)
+{
+ if (dispatcher)
+ delete dispatcher;
+}
+
+
+bool Axis2QpidSender::CreateSession (void)
+{
+ bool status = false;
+
+ try
+ {
+ /* Create Connection to Qpid Broker */
+ connection.open (qpidBrokerIP, qpidBrokerPort);
+
+ session = connection.newSession ();
+
+ status = true;
+ }
+ catch (const std::exception& e)
+ {
+ connection.close ();
+ }
+
+ return status;
+}
+
+
+string Axis2QpidSender::Request (string messageContent)
+{
+ responseContent = "";
+
+ bool sessionCreated = CreateSession ();
+ if (sessionCreated)
+ {
+ /* Declare Private Queue */
+ responseQueue << "client" << session.getId ().getName ();
+
+ session.queueDeclare (arg::queue = responseQueue.str ());
+ session.exchangeBind (arg::exchange = AXIS2_AMQP_EXCHANGE_DIRECT,
+ arg::queue = responseQueue.str (),
+ arg::bindingKey = responseQueue.str ());
+
+ dispatcher = new Dispatcher (session);
+
+ listen ();
+
+ /* Create Message */
+ Message message;
+ message.getDeliveryProperties ().setRoutingKey (AXIS2_AMQP_RECEIVER_QUEUE_BIND_KEY);
+ message.getMessageProperties ().setReplyTo (ReplyTo (AXIS2_AMQP_EXCHANGE_DIRECT, responseQueue.str ()));
+ message.setData (messageContent);
+
+ async (session).messageTransfer (arg::content = message, arg::destination = AXIS2_AMQP_EXCHANGE_DIRECT);
+
+ wait ();
+
+ connection.close ();
+ }
+
+ return responseContent;
+}
+
+
+void Axis2QpidSender::Send (string messageContent, string to)
+{
+ bool sessionCreated = CreateSession ();
+ if (sessionCreated)
+ {
+ Message message;
+
+ message.getDeliveryProperties ().setRoutingKey (to);
+ message.setData (messageContent);
+
+ async(session).messageTransfer(arg::content = message, arg::destination = AXIS2_AMQP_EXCHANGE_DIRECT);
+
+ connection.close ();
+ }
+}
+
+
+void Axis2QpidSender::Send (string messageContent)
+{
+ bool sessionCreated = CreateSession ();
+ if (sessionCreated)
+ {
+ Message message;
+
+ message.setData (messageContent);
+
+ async(session).messageTransfer(arg::content = message, arg::destination = AXIS2_AMQP_EXCHANGE_DIRECT);
+
+ connection.close ();
+ }
+}
+
+
+void Axis2QpidSender::received (Message& message)
+{
+ responseContent = message.getData ();
+
+ dispatcher->stop ();
+}
+
+
+void Axis2QpidSender::listen (void)
+{
+ if (!dispatcher)
+ return;
+
+ session.messageSubscribe (arg::queue = responseQueue.str (), arg::destination = responseQueue.str ());
+
+ session.messageFlow (arg::destination = responseQueue.str (), arg::unit = MESSAGE_CREDIT, arg::value = 1);
+ session.messageFlow (arg::destination = responseQueue.str (), arg::unit = BYTE_CREDIT, arg::value = UNLIMITED_CREDIT);
+
+ dispatcher->listen (responseQueue.str (), this);
+}
+
+
+void Axis2QpidSender::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_defines.h>
+#include <axis2_qpid_sender.h>
+
+Axis2QpidSender::Axis2QpidSender (string qpidBrokerIP,
+ int qpidBrokerPort)
+{
+ this->qpidBrokerIP = qpidBrokerIP;
+ this->qpidBrokerPort = qpidBrokerPort;
+ this->dispatcher = NULL;
+ this->responseContent = "";
+ this->responseQueue.clear ();
+}
+
+
+Axis2QpidSender::~Axis2QpidSender (void)
+{
+ if (dispatcher)
+ delete dispatcher;
+}
+
+
+bool Axis2QpidSender::CreateSession (void)
+{
+ bool status = false;
+
+ try
+ {
+ /* Create Connection to Qpid Broker */
+ connection.open (qpidBrokerIP, qpidBrokerPort);
+
+ session = connection.newSession ();
+
+ status = true;
+ }
+ catch (const std::exception& e)
+ {
+ connection.close ();
+ }
+
+ return status;
+}
+
+
+string Axis2QpidSender::Request (string messageContent)
+{
+ responseContent = "";
+
+ bool sessionCreated = CreateSession ();
+ if (sessionCreated)
+ {
+ /* Declare Private Queue */
+ responseQueue << "client" << session.getId ().getName ();
+
+ session.queueDeclare (arg::queue = responseQueue.str ());
+ session.exchangeBind (arg::exchange = AXIS2_AMQP_EXCHANGE_DIRECT,
+ arg::queue = responseQueue.str (),
+ arg::bindingKey = responseQueue.str ());
+
+ dispatcher = new Dispatcher (session);
+
+ listen ();
+
+ /* Create Message */
+ Message message;
+ message.getDeliveryProperties ().setRoutingKey (AXIS2_AMQP_RECEIVER_QUEUE_BIND_KEY);
+ message.getMessageProperties ().setReplyTo (ReplyTo (AXIS2_AMQP_EXCHANGE_DIRECT, responseQueue.str ()));
+ message.setData (messageContent);
+
+ async (session).messageTransfer (arg::content = message, arg::destination = AXIS2_AMQP_EXCHANGE_DIRECT);
+
+ wait ();
+
+ connection.close ();
+ }
+
+ return responseContent;
+}
+
+
+void Axis2QpidSender::Send (string messageContent, string to)
+{
+ bool sessionCreated = CreateSession ();
+ if (sessionCreated)
+ {
+ Message message;
+
+ message.getDeliveryProperties ().setRoutingKey (to);
+ message.setData (messageContent);
+
+ async(session).messageTransfer(arg::content = message, arg::destination = AXIS2_AMQP_EXCHANGE_DIRECT);
+
+ connection.close ();
+ }
+}
+
+
+void Axis2QpidSender::Send (string messageContent)
+{
+ bool sessionCreated = CreateSession ();
+ if (sessionCreated)
+ {
+ Message message;
+
+ message.setData (messageContent);
+
+ async(session).messageTransfer(arg::content = message, arg::destination = AXIS2_AMQP_EXCHANGE_DIRECT);
+
+ connection.close ();
+ }
+}
+
+
+void Axis2QpidSender::received (Message& message)
+{
+ responseContent = message.getData ();
+
+ dispatcher->stop ();
+}
+
+
+void Axis2QpidSender::listen (void)
+{
+ if (!dispatcher)
+ return;
+
+ session.messageSubscribe (arg::queue = responseQueue.str (), arg::destination = responseQueue.str ());
+
+ session.messageFlow (arg::destination = responseQueue.str (), arg::unit = MESSAGE_CREDIT, arg::value = 1);
+ session.messageFlow (arg::destination = responseQueue.str (), arg::unit = BYTE_CREDIT, arg::value = UNLIMITED_CREDIT);
+
+ dispatcher->listen (responseQueue.str (), this);
+}
+
+
+void Axis2QpidSender::wait (void)
+{
+ if (!dispatcher)
+ return;
+
+ dispatcher->run ();
+}
Added: webservices/axis2/trunk/c/src/core/transport/amqp/sender/qpid_sender/axis2_qpid_sender.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/amqp/sender/qpid_sender/axis2_qpid_sender.h?rev=664506&view=auto
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/amqp/sender/qpid_sender/axis2_qpid_sender.h (added)
+++ webservices/axis2/trunk/c/src/core/transport/amqp/sender/qpid_sender/axis2_qpid_sender.h Sun Jun 8 06:25:38 2008
@@ -0,0 +1,130 @@
+/*
+ * 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_SENDER_H
+#define AXIS2_QPID_SENDER_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 <sstream>
+#include <string>
+
+using namespace qpid::client;
+using namespace qpid::framing;
+using std::stringstream;
+using std::string;
+
+class Axis2QpidSender : public MessageListener
+{
+ public:
+ Axis2QpidSender (string qpidBrokerIP,
+ int qpidBrokerPort);
+ ~Axis2QpidSender (void);
+
+ /* Out-In */
+ string Request (string messageContent); /* Used by Clients */
+
+ /* Out Only */
+ void Send (string messageContent, string to); /* Used by Server */
+ void Send (string messageContent); /* Used by Clients */
+
+ private:
+ bool CreateSession (void);
+
+ virtual void received (Message& message);
+ virtual void listen (void);
+ virtual void wait (void);
+
+ string qpidBrokerIP;
+ int qpidBrokerPort;
+ Connection connection;
+ Dispatcher* dispatcher;
+ Session session;
+ string responseContent;
+ stringstream responseQueue;
+};
+
+#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_SENDER_H
+#define AXIS2_QPID_SENDER_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 <sstream>
+#include <string>
+
+using namespace qpid::client;
+using namespace qpid::framing;
+using std::stringstream;
+using std::string;
+
+class Axis2QpidSender : public MessageListener
+{
+ public:
+ Axis2QpidSender (string qpidBrokerIP,
+ int qpidBrokerPort);
+ ~Axis2QpidSender (void);
+
+ /* Out-In */
+ string Request (string messageContent); /* Used by Clients */
+
+ /* Out Only */
+ void Send (string messageContent, string to); /* Used by Server */
+ void Send (string messageContent); /* Used by Clients */
+
+ private:
+ bool CreateSession (void);
+
+ virtual void received (Message& message);
+ virtual void listen (void);
+ virtual void wait (void);
+
+ string qpidBrokerIP;
+ int qpidBrokerPort;
+ Connection connection;
+ Dispatcher* dispatcher;
+ Session session;
+ string responseContent;
+ stringstream responseQueue;
+};
+
+#endif
Added: webservices/axis2/trunk/c/src/core/transport/amqp/sender/qpid_sender/axis2_qpid_sender_interface.cpp
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/amqp/sender/qpid_sender/axis2_qpid_sender_interface.cpp?rev=664506&view=auto
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/amqp/sender/qpid_sender/axis2_qpid_sender_interface.cpp (added)
+++ webservices/axis2/trunk/c/src/core/transport/amqp/sender/qpid_sender/axis2_qpid_sender_interface.cpp Sun Jun 8 06:25:38 2008
@@ -0,0 +1,138 @@
+/*
+* 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_sender.h>
+#include <axis2_qpid_sender_interface.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+axis2_char_t* AXIS2_CALL
+axis2_qpid_client_request (const axis2_char_t* request_content,
+ const axis2_char_t* qpid_broker_ip,
+ int qpid_broker_port,
+ const axutil_env_t* env)
+{
+ /* Get Response */
+ Axis2QpidSender qpid_sender (qpid_broker_ip, qpid_broker_port);
+ string response_content = qpid_sender.Request (request_content);
+
+ /* Create a Copy and Return */
+ axis2_char_t* response_content_buffer = (axis2_char_t*)AXIS2_MALLOC (env->allocator,
+ response_content.size () + 1);
+ strcpy (response_content_buffer, response_content.c_str ());
+
+ return response_content_buffer;
+}
+
+
+void AXIS2_CALL
+axis2_qpid_server_send (const axis2_char_t* request_content,
+ const axis2_char_t* qpid_broker_ip,
+ int qpid_broker_port,
+ const axis2_char_t* to)
+{
+ Axis2QpidSender qpid_sender (qpid_broker_ip, qpid_broker_port);
+
+ qpid_sender.Send (request_content, to);
+}
+
+
+void AXIS2_CALL
+axis2_qpid_client_send (const axis2_char_t* request_content,
+ const axis2_char_t* qpid_broker_ip,
+ int qpid_broker_port)
+{
+ Axis2QpidSender qpid_sender (qpid_broker_ip, qpid_broker_port);
+
+ qpid_sender.Send (request_content);
+}
+
+#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_sender.h>
+#include <axis2_qpid_sender_interface.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+axis2_char_t* AXIS2_CALL
+axis2_qpid_client_request (const axis2_char_t* request_content,
+ const axis2_char_t* qpid_broker_ip,
+ int qpid_broker_port,
+ const axutil_env_t* env)
+{
+ /* Get Response */
+ Axis2QpidSender qpid_sender (qpid_broker_ip, qpid_broker_port);
+ string response_content = qpid_sender.Request (request_content);
+
+ /* Create a Copy and Return */
+ axis2_char_t* response_content_buffer = (axis2_char_t*)AXIS2_MALLOC (env->allocator,
+ response_content.size () + 1);
+ strcpy (response_content_buffer, response_content.c_str ());
+
+ return response_content_buffer;
+}
+
+
+void AXIS2_CALL
+axis2_qpid_server_send (const axis2_char_t* request_content,
+ const axis2_char_t* qpid_broker_ip,
+ int qpid_broker_port,
+ const axis2_char_t* to)
+{
+ Axis2QpidSender qpid_sender (qpid_broker_ip, qpid_broker_port);
+
+ qpid_sender.Send (request_content, to);
+}
+
+
+void AXIS2_CALL
+axis2_qpid_client_send (const axis2_char_t* request_content,
+ const axis2_char_t* qpid_broker_ip,
+ int qpid_broker_port)
+{
+ Axis2QpidSender qpid_sender (qpid_broker_ip, qpid_broker_port);
+
+ qpid_sender.Send (request_content);
+}
+
+#ifdef __cplusplus
+}
+#endif
Added: webservices/axis2/trunk/c/src/core/transport/amqp/sender/qpid_sender/axis2_qpid_sender_interface.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/amqp/sender/qpid_sender/axis2_qpid_sender_interface.h?rev=664506&view=auto
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/amqp/sender/qpid_sender/axis2_qpid_sender_interface.h (added)
+++ webservices/axis2/trunk/c/src/core/transport/amqp/sender/qpid_sender/axis2_qpid_sender_interface.h Sun Jun 8 06:25:38 2008
@@ -0,0 +1,100 @@
+/*
+* 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_SENDER_INTERFACE_H
+#define AXIS2_QPID_SENDER_INTERFACE_H
+
+#include <axis2_util.h>
+#include <axis2_conf_init.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+axis2_char_t* AXIS2_CALL
+axis2_qpid_client_request (const axis2_char_t* request_content,
+ const axis2_char_t* qpid_broker_ip,
+ int qpid_broker_port,
+ const axutil_env_t* env);
+
+void AXIS2_CALL
+axis2_qpid_server_send (const axis2_char_t* request_content,
+ const axis2_char_t* qpid_broker_ip,
+ int qpid_broker_port,
+ const axis2_char_t* to);
+
+void AXIS2_CALL
+axis2_qpid_client_send (const axis2_char_t* request_content,
+ const axis2_char_t* qpid_broker_ip,
+ int qpid_broker_port);
+
+#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_SENDER_INTERFACE_H
+#define AXIS2_QPID_SENDER_INTERFACE_H
+
+#include <axis2_util.h>
+#include <axis2_conf_init.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+axis2_char_t* AXIS2_CALL
+axis2_qpid_client_request (const axis2_char_t* request_content,
+ const axis2_char_t* qpid_broker_ip,
+ int qpid_broker_port,
+ const axutil_env_t* env);
+
+void AXIS2_CALL
+axis2_qpid_server_send (const axis2_char_t* request_content,
+ const axis2_char_t* qpid_broker_ip,
+ int qpid_broker_port,
+ const axis2_char_t* to);
+
+void AXIS2_CALL
+axis2_qpid_client_send (const axis2_char_t* request_content,
+ const axis2_char_t* qpid_broker_ip,
+ int qpid_broker_port);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
Added: webservices/axis2/trunk/c/src/core/transport/amqp/server/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/amqp/server/Makefile.am?rev=664506&view=auto
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/amqp/server/Makefile.am (added)
+++ webservices/axis2/trunk/c/src/core/transport/amqp/server/Makefile.am Sun Jun 8 06:25:38 2008
@@ -0,0 +1,2 @@
+SUBDIRS = axis2_amqp_server
+SUBDIRS = axis2_amqp_server
Added: webservices/axis2/trunk/c/src/core/transport/amqp/server/axis2_amqp_server/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/amqp/server/axis2_amqp_server/Makefile.am?rev=664506&view=auto
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/amqp/server/axis2_amqp_server/Makefile.am (added)
+++ webservices/axis2/trunk/c/src/core/transport/amqp/server/axis2_amqp_server/Makefile.am Sun Jun 8 06:25:38 2008
@@ -0,0 +1,62 @@
+prgbindir = $(bindir)
+
+prgbin_PROGRAMS = axis2_amqp_server
+
+AM_CFLAGS = -g -pthread
+
+axis2_amqp_server_SOURCES = axis2_amqp_server.c
+
+axis2_amqp_server_LDADD = $(LDFLAGS) \
+ $(top_builddir)/axiom/src/om/libaxis2_axiom.la \
+ $(top_builddir)/util/src/libaxutil.la \
+ $(top_builddir)/axiom/src/parser/$(WRAPPER_DIR)/libaxis2_parser.la \
+ $(top_builddir)/src/core/description/libaxis2_description.la \
+ $(top_builddir)/src/core/deployment/libaxis2_deployment.la \
+ $(top_builddir)/src/core/context/libaxis2_context.la \
+ $(top_builddir)/src/core/clientapi/libaxis2_clientapi.la \
+ $(top_builddir)/src/core/engine/libaxis2_engine.la \
+ $(top_builddir)/neethi/src/libneethi.la \
+ $(top_builddir)/src/core/transport/amqp/receiver/libaxis2_amqp_receiver.la \
+ -lpthread
+
+INCLUDES = -I$(top_builddir)/include \
+ -I$(top_builddir)/src/core/description \
+ -I$(top_builddir)/src/core/context \
+ -I$(top_builddir)/src/core/deploymenti \
+ -I$(top_builddir)/src/core/phaseresolver \
+ -I$(top_builddir)/src/core/engine \
+ -I$(top_builddir)/src/core/transport/amqp/receiver \
+ -I$(top_builddir)/src/core/transport/amqp/receiver/qpid_receiver \
+ -I$(top_builddir)/util/include \
+ -I$(top_builddir)/axiom/include
+prgbindir = $(bindir)
+
+prgbin_PROGRAMS = axis2_amqp_server
+
+AM_CFLAGS = -g -pthread
+
+axis2_amqp_server_SOURCES = axis2_amqp_server.c
+
+axis2_amqp_server_LDADD = $(LDFLAGS) \
+ $(top_builddir)/axiom/src/om/libaxis2_axiom.la \
+ $(top_builddir)/util/src/libaxutil.la \
+ $(top_builddir)/axiom/src/parser/$(WRAPPER_DIR)/libaxis2_parser.la \
+ $(top_builddir)/src/core/description/libaxis2_description.la \
+ $(top_builddir)/src/core/deployment/libaxis2_deployment.la \
+ $(top_builddir)/src/core/context/libaxis2_context.la \
+ $(top_builddir)/src/core/clientapi/libaxis2_clientapi.la \
+ $(top_builddir)/src/core/engine/libaxis2_engine.la \
+ $(top_builddir)/neethi/src/libneethi.la \
+ $(top_builddir)/src/core/transport/amqp/receiver/libaxis2_amqp_receiver.la \
+ -lpthread
+
+INCLUDES = -I$(top_builddir)/include \
+ -I$(top_builddir)/src/core/description \
+ -I$(top_builddir)/src/core/context \
+ -I$(top_builddir)/src/core/deploymenti \
+ -I$(top_builddir)/src/core/phaseresolver \
+ -I$(top_builddir)/src/core/engine \
+ -I$(top_builddir)/src/core/transport/amqp/receiver \
+ -I$(top_builddir)/src/core/transport/amqp/receiver/qpid_receiver \
+ -I$(top_builddir)/util/include \
+ -I$(top_builddir)/axiom/include
Added: webservices/axis2/trunk/c/src/core/transport/amqp/server/axis2_amqp_server/axis2_amqp_server.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/amqp/server/axis2_amqp_server/axis2_amqp_server.c?rev=664506&view=auto
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/amqp/server/axis2_amqp_server/axis2_amqp_server.c (added)
+++ webservices/axis2/trunk/c/src/core/transport/amqp/server/axis2_amqp_server/axis2_amqp_server.c Sun Jun 8 06:25:38 2008
@@ -0,0 +1,478 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * 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 <stdio.h>
+#include <stdlib.h>
+#include <axutil_error_default.h>
+#include <axutil_log_default.h>
+#include <axutil_thread_pool.h>
+#include <signal.h>
+#include <axutil_types.h>
+#include <ctype.h>
+#include <axiom_xml_reader.h>
+#include <axis2_amqp_server.h>
+#include <axis2_amqp_receiver.h>
+#include <axis2_qpid_receiver_interface.h>
+
+axis2_transport_receiver_t* receiver = NULL;
+axutil_env_t* server_env = NULL;
+
+axutil_env_t*
+init_server_env (axutil_allocator_t* allocator,
+ const axis2_char_t* log_file_name)
+{
+ axutil_error_t* error = axutil_error_create (allocator);
+ axutil_log_t* log = axutil_log_create (allocator, NULL, log_file_name);
+ axutil_thread_pool_t* thread_pool = axutil_thread_pool_init (allocator);
+ axutil_env_t* env = axutil_env_create_with_error_log_thread_pool (allocator,
+ error,
+ log,
+ thread_pool);
+
+ axiom_xml_reader_init ();
+
+ return env;
+}
+
+
+void
+server_exit (int status)
+{
+ if (receiver)
+ {
+ axis2_transport_receiver_free (receiver, server_env);
+ }
+
+ if (server_env)
+ {
+ axutil_env_free (server_env);
+ }
+
+ axiom_xml_reader_cleanup ();
+
+ exit (status);
+}
+
+
+void
+show_usage (axis2_char_t* prog_name)
+{
+ fprintf (stdout, "\n Usage : %s", prog_name);
+ fprintf (stdout, " [-i QPID_BROKER_IP]");
+ fprintf (stdout, " [-p QPID_BROKER_PORT]");
+ fprintf (stdout, " [-r REPO_PATH]");
+ fprintf (stdout, " [-l LOG_LEVEL]");
+ fprintf (stdout, " [-f LOG_FILE]\n");
+ fprintf (stdout, " [-s LOG_FILE_SIZE]\n");
+ fprintf (stdout, " Options :\n");
+ fprintf (stdout, "\t-i QPID_BROKER_IP \t Qpid broker IP, default is 127.0.0.1\n");
+ fprintf (stdout, "\t-p QPID_BROKER_PORT \t the port on which the Qpid broker listens, default is 5672\n");
+ fprintf (stdout, "\t-r REPO_PATH \t\t repository path, default is ../\n");
+ fprintf (stdout,
+ "\t-l LOG_LEVEL\t\t log level, available log levels:"
+ "\n\t\t\t\t\t 0 - critical 1 - errors 2 - warnings"
+ "\n\t\t\t\t\t 3 - information 4 - debug 5- user 6 - trace"
+ "\n\t\t\t\t\t Default log level is 4(debug).\n");
+#ifndef WIN32
+ fprintf (stdout,
+ "\t-f LOG_FILE\t\t log file, default is $AXIS2C_HOME/logs/axis2.log"
+ "\n\t\t\t\t or axis2.log in current folder if AXIS2C_HOME not set\n");
+#else
+ fprintf (stdout,
+ "\t-f LOG_FILE\t\t log file, default is %%AXIS2C_HOME%%\\logs\\axis2.log"
+ "\n\t\t\t\t or axis2.log in current folder if AXIS2C_HOME not set\n");
+#endif
+ fprintf (stdout,
+ "\t-s LOG_FILE_SIZE\t Maximum log file size in mega bytes, default maximum size is 1MB.\n");
+ fprintf (stdout, " Help :\n\t-h \t\t\t display this help screen.\n\n");
+}
+
+#ifndef WIN32
+
+void
+sig_handler (int signal)
+{
+ switch (signal)
+ {
+ case SIGINT:
+ AXIS2_LOG_INFO (server_env->log, "Received signal SIGINT. Server "
+ "shutting down");
+ axis2_amqp_receiver_stop (receiver, server_env);
+ AXIS2_LOG_INFO (server_env->log, "Shutdown complete ...");
+
+ server_exit (0);
+
+ case SIGPIPE:
+ AXIS2_LOG_INFO (server_env->log, "Received signal SIGPIPE. Client "
+ "request serve aborted");
+ return;
+
+ case SIGSEGV:
+ fprintf (stderr, "Received deadly signal SIGSEGV. Terminating ...\n");
+ _exit(-1);
+ }
+}
+
+#endif
+
+int
+main (int argc,
+ char* argv[])
+{
+ axutil_allocator_t* allocator = NULL;
+ extern char* optarg;
+ extern int optopt;
+ int c;
+ const axis2_char_t* qpid_broker_ip = NULL;
+ int qpid_broker_port = -1;
+ const axis2_char_t* repo_path = AXIS2_AMQP_SERVER_REPO_PATH;
+ axutil_log_levels_t log_level = AXIS2_LOG_LEVEL_DEBUG;
+ const axis2_char_t* log_file_name = AXIS2_AMQP_SERVER_LOG_FILE_NAME;
+ int log_file_size = AXUTIL_LOG_FILE_SIZE;
+
+ while ((c = AXIS2_GETOPT (argc, argv, "i:p:r:l:f:s:h")) != -1)
+ {
+ switch (c)
+ {
+ case 'i':
+ qpid_broker_ip = optarg;
+ break;
+
+ case 'p':
+ qpid_broker_port = AXIS2_ATOI (optarg);
+ break;
+
+ case 'r':
+ repo_path = optarg;
+ break;
+
+ case 'l':
+ log_level = AXIS2_ATOI (optarg);
+ if (log_level < AXIS2_LOG_LEVEL_CRITICAL)
+ log_level = AXIS2_LOG_LEVEL_CRITICAL;
+ if (log_level > AXIS2_LOG_LEVEL_TRACE)
+ log_level = AXIS2_LOG_LEVEL_TRACE;
+ break;
+
+ case 'f':
+ log_file_name = optarg;
+ break;
+
+ case 's':
+ log_file_size = 1024 * 1024 * AXIS2_ATOI (optarg);
+ break;
+
+ case 'h':
+ show_usage (argv[0]);
+ return 0;
+
+ case ':':
+ fprintf (stderr, "\nOption -%c requires an operand\n", optopt);
+ show_usage (argv[0]);
+ return -1;
+
+ case '?':
+ if (isprint (optopt))
+ fprintf (stderr, "\nUnknown option `-%c'.\n", optopt);
+ show_usage (argv[0]);
+ return -1;
+ }
+ }
+
+ allocator = axutil_allocator_init (NULL);
+ if (!allocator)
+ {
+ server_exit (-1);
+ }
+
+ server_env = init_server_env (allocator, log_file_name);
+ server_env->log->level = log_level;
+ server_env->log->size = log_file_size;
+
+ axutil_error_init ();
+
+#ifndef WIN32
+ signal (SIGINT, sig_handler);
+ signal (SIGPIPE, sig_handler);
+#endif
+
+ AXIS2_LOG_INFO (server_env->log, "Starting Axis2 AMQP Server ...");
+ AXIS2_LOG_INFO (server_env->log, "Repo Location : %s", repo_path);
+
+ receiver = axis2_amqp_receiver_create (server_env,
+ repo_path,
+ qpid_broker_ip,
+ qpid_broker_port);
+ if (!receiver)
+ {
+ AXIS2_LOG_ERROR (server_env->log, AXIS2_LOG_SI,
+ "Server creation failed: Error code:" " %d :: %s",
+ server_env->error->error_number,
+ AXIS2_ERROR_GET_MESSAGE (server_env->error));
+ server_exit (-1);
+ }
+
+ if (axis2_amqp_receiver_start (receiver, server_env) == AXIS2_FAILURE)
+ {
+ AXIS2_LOG_ERROR (server_env->log, AXIS2_LOG_SI,
+ "Server start failed: Error code:" " %d :: %s",
+ server_env->error->error_number,
+ AXIS2_ERROR_GET_MESSAGE (server_env->error));
+ server_exit (-1);
+ }
+
+ return 0;
+}
+/*
+ * 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 <stdio.h>
+#include <stdlib.h>
+#include <axutil_error_default.h>
+#include <axutil_log_default.h>
+#include <axutil_thread_pool.h>
+#include <signal.h>
+#include <axutil_types.h>
+#include <ctype.h>
+#include <axiom_xml_reader.h>
+#include <axis2_amqp_server.h>
+#include <axis2_amqp_receiver.h>
+#include <axis2_qpid_receiver_interface.h>
+
+axis2_transport_receiver_t* receiver = NULL;
+axutil_env_t* server_env = NULL;
+
+axutil_env_t*
+init_server_env (axutil_allocator_t* allocator,
+ const axis2_char_t* log_file_name)
+{
+ axutil_error_t* error = axutil_error_create (allocator);
+ axutil_log_t* log = axutil_log_create (allocator, NULL, log_file_name);
+ axutil_thread_pool_t* thread_pool = axutil_thread_pool_init (allocator);
+ axutil_env_t* env = axutil_env_create_with_error_log_thread_pool (allocator,
+ error,
+ log,
+ thread_pool);
+
+ axiom_xml_reader_init ();
+
+ return env;
+}
+
+
+void
+server_exit (int status)
+{
+ if (receiver)
+ {
+ axis2_transport_receiver_free (receiver, server_env);
+ }
+
+ if (server_env)
+ {
+ axutil_env_free (server_env);
+ }
+
+ axiom_xml_reader_cleanup ();
+
+ exit (status);
+}
+
+
+void
+show_usage (axis2_char_t* prog_name)
+{
+ fprintf (stdout, "\n Usage : %s", prog_name);
+ fprintf (stdout, " [-i QPID_BROKER_IP]");
+ fprintf (stdout, " [-p QPID_BROKER_PORT]");
+ fprintf (stdout, " [-r REPO_PATH]");
+ fprintf (stdout, " [-l LOG_LEVEL]");
+ fprintf (stdout, " [-f LOG_FILE]\n");
+ fprintf (stdout, " [-s LOG_FILE_SIZE]\n");
+ fprintf (stdout, " Options :\n");
+ fprintf (stdout, "\t-i QPID_BROKER_IP \t Qpid broker IP, default is 127.0.0.1\n");
+ fprintf (stdout, "\t-p QPID_BROKER_PORT \t the port on which the Qpid broker listens, default is 5672\n");
+ fprintf (stdout, "\t-r REPO_PATH \t\t repository path, default is ../\n");
+ fprintf (stdout,
+ "\t-l LOG_LEVEL\t\t log level, available log levels:"
+ "\n\t\t\t\t\t 0 - critical 1 - errors 2 - warnings"
+ "\n\t\t\t\t\t 3 - information 4 - debug 5- user 6 - trace"
+ "\n\t\t\t\t\t Default log level is 4(debug).\n");
+#ifndef WIN32
+ fprintf (stdout,
+ "\t-f LOG_FILE\t\t log file, default is $AXIS2C_HOME/logs/axis2.log"
+ "\n\t\t\t\t or axis2.log in current folder if AXIS2C_HOME not set\n");
+#else
+ fprintf (stdout,
+ "\t-f LOG_FILE\t\t log file, default is %%AXIS2C_HOME%%\\logs\\axis2.log"
+ "\n\t\t\t\t or axis2.log in current folder if AXIS2C_HOME not set\n");
+#endif
+ fprintf (stdout,
+ "\t-s LOG_FILE_SIZE\t Maximum log file size in mega bytes, default maximum size is 1MB.\n");
+ fprintf (stdout, " Help :\n\t-h \t\t\t display this help screen.\n\n");
+}
+
+#ifndef WIN32
+
+void
+sig_handler (int signal)
+{
+ switch (signal)
+ {
+ case SIGINT:
+ AXIS2_LOG_INFO (server_env->log, "Received signal SIGINT. Server "
+ "shutting down");
+ axis2_amqp_receiver_stop (receiver, server_env);
+ AXIS2_LOG_INFO (server_env->log, "Shutdown complete ...");
+
+ server_exit (0);
+
+ case SIGPIPE:
+ AXIS2_LOG_INFO (server_env->log, "Received signal SIGPIPE. Client "
+ "request serve aborted");
+ return;
+
+ case SIGSEGV:
+ fprintf (stderr, "Received deadly signal SIGSEGV. Terminating ...\n");
+ _exit(-1);
+ }
+}
+
+#endif
+
+int
+main (int argc,
+ char* argv[])
+{
+ axutil_allocator_t* allocator = NULL;
+ extern char* optarg;
+ extern int optopt;
+ int c;
+ const axis2_char_t* qpid_broker_ip = NULL;
+ int qpid_broker_port = -1;
+ const axis2_char_t* repo_path = AXIS2_AMQP_SERVER_REPO_PATH;
+ axutil_log_levels_t log_level = AXIS2_LOG_LEVEL_DEBUG;
+ const axis2_char_t* log_file_name = AXIS2_AMQP_SERVER_LOG_FILE_NAME;
+ int log_file_size = AXUTIL_LOG_FILE_SIZE;
+
+ while ((c = AXIS2_GETOPT (argc, argv, "i:p:r:l:f:s:h")) != -1)
+ {
+ switch (c)
+ {
+ case 'i':
+ qpid_broker_ip = optarg;
+ break;
+
+ case 'p':
+ qpid_broker_port = AXIS2_ATOI (optarg);
+ break;
+
+ case 'r':
+ repo_path = optarg;
+ break;
+
+ case 'l':
+ log_level = AXIS2_ATOI (optarg);
+ if (log_level < AXIS2_LOG_LEVEL_CRITICAL)
+ log_level = AXIS2_LOG_LEVEL_CRITICAL;
+ if (log_level > AXIS2_LOG_LEVEL_TRACE)
+ log_level = AXIS2_LOG_LEVEL_TRACE;
+ break;
+
+ case 'f':
+ log_file_name = optarg;
+ break;
+
+ case 's':
+ log_file_size = 1024 * 1024 * AXIS2_ATOI (optarg);
+ break;
+
+ case 'h':
+ show_usage (argv[0]);
+ return 0;
+
+ case ':':
+ fprintf (stderr, "\nOption -%c requires an operand\n", optopt);
+ show_usage (argv[0]);
+ return -1;
+
+ case '?':
+ if (isprint (optopt))
+ fprintf (stderr, "\nUnknown option `-%c'.\n", optopt);
+ show_usage (argv[0]);
+ return -1;
+ }
+ }
+
+ allocator = axutil_allocator_init (NULL);
+ if (!allocator)
+ {
+ server_exit (-1);
+ }
+
+ server_env = init_server_env (allocator, log_file_name);
+ server_env->log->level = log_level;
+ server_env->log->size = log_file_size;
+
+ axutil_error_init ();
+
+#ifndef WIN32
+ signal (SIGINT, sig_handler);
+ signal (SIGPIPE, sig_handler);
+#endif
+
+ AXIS2_LOG_INFO (server_env->log, "Starting Axis2 AMQP Server ...");
+ AXIS2_LOG_INFO (server_env->log, "Repo Location : %s", repo_path);
+
+ receiver = axis2_amqp_receiver_create (server_env,
+ repo_path,
+ qpid_broker_ip,
+ qpid_broker_port);
+ if (!receiver)
+ {
+ AXIS2_LOG_ERROR (server_env->log, AXIS2_LOG_SI,
+ "Server creation failed: Error code:" " %d :: %s",
+ server_env->error->error_number,
+ AXIS2_ERROR_GET_MESSAGE (server_env->error));
+ server_exit (-1);
+ }
+
+ if (axis2_amqp_receiver_start (receiver, server_env) == AXIS2_FAILURE)
+ {
+ AXIS2_LOG_ERROR (server_env->log, AXIS2_LOG_SI,
+ "Server start failed: Error code:" " %d :: %s",
+ server_env->error->error_number,
+ AXIS2_ERROR_GET_MESSAGE (server_env->error));
+ server_exit (-1);
+ }
+
+ return 0;
+}
Added: webservices/axis2/trunk/c/src/core/transport/amqp/server/axis2_amqp_server/axis2_amqp_server.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/amqp/server/axis2_amqp_server/axis2_amqp_server.h?rev=664506&view=auto
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/amqp/server/axis2_amqp_server/axis2_amqp_server.h (added)
+++ webservices/axis2/trunk/c/src/core/transport/amqp/server/axis2_amqp_server/axis2_amqp_server.h Sun Jun 8 06:25:38 2008
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * 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_AMQP_SERVER_H
+#define AXIS2_AMQP_SERVER_H
+
+#include <platforms/axutil_platform_auto_sense.h>
+
+axutil_env_t*
+init_server_env (axutil_allocator_t* allocator,
+ const axis2_char_t* log_file_name);
+
+void
+server_exit (int status);
+
+void
+show_usage (axis2_char_t* prog_name);
+
+#ifndef WIN32
+
+void
+sig_handler (int signal);
+
+#endif
+
+#define AXIS2_AMQP_SERVER_LOG_FILE_NAME "axis2_amqp_server.log"
+#define AXIS2_AMQP_SERVER_REPO_PATH "../"
+
+#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_AMQP_SERVER_H
+#define AXIS2_AMQP_SERVER_H
+
+#include <platforms/axutil_platform_auto_sense.h>
+
+axutil_env_t*
+init_server_env (axutil_allocator_t* allocator,
+ const axis2_char_t* log_file_name);
+
+void
+server_exit (int status);
+
+void
+show_usage (axis2_char_t* prog_name);
+
+#ifndef WIN32
+
+void
+sig_handler (int signal);
+
+#endif
+
+#define AXIS2_AMQP_SERVER_LOG_FILE_NAME "axis2_amqp_server.log"
+#define AXIS2_AMQP_SERVER_REPO_PATH "../"
+
+#endif
Added: webservices/axis2/trunk/c/src/core/transport/amqp/util/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/amqp/util/Makefile.am?rev=664506&view=auto
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/amqp/util/Makefile.am (added)
+++ webservices/axis2/trunk/c/src/core/transport/amqp/util/Makefile.am Sun Jun 8 06:25:38 2008
@@ -0,0 +1,32 @@
+lib_LTLIBRARIES = libaxis2_amqp_util.la
+
+libaxis2_amqp_util_la_SOURCES = axis2_amqp_util.c
+
+libaxis2_amqp_util_la_LIBADD = $(top_builddir)/util/src/libaxutil.la
+
+libaxis2_amqp_util_la_LDFLAGS = -version-info $(VERSION_NO)
+
+INCLUDES = -I$(top_builddir)/include \
+ -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/engine \
+ -I$(top_builddir)/src/core/deployment \
+ -I$(top_builddir)/util/include \
+ -I$(top_builddir)/axiom/include
+lib_LTLIBRARIES = libaxis2_amqp_util.la
+
+libaxis2_amqp_util_la_SOURCES = axis2_amqp_util.c
+
+libaxis2_amqp_util_la_LIBADD = $(top_builddir)/util/src/libaxutil.la
+
+libaxis2_amqp_util_la_LDFLAGS = -version-info $(VERSION_NO)
+
+INCLUDES = -I$(top_builddir)/include \
+ -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/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/util/axis2_amqp_defines.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/amqp/util/axis2_amqp_defines.h?rev=664506&view=auto
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/amqp/util/axis2_amqp_defines.h (added)
+++ webservices/axis2/trunk/c/src/core/transport/amqp/util/axis2_amqp_defines.h Sun Jun 8 06:25:38 2008
@@ -0,0 +1,54 @@
+/*
+ * 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_DEFINES_H
+#define AXIS2_AMQP_DEFINES_H
+
+#define AXIS2_AMQP_EXCHANGE_DIRECT "amq.direct"
+#define AXIS2_AMQP_RECEIVER_QUEUE_BIND_KEY "axis2.amqp.receiver.queue.bind.key"
+#define AXIS2_AMQP_MSG_CTX_PROPERTY_REPLY_TO "reply_to"
+#define AXIS2_AMQP_MSG_CTX_PROPERTY_QPID_BROKER_IP "qpid_broker_ip"
+#define AXIS2_AMQP_MSG_CTX_PROPERTY_QPID_BROKER_PORT "qpid_broker_port"
+
+#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_DEFINES_H
+#define AXIS2_AMQP_DEFINES_H
+
+#define AXIS2_AMQP_EXCHANGE_DIRECT "amq.direct"
+#define AXIS2_AMQP_RECEIVER_QUEUE_BIND_KEY "axis2.amqp.receiver.queue.bind.key"
+#define AXIS2_AMQP_MSG_CTX_PROPERTY_REPLY_TO "reply_to"
+#define AXIS2_AMQP_MSG_CTX_PROPERTY_QPID_BROKER_IP "qpid_broker_ip"
+#define AXIS2_AMQP_MSG_CTX_PROPERTY_QPID_BROKER_PORT "qpid_broker_port"
+
+#endif
Added: webservices/axis2/trunk/c/src/core/transport/amqp/util/axis2_amqp_util.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/amqp/util/axis2_amqp_util.c?rev=664506&view=auto
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/amqp/util/axis2_amqp_util.c (added)
+++ webservices/axis2/trunk/c/src/core/transport/amqp/util/axis2_amqp_util.c Sun Jun 8 06:25:38 2008
@@ -0,0 +1,288 @@
+/*
+ * 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 <axiom.h>
+#include <axis2_amqp_util.h>
+
+axis2_char_t* AXIS2_CALL
+axis2_amqp_util_get_conf_value_string (axis2_transport_in_desc_t* in_desc,
+ const axutil_env_t* env,
+ const axis2_char_t* param_name)
+{
+ axutil_param_t* param = NULL;
+ axis2_char_t* value = NULL;
+
+ param = (axutil_param_t*)
+ axutil_param_container_get_param (axis2_transport_in_desc_param_container (in_desc, env),
+ env,
+ param_name);
+ if (param)
+ {
+ value = axutil_param_get_value (param, env);
+ }
+
+ return value;
+}
+
+
+int AXIS2_CALL
+axis2_amqp_util_get_conf_value_int (axis2_transport_in_desc_t* in_desc,
+ const axutil_env_t* env,
+ const axis2_char_t* param_name)
+{
+ axis2_char_t* value_str = NULL;
+ int value = 0;
+
+ value_str = axis2_amqp_util_get_conf_value_string (in_desc, env, param_name);
+ if (value_str)
+ {
+ value = atoi (value_str);
+ }
+
+ return value;
+}
+
+
+axiom_soap_envelope_t* AXIS2_CALL
+axis2_amqp_util_get_soap_envelope (const axis2_char_t* content,
+ const axutil_env_t* env)
+{
+ axiom_xml_reader_t* xml_reader = NULL;
+ axiom_stax_builder_t* stax_builder = NULL;
+ axiom_soap_builder_t* soap_builder = NULL;
+ axiom_soap_envelope_t* soap_envelope = NULL;
+
+ xml_reader = axiom_xml_reader_create_for_memory (env,
+ (axis2_char_t*)content,
+ axutil_strlen (content),
+ NULL,
+ AXIS2_XML_PARSER_TYPE_BUFFER);
+ if (!xml_reader)
+ {
+ AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, "Failed to Create XML Reader");
+ return NULL;
+ }
+
+ 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 NULL;
+ }
+
+ 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 NULL;
+ }
+
+ soap_envelope = axiom_soap_builder_get_soap_envelope (soap_builder, env);
+
+ return soap_envelope;
+}
+
+
+axutil_url_t* AXIS2_CALL
+axis2_amqp_util_get_qpid_broker_url (axis2_msg_ctx_t* msg_ctx,
+ const axutil_env_t* env)
+{
+ axis2_endpoint_ref_t* endpoint_ref = NULL;
+ const axis2_char_t* endpoint_ref_str = NULL;
+
+ endpoint_ref = axis2_msg_ctx_get_to (msg_ctx, env);
+ if (!endpoint_ref)
+ return NULL;
+
+ endpoint_ref_str = axis2_endpoint_ref_get_address (endpoint_ref, env);
+ if (!endpoint_ref_str)
+ return NULL;
+
+ return axutil_url_parse_string (env, endpoint_ref_str);
+}
+
+
+axis2_char_t* AXIS2_CALL
+axis2_amqp_util_get_qpid_broker_ip (axis2_msg_ctx_t* msg_ctx,
+ const axutil_env_t* env)
+{
+ axutil_url_t* endpoint_url = axis2_amqp_util_get_qpid_broker_url (msg_ctx, env);
+
+ if (!endpoint_url)
+ return NULL;
+
+ return axutil_url_get_host (endpoint_url, env);
+}
+
+
+int AXIS2_CALL
+axis2_amqp_util_get_qpid_broker_port (axis2_msg_ctx_t* msg_ctx,
+ const axutil_env_t* env)
+{
+ axutil_url_t* endpoint_url = axis2_amqp_util_get_qpid_broker_url (msg_ctx, env);
+
+ if (!endpoint_url)
+ return -1;
+
+ return axutil_url_get_port (endpoint_url, env);;
+}
+/*
+ * 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 <axiom.h>
+#include <axis2_amqp_util.h>
+
+axis2_char_t* AXIS2_CALL
+axis2_amqp_util_get_conf_value_string (axis2_transport_in_desc_t* in_desc,
+ const axutil_env_t* env,
+ const axis2_char_t* param_name)
+{
+ axutil_param_t* param = NULL;
+ axis2_char_t* value = NULL;
+
+ param = (axutil_param_t*)
+ axutil_param_container_get_param (axis2_transport_in_desc_param_container (in_desc, env),
+ env,
+ param_name);
+ if (param)
+ {
+ value = axutil_param_get_value (param, env);
+ }
+
+ return value;
+}
+
+
+int AXIS2_CALL
+axis2_amqp_util_get_conf_value_int (axis2_transport_in_desc_t* in_desc,
+ const axutil_env_t* env,
+ const axis2_char_t* param_name)
+{
+ axis2_char_t* value_str = NULL;
+ int value = 0;
+
+ value_str = axis2_amqp_util_get_conf_value_string (in_desc, env, param_name);
+ if (value_str)
+ {
+ value = atoi (value_str);
+ }
+
+ return value;
+}
+
+
+axiom_soap_envelope_t* AXIS2_CALL
+axis2_amqp_util_get_soap_envelope (const axis2_char_t* content,
+ const axutil_env_t* env)
+{
+ axiom_xml_reader_t* xml_reader = NULL;
+ axiom_stax_builder_t* stax_builder = NULL;
+ axiom_soap_builder_t* soap_builder = NULL;
+ axiom_soap_envelope_t* soap_envelope = NULL;
+
+ xml_reader = axiom_xml_reader_create_for_memory (env,
+ (axis2_char_t*)content,
+ axutil_strlen (content),
+ NULL,
+ AXIS2_XML_PARSER_TYPE_BUFFER);
+ if (!xml_reader)
+ {
+ AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, "Failed to Create XML Reader");
+ return NULL;
+ }
+
+ 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 NULL;
+ }
+
+ 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 NULL;
+ }
+
+ soap_envelope = axiom_soap_builder_get_soap_envelope (soap_builder, env);
+
+ return soap_envelope;
+}
+
+
+axutil_url_t* AXIS2_CALL
+axis2_amqp_util_get_qpid_broker_url (axis2_msg_ctx_t* msg_ctx,
+ const axutil_env_t* env)
+{
+ axis2_endpoint_ref_t* endpoint_ref = NULL;
+ const axis2_char_t* endpoint_ref_str = NULL;
+
+ endpoint_ref = axis2_msg_ctx_get_to (msg_ctx, env);
+ if (!endpoint_ref)
+ return NULL;
+
+ endpoint_ref_str = axis2_endpoint_ref_get_address (endpoint_ref, env);
+ if (!endpoint_ref_str)
+ return NULL;
+
+ return axutil_url_parse_string (env, endpoint_ref_str);
+}
+
+
+axis2_char_t* AXIS2_CALL
+axis2_amqp_util_get_qpid_broker_ip (axis2_msg_ctx_t* msg_ctx,
+ const axutil_env_t* env)
+{
+ axutil_url_t* endpoint_url = axis2_amqp_util_get_qpid_broker_url (msg_ctx, env);
+
+ if (!endpoint_url)
+ return NULL;
+
+ return axutil_url_get_host (endpoint_url, env);
+}
+
+
+int AXIS2_CALL
+axis2_amqp_util_get_qpid_broker_port (axis2_msg_ctx_t* msg_ctx,
+ const axutil_env_t* env)
+{
+ axutil_url_t* endpoint_url = axis2_amqp_util_get_qpid_broker_url (msg_ctx, env);
+
+ if (!endpoint_url)
+ return -1;
+
+ return axutil_url_get_port (endpoint_url, env);;
+}
Added: webservices/axis2/trunk/c/src/core/transport/amqp/util/axis2_amqp_util.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/amqp/util/axis2_amqp_util.h?rev=664506&view=auto
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/amqp/util/axis2_amqp_util.h (added)
+++ webservices/axis2/trunk/c/src/core/transport/amqp/util/axis2_amqp_util.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_UTIL_H
+#define AXIS2_AMQP_UTIL_H
+
+#include <axis2_transport_in_desc.h>
+#include <axutil_param_container.h>
+#include <axiom_soap.h>
+#include <axis2_conf_ctx.h>
+#include <axutil_url.h>
+
+axis2_char_t* AXIS2_CALL
+axis2_amqp_util_get_conf_value_string (axis2_transport_in_desc_t* in_desc,
+ const axutil_env_t* env,
+ const axis2_char_t* param_name);
+
+int AXIS2_CALL
+axis2_amqp_util_get_conf_value_int (axis2_transport_in_desc_t* in_desc,
+ const axutil_env_t* env,
+ const axis2_char_t* param_name);
+
+axiom_soap_envelope_t* AXIS2_CALL
+axis2_amqp_util_get_soap_envelope (const axis2_char_t* content,
+ const axutil_env_t* env);
+
+axutil_url_t* AXIS2_CALL
+axis2_amqp_util_get_qpid_broker_url (axis2_msg_ctx_t* msg_ctx,
+ const axutil_env_t* env);
+
+axis2_char_t* AXIS2_CALL
+axis2_amqp_util_get_qpid_broker_ip (axis2_msg_ctx_t* msg_ctx,
+ const axutil_env_t* env);
+
+int AXIS2_CALL
+axis2_amqp_util_get_qpid_broker_port (axis2_msg_ctx_t* msg_ctx,
+ 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_UTIL_H
+#define AXIS2_AMQP_UTIL_H
+
+#include <axis2_transport_in_desc.h>
+#include <axutil_param_container.h>
+#include <axiom_soap.h>
+#include <axis2_conf_ctx.h>
+#include <axutil_url.h>
+
+axis2_char_t* AXIS2_CALL
+axis2_amqp_util_get_conf_value_string (axis2_transport_in_desc_t* in_desc,
+ const axutil_env_t* env,
+ const axis2_char_t* param_name);
+
+int AXIS2_CALL
+axis2_amqp_util_get_conf_value_int (axis2_transport_in_desc_t* in_desc,
+ const axutil_env_t* env,
+ const axis2_char_t* param_name);
+
+axiom_soap_envelope_t* AXIS2_CALL
+axis2_amqp_util_get_soap_envelope (const axis2_char_t* content,
+ const axutil_env_t* env);
+
+axutil_url_t* AXIS2_CALL
+axis2_amqp_util_get_qpid_broker_url (axis2_msg_ctx_t* msg_ctx,
+ const axutil_env_t* env);
+
+axis2_char_t* AXIS2_CALL
+axis2_amqp_util_get_qpid_broker_ip (axis2_msg_ctx_t* msg_ctx,
+ const axutil_env_t* env);
+
+int AXIS2_CALL
+axis2_amqp_util_get_qpid_broker_port (axis2_msg_ctx_t* msg_ctx,
+ const axutil_env_t* env);
+
+#endif