Author: damitha
Date: Thu Apr 2 00:00:34 2009
New Revision: 761110
URL: http://svn.apache.org/viewvc?rev=761110&view=rev
Log:
Adding publisher abstration functionality
Added:
webservices/savan/trunk/c/include/savan_publisher_mod.h
webservices/savan/trunk/c/src/publisher/
webservices/savan/trunk/c/src/publisher/Makefile.am
webservices/savan/trunk/c/src/publisher/common/
webservices/savan/trunk/c/src/publisher/common/Makefile.am
webservices/savan/trunk/c/src/publisher/common/publisher_mod.c
webservices/savan/trunk/c/src/publisher/default/
webservices/savan/trunk/c/src/publisher/default/Makefile.am
webservices/savan/trunk/c/src/publisher/default/publisher_mod.c
webservices/savan/trunk/c/src/publisher/esb/
webservices/savan/trunk/c/src/publisher/esb/Makefile.am
webservices/savan/trunk/c/src/publisher/esb/publisher_mod.c
Added: webservices/savan/trunk/c/include/savan_publisher_mod.h
URL:
http://svn.apache.org/viewvc/webservices/savan/trunk/c/include/savan_publisher_mod.h?rev=761110&view=auto
==============================================================================
--- webservices/savan/trunk/c/include/savan_publisher_mod.h (added)
+++ webservices/savan/trunk/c/include/savan_publisher_mod.h Thu Apr 2 00:00:34
2009
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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 SAVAN_PUBLISHER_MOD_H
+#define SAVAN_PUBLISHER_MOD_H
+
+/**
+ * @file savan_publisher_mod.h
+ * @brief
+ */
+#include <platforms/axutil_platform_auto_sense.h>
+#include <axutil_utils_defines.h>
+#include <axutil_env.h>
+#include <axis2_conf.h>
+#include <axis2_msg_ctx.h>
+#include <axiom_node.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ * @ingroup savan_publisher_mod
+ * @{
+ */
+
+typedef struct savan_publisher_mod savan_publisher_mod_t;
+typedef struct savan_publisher_mod_ops savan_publisher_mod_ops_t;
+
+ /**
+ * @brief Publisher ops struct
+ * Encapsulator struct for ops of savan_publisher_mod
+ */
+AXIS2_DECLARE_DATA struct savan_publisher_mod_ops
+{
+ void (AXIS2_CALL *
+ free)(
+ savan_publisher_mod_t *publisher,
+ const axutil_env_t *env);
+
+ void (AXIS2_CALL *
+ publish)(
+ savan_publisher_mod_t *publisher,
+ const axutil_env_t *env,
+ axis2_msg_ctx_t *msg_ctx);
+
+};
+
+AXIS2_DECLARE_DATA struct savan_publisher_mod
+{
+ const savan_publisher_mod_ops_t *ops;
+};
+
+
+/**
+ * Create the savan publisher.
+ * @param env environment object
+ * @param conf axis2 configuration
+ * @return status of the operation
+ */
+AXIS2_EXTERN savan_publisher_mod_t * AXIS2_CALL
+savan_publisher_mod_create(
+ const axutil_env_t *env,
+ axis2_conf_t *conf);
+
+/**
+ * Deallocate the publisher.
+ * @param publisher
+ * @param env environment object
+ */
+void AXIS2_CALL
+savan_publisher_mod_free(
+ savan_publisher_mod_t *publishermod,
+ const axutil_env_t *envv);
+
+/**
+ * Apply publisher to payload.
+ * @param publisher
+ * @param env environment object
+ * @param msg_ctx Message context of the incoming event message.
+ */
+AXIS2_EXTERN void AXIS2_CALL
+savan_publisher_mod_publish(
+ savan_publisher_mod_t *publishermod,
+ const axutil_env_t *env,
+ axis2_msg_ctx_t *msg_ctx);
+
+/** @} */
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*SAVAN_PUBLISHER_MOD_H*/
Added: webservices/savan/trunk/c/src/publisher/Makefile.am
URL:
http://svn.apache.org/viewvc/webservices/savan/trunk/c/src/publisher/Makefile.am?rev=761110&view=auto
==============================================================================
--- webservices/savan/trunk/c/src/publisher/Makefile.am (added)
+++ webservices/savan/trunk/c/src/publisher/Makefile.am Thu Apr 2 00:00:34 2009
@@ -0,0 +1 @@
+SUBDIRS = common @SAVAN_PUBLISHER@
Added: webservices/savan/trunk/c/src/publisher/common/Makefile.am
URL:
http://svn.apache.org/viewvc/webservices/savan/trunk/c/src/publisher/common/Makefile.am?rev=761110&view=auto
==============================================================================
--- webservices/savan/trunk/c/src/publisher/common/Makefile.am (added)
+++ webservices/savan/trunk/c/src/publisher/common/Makefile.am Thu Apr 2
00:00:34 2009
@@ -0,0 +1,9 @@
+noinst_LTLIBRARIES = libsavan_common_publisher_mod.la
+
+libsavan_common_publisher_mod_la_SOURCES = publisher_mod.c
+
+INCLUDES = -I$(top_builddir)/include \
+ @AXIS2INC@ \
+ @AXIOMINC@ \
+ @NEETHIINC@ \
+ @UTILINC@
Added: webservices/savan/trunk/c/src/publisher/common/publisher_mod.c
URL:
http://svn.apache.org/viewvc/webservices/savan/trunk/c/src/publisher/common/publisher_mod.c?rev=761110&view=auto
==============================================================================
--- webservices/savan/trunk/c/src/publisher/common/publisher_mod.c (added)
+++ webservices/savan/trunk/c/src/publisher/common/publisher_mod.c Thu Apr 2
00:00:34 2009
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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 <savan_publisher_mod.h>
+#include <savan_constants.h>
+#include <savan_error.h>
+#include <savan_util.h>
+#include <axutil_log.h>
+#include <axutil_hash.h>
+#include <axutil_property.h>
+#include <axutil_uuid_gen.h>
+#include <axis2_conf_ctx.h>
+#include <axis2_msg_ctx.h>
+
+AXIS2_EXTERN void AXIS2_CALL
+savan_publisher_mod_free(
+ savan_publisher_mod_t *publishermod,
+ const axutil_env_t *env)
+{
+ return publishermod->ops->free(publishermod, env);
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+savan_publisher_mod_publish(
+ savan_publisher_mod_t *publishermod,
+ const axutil_env_t *env,
+ axis2_msg_ctx_t *msg_ctx)
+{
+ publishermod->ops->publish(publishermod, env, msg_ctx);
+}
+
Added: webservices/savan/trunk/c/src/publisher/default/Makefile.am
URL:
http://svn.apache.org/viewvc/webservices/savan/trunk/c/src/publisher/default/Makefile.am?rev=761110&view=auto
==============================================================================
--- webservices/savan/trunk/c/src/publisher/default/Makefile.am (added)
+++ webservices/savan/trunk/c/src/publisher/default/Makefile.am Thu Apr 2
00:00:34 2009
@@ -0,0 +1,19 @@
+noinst_LTLIBRARIES = libsavan_publisher_mod.la
+libsavan_publisher_mod_la_SOURCES = publisher_mod.c
+data_DATA=
+libsavan_publisher_mod_la_LIBADD =
$(top_builddir)/src/subscribers/libsavan_subscribers.la \
+
$(top_builddir)/src/util/libsavan_util.la \
+
../../storage/@SAVAN_STORAGE@/libsavan_storage.la \
+
../../filters/@SAVAN_FILTER_LIB@ \
+
../common/libsavan_common_publisher_mod.la
+
+INCLUDES = -I$(top_builddir)/include \
+ -I$(top_builddir)/include/savan \
+ -I. \
+ @AXIS2INC@ \
+ @AXIOMINC@ \
+ @NEETHIINC@ \
+ @XPATHINC@ \
+ @UTILINC@
+
+EXTRA_DIST=
Added: webservices/savan/trunk/c/src/publisher/default/publisher_mod.c
URL:
http://svn.apache.org/viewvc/webservices/savan/trunk/c/src/publisher/default/publisher_mod.c?rev=761110&view=auto
==============================================================================
--- webservices/savan/trunk/c/src/publisher/default/publisher_mod.c (added)
+++ webservices/savan/trunk/c/src/publisher/default/publisher_mod.c Thu Apr 2
00:00:34 2009
@@ -0,0 +1,320 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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 <savan_publisher_mod.h>
+#include <axutil_log.h>
+#include <axutil_hash.h>
+#include <axutil_property.h>
+#include <axutil_types.h>
+#include <axutil_file_handler.h>
+#include <platforms/axutil_platform_auto_sense.h>
+#include <axis2_svc_client.h>
+#include <axis2_conf.h>
+#include <axis2_options.h>
+#include <axutil_array_list.h>
+#include <savan_constants.h>
+#include <savan_util.h>
+#include <savan_subscriber.h>
+#include <savan_storage_mgr.h>
+#include <savan_error.h>
+#include <libxslt/xsltutils.h>
+#include <axiom_soap.h>
+#include <axiom_soap_const.h>
+#include <axiom_soap_envelope.h>
+#include <axiom_element.h>
+#include <axiom_node.h>
+
+/**
+ *
+ */
+/**
+ * @brief Savan Default Publisher Struct Impl
+ * Savan Default Publisher
+ */
+typedef struct savan_default_publisher_mod
+{
+ savan_publisher_mod_t publishermod;
+ axis2_conf_t *conf;
+} savan_default_publisher_mod_t;
+
+#define SAVAN_INTF_TO_IMPL(publishermod) ((savan_default_publisher_mod_t *)
publishermod)
+
+AXIS2_EXTERN void AXIS2_CALL
+savan_default_publisher_mod_free(
+ savan_publisher_mod_t *publishermod,
+ const axutil_env_t *env);
+
+AXIS2_EXTERN void AXIS2_CALL
+savan_default_publisher_mod_publish(
+ savan_publisher_mod_t *publishermod,
+ const axutil_env_t *env,
+ axis2_msg_ctx_t *msg_ctx);
+
+static axis2_status_t
+savan_default_publisher_mod_publish_to_subscriber(
+ savan_publisher_mod_t *publishermod,
+ const axutil_env_t *env,
+ axis2_svc_client_t *svc_client,
+ savan_subscriber_t *subscriber,
+ savan_filter_mod_t *filtermod,
+ axiom_node_t *payload);
+
+static const savan_publisher_mod_ops_t savan_publisher_mod_ops =
+{
+ savan_default_publisher_mod_free,
+ savan_default_publisher_mod_publish
+};
+
+AXIS2_EXTERN savan_publisher_mod_t * AXIS2_CALL
+savan_publisher_mod_create(
+ const axutil_env_t *env,
+ axis2_conf_t *conf)
+{
+ savan_default_publisher_mod_t *publishermodimpl = NULL;
+
+ publishermodimpl = AXIS2_MALLOC(env->allocator,
sizeof(savan_default_publisher_mod_t));
+ if (!publishermodimpl)
+ {
+ AXIS2_HANDLE_ERROR(env, SAVAN_ERROR_FILTER_CREATION_FAILED,
AXIS2_FAILURE);
+ return NULL;
+ }
+
+ memset ((void *) publishermodimpl, 0,
sizeof(savan_default_publisher_mod_t));
+
+ publishermodimpl->conf = conf;
+ publishermodimpl->publishermod.ops = &savan_publisher_mod_ops;
+
+ return (savan_publisher_mod_t *) publishermodimpl;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+savan_default_publisher_mod_free(
+ savan_publisher_mod_t *publishermod,
+ const axutil_env_t *env)
+{
+ savan_default_publisher_mod_t *publishermodimpl = NULL;
+ publishermodimpl = SAVAN_INTF_TO_IMPL(publishermod);
+
+ AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[savan]
Entry:savan_default_publisher_mod_free");
+
+ publishermodimpl->conf = NULL;
+
+ if(publishermodimpl)
+ {
+ AXIS2_FREE(env->allocator, publishermodimpl);
+ publishermodimpl = NULL;
+ }
+
+ AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[savan]
Exit:savan_default_publisher_mod_free");
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+savan_default_publisher_mod_publish(
+ savan_publisher_mod_t *publishermod,
+ const axutil_env_t *env,
+ axis2_msg_ctx_t *msg_ctx)
+{
+ savan_default_publisher_mod_t *publishermodimpl = NULL;
+ axutil_array_list_t *subs_store = NULL;
+ int i = 0, size = 0;
+ savan_storage_mgr_t *storage_mgr = NULL;
+ savan_filter_mod_t *filtermod = NULL;
+ axis2_char_t *path = NULL;
+ axis2_conf_ctx_t *client_conf_ctx = NULL;
+ axis2_svc_t *client_svc = NULL;
+ axis2_svc_client_t *svc_client = NULL;
+ axiom_node_t *payload = NULL;
+ axiom_soap_envelope_t *envelope = NULL;
+ axiom_soap_body_t *body = NULL;
+ axiom_node_t *body_node = NULL;
+ axis2_char_t *filter = NULL;
+
+ publishermodimpl = SAVAN_INTF_TO_IMPL(publishermod);
+
+ AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[savan]
Entry:savan_default_publisher_mod_publish");
+
+ storage_mgr = savan_util_get_storage_mgr(env, NULL,
publishermodimpl->conf);
+ axutil_allocator_switch_to_global_pool(env->allocator);
+ if(storage_mgr)
+ {
+ subs_store = savan_storage_mgr_retrieve_all_subscribers(storage_mgr,
env, filter);
+ }
+
+ if (!subs_store)
+ {
+ axutil_allocator_switch_to_local_pool(env->allocator);
+ AXIS2_LOG_WARNING(env->log, AXIS2_LOG_SI, "[savan] Subscriber store is
NULL");
+ }
+
+ path = AXIS2_GETENV("AXIS2C_HOME");
+ svc_client = axis2_svc_client_create(env, path);
+
+ if(!svc_client)
+ {
+ axutil_allocator_switch_to_local_pool(env->allocator);
+ AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI,
+ "[savan]svc_client creation failed, unable to continue");
+ }
+
+ client_conf_ctx = axis2_svc_client_get_conf_ctx(svc_client, env);
+ client_svc = axis2_svc_client_get_svc(svc_client, env);
+
+ envelope = axis2_msg_ctx_get_soap_envelope(msg_ctx, env);
+ if (!envelope)
+ {
+ axutil_allocator_switch_to_local_pool(env->allocator);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[savan] Failed to extract the
soap envelop");
+ }
+
+ body = axiom_soap_envelope_get_body(envelope, env);
+ if (!body)
+ {
+ axutil_allocator_switch_to_local_pool(env->allocator);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[savan] Failed to extract the
soap body");
+ }
+
+ body_node = axiom_soap_body_get_base_node(body, env);
+
+ payload = axiom_node_get_first_child(body_node, env);
+
+ size = axutil_array_list_size(subs_store, env);
+ for(i = 0; i < size; i++)
+ {
+ axis2_svc_client_t *svc_client = NULL;
+ savan_subscriber_t *sub = NULL;
+
+ sub = (savan_subscriber_t *)axutil_array_list_get(subs_store, env, i);
+ if (sub)
+ {
+ axis2_char_t *id = savan_subscriber_get_id(sub, env);
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[savan] Publishing
to:%s", id);
+
+ svc_client = axis2_svc_client_create_with_conf_ctx_and_svc(env,
path, client_conf_ctx,
+ client_svc);
+ filtermod = savan_util_get_filter_module(env,
publishermodimpl->conf);
+ /* Ideally publishing to each subscriber should happen within a
thread for each
+ * subscriber. However until Axis2/C provide a good thread pool to
handle
+ * such tasks I use this sequential publishing to subscribers.
+ */
+
if(!savan_default_publisher_mod_publish_to_subscriber(publishermod, env,
svc_client, sub,
+ filtermod, payload))
+ {
+ axis2_endpoint_ref_t *notifyto =
savan_subscriber_get_notify_to(sub, env);
+ const axis2_char_t *address = NULL;
+
+ if(notifyto)
+ {
+ address = axis2_endpoint_ref_get_address(notifyto, env);
+ }
+
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Publishing to the Data Sink:%s proviced by
subscriber:%s Failed. Check "\
+ "whether the Data Sink url is correct", address, id);
+ }
+ if(svc_client)
+ {
+ axis2_svc_client_free(svc_client, env);
+ }
+ }
+ }
+
+ if(svc_client)
+ {
+ axis2_svc_client_free(svc_client, env);
+ }
+ axutil_allocator_switch_to_local_pool(env->allocator);
+
+ AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[savan]
Exit:savan_default_publisher_mod_publish");
+}
+
+static axis2_status_t
+savan_default_publisher_mod_publish_to_subscriber(
+ savan_publisher_mod_t *publishermod,
+ const axutil_env_t *env,
+ axis2_svc_client_t *svc_client,
+ savan_subscriber_t *subscriber,
+ savan_filter_mod_t *filtermod,
+ axiom_node_t *payload)
+{
+ axis2_options_t *options = NULL;
+ axis2_status_t status = AXIS2_SUCCESS;
+ axis2_endpoint_ref_t *to = NULL;
+ const axis2_char_t *address = NULL;
+ axis2_bool_t filter_apply = AXIS2_TRUE;
+ axis2_endpoint_ref_t *notifyto = NULL;
+
+ AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[savan]
Entry:savan_default_publisher_mod_publish_to_subscriber");
+
+ options = (axis2_options_t *) axis2_svc_client_get_options(svc_client,
env);
+ if(!options)
+ {
+ options = axis2_options_create(env);
+ axis2_svc_client_set_options(svc_client, env, options);
+ }
+
+ notifyto = savan_subscriber_get_notify_to(subscriber, env);
+ if(notifyto)
+ {
+ address = axis2_endpoint_ref_get_address(notifyto, env);
+ if(address)
+ {
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[savan] Publishing
to:%s", address);
+ to = axis2_endpoint_ref_create(env, address);
+ axis2_options_set_to(options, env, to);
+ }
+ }
+ axis2_options_set_xml_parser_reset(options, env, AXIS2_FALSE);
+
+ /* If this is a filtering request and we cannot find any filter module to
filter then error */
+ if(savan_subscriber_get_filter(subscriber, env) && !filtermod)
+ {
+ AXIS2_HANDLE_ERROR(env,
SAVAN_ERROR_FILTER_MODULE_COULD_NOT_BE_RETRIEVED, AXIS2_FAILURE);
+ return AXIS2_FAILURE;
+ }
+
+#ifdef SAVAN_FILTERING
+ /* If this is a filtering request and filter module is defined then filter
the request.
+ */
+ if(filtermod && savan_subscriber_get_filter(subscriber, env))
+ {
+ /* Apply the filter, and check whether it evaluates to success */
+ filter_apply = savan_filter_mod_apply(filtermod ,env, subscriber,
payload);
+ if(!filter_apply)
+ {
+ status = axutil_error_get_status_code(env->error);
+ if(AXIS2_SUCCESS != status)
+ {
+ axiom_node_detach(payload, env);
+ return status;
+ }
+ }
+ }
+#endif
+
+ if(filter_apply)
+ {
+ axis2_svc_client_fire_and_forget(svc_client, env, payload);
+ }
+
+ axiom_node_detach(payload, env); /*insert this to prevent payload
corruption in subsequent
+ "publish" calls with some payload.*/
+
+ AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[savan]
Exit:savan_default_publisher_mod_publish_to_subscriber");
+
+ return status;
+}
+
+
Added: webservices/savan/trunk/c/src/publisher/esb/Makefile.am
URL:
http://svn.apache.org/viewvc/webservices/savan/trunk/c/src/publisher/esb/Makefile.am?rev=761110&view=auto
==============================================================================
--- webservices/savan/trunk/c/src/publisher/esb/Makefile.am (added)
+++ webservices/savan/trunk/c/src/publisher/esb/Makefile.am Thu Apr 2 00:00:34
2009
@@ -0,0 +1,17 @@
+noinst_LTLIBRARIES = libsavan_publisher_mod.la
+
+libsavan_publisher_mod_la_SOURCES = publisher_mod.c
+libsavan_publisher_mod_la_LIBADD = ../common/libsavan_common_publisher_mod.la
-lxml2
+
+data_DATA=
+
+INCLUDES = -I$(top_builddir)/include \
+ -I$(top_builddir)/include/savan \
+ -I. \
+ @AXIS2INC@ \
+ @AXIOMINC@ \
+ @NEETHIINC@ \
+ @XPATHINC@ \
+ @UTILINC@
+
+EXTRA_DIST=
Added: webservices/savan/trunk/c/src/publisher/esb/publisher_mod.c
URL:
http://svn.apache.org/viewvc/webservices/savan/trunk/c/src/publisher/esb/publisher_mod.c?rev=761110&view=auto
==============================================================================
--- webservices/savan/trunk/c/src/publisher/esb/publisher_mod.c (added)
+++ webservices/savan/trunk/c/src/publisher/esb/publisher_mod.c Thu Apr 2
00:00:34 2009
@@ -0,0 +1,142 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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 <savan_publisher_mod.h>
+#include <axutil_log.h>
+#include <axutil_hash.h>
+#include <axutil_property.h>
+#include <axutil_types.h>
+#include <axutil_file_handler.h>
+#include <platforms/axutil_platform_auto_sense.h>
+#include <savan_constants.h>
+#include <savan_util.h>
+#include <savan_error.h>
+#include <libxslt/xsltutils.h>
+#include <axiom_soap.h>
+#include <axiom_soap_const.h>
+#include <axiom_soap_envelope.h>
+#include <axiom_element.h>
+#include <axiom_node.h>
+
+/**
+ *
+ */
+/**
+ * @brief Savan XPath Publisher Struct Impl
+ * Savan XPath Publisher
+ */
+typedef struct savan_esb_publisher_mod
+{
+ savan_publisher_mod_t publishermod;
+ axis2_conf_t *conf;
+} savan_esb_publisher_mod_t;
+
+#define SAVAN_INTF_TO_IMPL(publishermod) ((savan_esb_publisher_mod_t *)
publishermod)
+
+AXIS2_EXTERN void AXIS2_CALL
+savan_esb_publisher_mod_free(
+ savan_publisher_mod_t *publishermod,
+ const axutil_env_t *env);
+
+AXIS2_EXTERN void AXIS2_CALL
+savan_esb_publisher_mod_publish(
+ savan_publisher_mod_t *publishermod,
+ const axutil_env_t *env,
+ axis2_msg_ctx_t *msg_ctx);
+
+static const savan_publisher_mod_ops_t savan_publisher_mod_ops =
+{
+ savan_esb_publisher_mod_free,
+ savan_esb_publisher_mod_publish
+};
+
+AXIS2_EXTERN savan_publisher_mod_t * AXIS2_CALL
+savan_publisher_mod_create(
+ const axutil_env_t *env,
+ axis2_conf_t *conf)
+{
+ savan_esb_publisher_mod_t *publishermodimpl = NULL;
+ axis2_char_t *publisher_template_path = NULL;
+
+ publishermodimpl = AXIS2_MALLOC(env->allocator,
sizeof(savan_esb_publisher_mod_t));
+ if (!publishermodimpl)
+ {
+ AXIS2_HANDLE_ERROR(env, SAVAN_ERROR_FILTER_CREATION_FAILED,
AXIS2_FAILURE);
+ return NULL;
+ }
+
+ memset ((void *) publishermodimpl, 0, sizeof(savan_esb_publisher_mod_t));
+
+ publisher_template_path = savan_util_get_module_param(env, conf,
SAVAN_FILTER_TEMPLATE_PATH);
+ if(!publisher_template_path)
+ {
+ savan_esb_publisher_mod_free((savan_publisher_mod_t *)
publishermodimpl, env);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[savan] Publisher template
path not set");
+ return NULL;
+ }
+
+ publishermodimpl->publisher_template_path = publisher_template_path;
+
+ publishermodimpl->dialect = NULL;
+ publishermodimpl->conf = conf;
+ publishermodimpl->publishermod.ops = &savan_publisher_mod_ops;
+
+ return (savan_publisher_mod_t *) publishermodimpl;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+savan_esb_publisher_mod_free(
+ savan_publisher_mod_t *publishermod,
+ const axutil_env_t *env)
+{
+ savan_esb_publisher_mod_t *publishermodimpl = NULL;
+ publishermodimpl = SAVAN_INTF_TO_IMPL(publishermod);
+
+ AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[savan]
Entry:savan_esb_publisher_mod_free");
+
+ if(publishermodimpl->dialect)
+ {
+ AXIS2_FREE(env->allocator, publishermodimpl->dialect);
+ publishermodimpl->dialect = NULL;
+ }
+
+ publishermodimpl->conf = NULL;
+
+ if(publishermodimpl)
+ {
+ AXIS2_FREE(env->allocator, publishermodimpl);
+ publishermodimpl = NULL;
+ }
+
+ AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[savan]
Exit:savan_esb_publisher_mod_free");
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+savan_esb_publisher_mod_publish(
+ savan_publisher_mod_t *publishermod,
+ const axutil_env_t *env,
+ axis2_msg_ctx_t *msg_ctx)
+{
+ savan_esb_publisher_mod_t *publishermodimpl = NULL;
+
+ publishermodimpl = SAVAN_INTF_TO_IMPL(publishermod);
+
+ AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[savan]
Entry:savan_esb_publisher_mod_publish");
+
+ AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[savan]
Exit:savan_esb_publisher_mod_publish");
+ return AXIS2_FALSE;
+}
+