axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sam...@apache.org
Subject svn commit: r354967 - in /webservices/axis2/trunk/c: include/axis2_event.h modules/core/engine/src/Makefile.am modules/core/engine/src/event.c
Date Thu, 08 Dec 2005 04:01:16 GMT
Author: samisa
Date: Wed Dec  7 20:01:03 2005
New Revision: 354967

URL: http://svn.apache.org/viewcvs?rev=354967&view=rev
Log:
added initial compling version of event 

Added:
    webservices/axis2/trunk/c/include/axis2_event.h
    webservices/axis2/trunk/c/modules/core/engine/src/event.c
Modified:
    webservices/axis2/trunk/c/modules/core/engine/src/Makefile.am

Added: webservices/axis2/trunk/c/include/axis2_event.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_event.h?rev=354967&view=auto
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_event.h (added)
+++ webservices/axis2/trunk/c/include/axis2_event.h Wed Dec  7 20:01:03 2005
@@ -0,0 +1,83 @@
+/*
+ * 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 AXIS2_EVENT_H
+#define AXIS2_EVENT_H
+
+
+/**
+  * @file axis2_event.h
+  * @brief axis2 Message Context interface
+  */
+
+#include <axis2_defines.h>
+#include <axis2_env.h>
+#include <axis2_svc.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/** @defgroup axis2_event Event
+ * @ingroup axis2_core_engine
+ * @{
+ */
+    
+#define AXIS2_SERVICE_DEPLOY 1
+#define AXIS2_SERVICE_REMOVE 0
+    
+typedef struct axis2_event_ops axis2_event_ops_t;
+typedef struct axis2_event axis2_event_t; 
+
+    
+/** 
+ * @brief An Axis event is sent to registered listeners whenever anything significant 
+ * happens to <code>AxisConfiguration</code>.
+ */
+struct axis2_event_ops
+{
+    axis2_svc_t* (AXIS2_CALL *get_svc)(struct axis2_event *event, axis2_env_t **env);
+    int (AXIS2_CALL *get_event_type)(struct axis2_event *event, axis2_env_t **env);
+    axis2_status_t (AXIS2_CALL *free)(struct axis2_event *event, 
+                                       axis2_env_t **env);
+};
+
+/** 
+ * @brief Message Context struct
+  *	Axis2 Message Context
+ */
+struct axis2_event
+{
+    axis2_event_ops_t *ops;    
+};
+
+AXIS2_DECLARE(axis2_event_t*) axis2_event_create(axis2_env_t **env, axis2_svc_t *svc, int
event_type);
+    
+/************************** Start of function macros **************************/
+
+#define AXIS2_EVENT_GET_SVC(event, env) ((event)->ops->get_svc(event, env))
+#define AXIS2_EVENT_GET_EVENT_TYPE(event, env) ((event)->ops->get_event_type(event,
env))
+#define AXIS2_EVENT_FREE(event, env) ((event)->ops->free (event, env))
+
+/************************** End of function macros ****************************/    
+
+/** @} */
+#ifdef __cplusplus
+}
+#endif
+
+#endif                          /* AXIS2_EVENT_H */

Modified: webservices/axis2/trunk/c/modules/core/engine/src/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/engine/src/Makefile.am?rev=354967&r1=354966&r2=354967&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/engine/src/Makefile.am (original)
+++ webservices/axis2/trunk/c/modules/core/engine/src/Makefile.am Wed Dec  7 20:01:03 2005
@@ -1,6 +1,6 @@
 lib_LTLIBRARIES = libaxis2_engine.la
 AM_CPPFLAGS = $(CPPFLAGS)
-libaxis2_engine_la_SOURCES = handler.c msg_recv.c engine_config.c phase.c disp_checker.c
+libaxis2_engine_la_SOURCES = handler.c msg_recv.c engine_config.c phase.c disp_checker.c
event.c
 
 libaxis2_engine_la_LIBADD = $(LDFLAGS)
 INCLUDES = -I${CUTEST_HOME}/include \

Added: webservices/axis2/trunk/c/modules/core/engine/src/event.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/engine/src/event.c?rev=354967&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/core/engine/src/event.c (added)
+++ webservices/axis2/trunk/c/modules/core/engine/src/event.c Wed Dec  7 20:01:03 2005
@@ -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.
+ */
+
+#include <axis2_event.h>
+#include <axis2.h>
+
+typedef struct axis2_event_impl
+{
+    /** context base struct */
+    axis2_event_t event;
+    /** service the event registered to */
+    axis2_svc_t *svc;
+    /** event type */
+    int event_type;
+} axis2_event_impl_t;
+
+/** Interface to implementation conversion macro */
+#define AXIS2_INTF_TO_IMPL(event) ((axis2_event_impl_t *)event)
+
+axis2_svc_t* AXIS2_CALL axis2_event_get_svc(struct axis2_event *event, axis2_env_t **env);
+int AXIS2_CALL axis2_event_get_event_type(struct axis2_event *event, axis2_env_t **env);
+axis2_status_t AXIS2_CALL axis2_event_free(struct axis2_event *event, 
+                                   axis2_env_t **env);
+
+axis2_event_t* AXIS2_CALL axis2_event_create(axis2_env_t **env, axis2_svc_t *svc, int event_type)
+{
+    axis2_event_impl_t *event_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    event_impl = AXIS2_MALLOC( (*env)->allocator, sizeof(axis2_event_impl_t) );
+    if (!event_impl)
+    { 
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;        
+    }
+
+    event_impl->event.ops = NULL;
+    event_impl->svc = NULL;
+	event_impl->event_type = event_type;
+    
+    if (svc)
+    {
+        event_impl->svc = svc;
+    }
+	
+    /* initialize operations */
+    event_impl->event.ops  = AXIS2_MALLOC( (*env)->allocator, sizeof(axis2_event_ops_t)
);
+    if (!event_impl->event.ops)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        axis2_event_free(&(event_impl->event), env);
+        return NULL;        
+    }
+
+    event_impl->event.ops->get_svc = axis2_event_get_svc;
+    event_impl->event.ops->get_event_type = axis2_event_get_event_type;
+    event_impl->event.ops->free = axis2_event_free;
+
+    return &(event_impl->event);
+}
+
+axis2_svc_t* AXIS2_CALL axis2_event_get_svc(struct axis2_event *event, axis2_env_t **env)

+{
+    AXIS2_FUNC_PARAM_CHECK(event, env, NULL);
+    return AXIS2_INTF_TO_IMPL(event)->svc;
+}
+
+int AXIS2_CALL axis2_event_get_event_type(struct axis2_event *event, axis2_env_t **env) 
+{
+    AXIS2_FUNC_PARAM_CHECK(event, env, AXIS2_FAILURE);
+    return AXIS2_INTF_TO_IMPL(event)->event_type;
+}
+
+axis2_status_t AXIS2_CALL axis2_event_free (struct axis2_event *event, 
+                                   axis2_env_t **env)
+{
+    axis2_event_impl_t *event_impl = NULL;
+    
+    AXIS2_FUNC_PARAM_CHECK(event, env, AXIS2_FAILURE);
+    
+    event_impl = AXIS2_INTF_TO_IMPL(event);
+    
+    if (event_impl->event.ops)
+    {
+        AXIS2_FREE((*env)->allocator, event_impl->event.ops);
+        event_impl->event.ops = NULL;
+    }
+    
+    AXIS2_FREE((*env)->allocator, event_impl);
+    event_impl = NULL;
+    
+    return AXIS2_SUCCESS;
+}



Mime
View raw message