Author: damitha
Date: Fri Mar 6 00:14:10 2009
New Revision: 750696
URL: http://svn.apache.org/viewvc?rev=750696&view=rev
Log:
Abstracting filter implementation and default implementation of xpath filtering
Added:
webservices/savan/trunk/c/src/filters/
webservices/savan/trunk/c/src/filters/Makefile.am
webservices/savan/trunk/c/src/filters/common/
webservices/savan/trunk/c/src/filters/common/Makefile.am
webservices/savan/trunk/c/src/filters/common/filter.c
webservices/savan/trunk/c/src/filters/xpath/
webservices/savan/trunk/c/src/filters/xpath/Makefile.am
webservices/savan/trunk/c/src/filters/xpath/filter.c
Added: webservices/savan/trunk/c/src/filters/Makefile.am
URL:
http://svn.apache.org/viewvc/webservices/savan/trunk/c/src/filters/Makefile.am?rev=750696&view=auto
==============================================================================
--- webservices/savan/trunk/c/src/filters/Makefile.am (added)
+++ webservices/savan/trunk/c/src/filters/Makefile.am Fri Mar 6 00:14:10 2009
@@ -0,0 +1 @@
+SUBDIRS = common @SAVAN_FILTER@
Added: webservices/savan/trunk/c/src/filters/common/Makefile.am
URL:
http://svn.apache.org/viewvc/webservices/savan/trunk/c/src/filters/common/Makefile.am?rev=750696&view=auto
==============================================================================
--- webservices/savan/trunk/c/src/filters/common/Makefile.am (added)
+++ webservices/savan/trunk/c/src/filters/common/Makefile.am Fri Mar 6
00:14:10 2009
@@ -0,0 +1,9 @@
+noinst_LTLIBRARIES = libsavan_common_filter.la
+
+libsavan_common_filter_la_SOURCES = filter.c
+
+INCLUDES = -I$(top_builddir)/include \
+ @AXIS2INC@ \
+ @AXIOMINC@ \
+ @NEETHIINC@ \
+ @UTILINC@
Added: webservices/savan/trunk/c/src/filters/common/filter.c
URL:
http://svn.apache.org/viewvc/webservices/savan/trunk/c/src/filters/common/filter.c?rev=750696&view=auto
==============================================================================
--- webservices/savan/trunk/c/src/filters/common/filter.c (added)
+++ webservices/savan/trunk/c/src/filters/common/filter.c Fri Mar 6 00:14:10
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_filter.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>
+
+AXIS2_EXTERN void AXIS2_CALL
+savan_filter_free(
+ savan_filter_t *filter,
+ const axutil_env_t *env)
+{
+ return filter->ops->free(filter, env);
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+savan_filter_apply(
+ savan_filter_t *filter,
+ const axutil_env_t *env,
+ savan_subscriber_t *subscriber,
+ axiom_node_t *payload)
+{
+ return filter->ops->apply(filter, env, subscriber, payload);
+}
+
Added: webservices/savan/trunk/c/src/filters/xpath/Makefile.am
URL:
http://svn.apache.org/viewvc/webservices/savan/trunk/c/src/filters/xpath/Makefile.am?rev=750696&view=auto
==============================================================================
--- webservices/savan/trunk/c/src/filters/xpath/Makefile.am (added)
+++ webservices/savan/trunk/c/src/filters/xpath/Makefile.am Fri Mar 6 00:14:10
2009
@@ -0,0 +1,16 @@
+noinst_LTLIBRARIES = libsavan_filter.la
+
+libsavan_filter_la_SOURCES = filter.c
+libsavan_filter_la_LIBADD = ../common/libsavan_common_filter.la \
+ -lxml2
+
+INCLUDES = -I$(top_builddir)/include \
+ -I$(top_builddir)/include/savan \
+ -I. \
+ @AXIS2INC@ \
+ @AXIOMINC@ \
+ @NEETHIINC@ \
+ @REGISTRYINC@ \
+ @UTILINC@
+
+EXTRA_DIST=
Added: webservices/savan/trunk/c/src/filters/xpath/filter.c
URL:
http://svn.apache.org/viewvc/webservices/savan/trunk/c/src/filters/xpath/filter.c?rev=750696&view=auto
==============================================================================
--- webservices/savan/trunk/c/src/filters/xpath/filter.c (added)
+++ webservices/savan/trunk/c/src/filters/xpath/filter.c Fri Mar 6 00:14:10
2009
@@ -0,0 +1,131 @@
+/*
+ * 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_storage_mgr.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>
+
+/**
+ *
+ */
+/**
+ * @brief Savan XPath Filter Struct Impl
+ * Savan XPath Filter
+ */
+typedef struct savan_xpath_filter
+{
+ savan_storage_mgr_t filter;
+ axis2_char_t *dialect;
+ axis2_conf_t *conf;
+} savan_xpath_filter_t;
+
+#define SAVAN_INTF_TO_IMPL(filter) ((savan_xpath_filter_t *) filter)
+
+AXIS2_EXTERN void AXIS2_CALL
+savan_xpath_filter_free(
+ savan_storage_mgr_t *filter,
+ const axutil_env_t *env);
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+savan_xpath_filter_apply(
+ savan_storage_mgr_t *filter,
+ const axutil_env_t *env,
+ savan_subscriber_t *subscriber,
+ axiom_node_t *payload);
+
+static const savan_storage_mgr_ops_t storage_mgr_ops =
+{
+ savan_xpath_filter_free,
+ savan_xpath_filter_apply,
+ NULL
+};
+
+AXIS2_EXTERN savan_storage_mgr_t * AXIS2_CALL
+savan_storage_mgr_create(
+ const axutil_env_t *env,
+ axis2_conf_t *conf)
+{
+ savan_xpath_filter_t *filterimpl = NULL;
+ axis2_status_t status = AXIS2_FAILURE;
+
+ filterimpl = AXIS2_MALLOC(env->allocator, sizeof(savan_xpath_filter_t));
+ if (!filterimpl)
+ {
+ AXIS2_HANDLE_ERROR(env, SAVAN_ERROR_FILTER_CREATION_FAILED,
AXIS2_FAILURE);
+ return NULL;
+ }
+
+ memset ((void *) filterimpl, 0, sizeof(savan_xpath_filter_t));
+
+ filterimpl->dialect = NULL;
+ filterimpl->conf = NULL;
+ filterimpl->filter.ops = &storage_mgr_ops;
+
+ return (savan_storage_mgr_t *) filterimpl;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+savan_xpath_filter_free(
+ savan_storage_mgr_t *filter,
+ const axutil_env_t *env)
+{
+ savan_xpath_filter_t *filterimpl = NULL;
+ filterimpl = SAVAN_INTF_TO_IMPL(filter);
+
+ AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[savan]
Entry:savan_xpath_filter_free");
+
+ if(filterimpl->dialect)
+ {
+ AXIS2_FREE(env->allocator, filterimpl->dialect);
+ filterimpl->dialect = NULL;
+ }
+
+ filterimpl->conf = NULL;
+
+ if(filterimpl)
+ {
+ AXIS2_FREE(env->allocator, filterimpl);
+ filterimpl = NULL;
+ }
+
+ AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[savan]
Exit:savan_xpath_filter_free");
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+savan_xpath_filter_apply(
+ savan_storage_mgr_t *filter,
+ const axutil_env_t *env,
+ savan_subscriber_t *subscriber,
+ axiom_node_t *payload)
+{
+ savan_xpath_filter_t *filterimpl = NULL;
+ filterimpl = SAVAN_INTF_TO_IMPL(filter);
+
+ AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
+ "[savan] Entry:savan_xpath_filter_insert_subscriber");
+
+ AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
+ "[savan] Exit:savan_xpath_filter_insert_subscriber");
+ return AXIS2_SUCCESS;
+}
+