axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sa...@apache.org
Subject svn commit: r395824 - in /webservices/axis2/trunk/c: include/ modules/core/deployment/ modules/core/engine/ modules/core/util/ modules/util/ test/core/deployment/
Date Fri, 21 Apr 2006 09:38:52 GMT
Author: sahan
Date: Fri Apr 21 02:38:49 2006
New Revision: 395824

URL: http://svn.apache.org/viewcvs?rev=395824&view=rev
Log:
Adding module versioning support

Modified:
    webservices/axis2/trunk/c/include/axis2_conf.h
    webservices/axis2/trunk/c/modules/core/deployment/axis2_deployment.h
    webservices/axis2/trunk/c/modules/core/deployment/conf_builder.c
    webservices/axis2/trunk/c/modules/core/deployment/dep_engine.c
    webservices/axis2/trunk/c/modules/core/deployment/module_builder.c
    webservices/axis2/trunk/c/modules/core/engine/conf.c
    webservices/axis2/trunk/c/modules/core/util/axis2_core_utils.h
    webservices/axis2/trunk/c/modules/core/util/core_utils.c
    webservices/axis2/trunk/c/modules/util/dir_handler.c
    webservices/axis2/trunk/c/test/core/deployment/Makefile.am
    webservices/axis2/trunk/c/test/core/deployment/test_deployment.c

Modified: webservices/axis2/trunk/c/include/axis2_conf.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_conf.h?rev=395824&r1=395823&r2=395824&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_conf.h (original)
+++ webservices/axis2/trunk/c/include/axis2_conf.h Fri Apr 21 02:38:49 2006
@@ -163,7 +163,7 @@
     get_module) (axis2_conf_t *conf,
                     axis2_env_t **env,
                     axis2_qname_t *qname);
-    
+   
     /**
      * Method getEngadgedModules
      *
@@ -308,7 +308,26 @@
     set_dep_engine)(axis2_conf_t *conf,
                                 axis2_env_t **env,
                                 struct axis2_dep_engine *dep_engine);
-                   
+    
+    axis2_char_t * (AXIS2_CALL *
+    get_default_module_version)(axis2_conf_t *conf, 
+                                axis2_env_t **env, 
+                                axis2_char_t* module_name);
+                                
+    struct axis2_module_desc * (AXIS2_CALL *
+    get_default_module)(axis2_conf_t *conf,axis2_env_t **env, 
+                                axis2_char_t *module_name);
+
+    axis2_status_t (AXIS2_CALL *
+    add_default_module_version)(axis2_conf_t *conf, axis2_env_t **env,
+                                axis2_char_t *module_name, 
+                                axis2_char_t *module_version);
+
+    axis2_status_t (AXIS2_CALL *
+    engage_module_with_version)(axis2_conf_t *conf, axis2_env_t **env,
+                                            axis2_char_t *module_name,
+                                            axis2_char_t *version_id);
+                                
 };
 
 /**
@@ -402,7 +421,6 @@
 #define AXIS2_CONF_GET_OUT_FAULT_FLOW(conf, env) \
         ((conf)->ops->get_out_faultflow(conf , env)) 
 
-
 #define AXIS2_CONF_GET_FAULTY_SVCS(conf, env) \
         ((conf)->ops->get_faulty_svcs(conf , env)) 
 
@@ -463,6 +481,18 @@
 #define AXIS2_CONF_SET_DEP_ENGINE(conf, env, dep_engine) \
         ((conf)->ops->set_dep_engine(conf, env, dep_engine))
 
+#define AXIS2_CONF_GET_DEFAULT_MODULE_VERSION(conf, env, module_name)\
+        ((conf)->ops->get_default_module_version(conf, env, module_name))
+
+#define AXIS2_CONF_GET_DEFAULT_MODULE(conf, env, module_name)\
+        ((conf)->ops->get_default_module(conf, env, module_name))
+        
+#define AXIS2_CONF_ADD_DEFAULT_MODULE_VERSION(conf, env, mod_name, mod_ver)\
+        ((conf)->ops->add_default_module_version(conf, env, mod_name, mod_ver))
+        
+#define AXIS2_CONF_ENGAGE_MODULE_WITH_VERSION(conf, env, mod_name, mod_ver)\
+        ((conf)->ops->engage_module_with_version(conf, env, mod_name, mod_ver))   
   
+        
 /************************* End of function macros *****************************/
 
 /** @} */

Modified: webservices/axis2/trunk/c/modules/core/deployment/axis2_deployment.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/deployment/axis2_deployment.h?rev=395824&r1=395823&r2=395824&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/deployment/axis2_deployment.h (original)
+++ webservices/axis2/trunk/c/modules/core/deployment/axis2_deployment.h Fri Apr 21 02:38:49
2006
@@ -128,6 +128,9 @@
  * msg recv library handler
  */
 #define AXIS2_MSG_RECV_PARAM "msg_recv_param"
+
+#define AXIS2_ATTRIBUTE_DEFAULT_VERSION "version"
+#define AXIS2_DEFAULT_MODULE_VERSION "defaultModuleVersions"
 	
 /*********************************** Constants*********************************/	
 	

Modified: webservices/axis2/trunk/c/modules/core/deployment/conf_builder.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/deployment/conf_builder.c?rev=395824&r1=395823&r2=395824&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/deployment/conf_builder.c (original)
+++ webservices/axis2/trunk/c/modules/core/deployment/conf_builder.c Fri Apr 21 02:38:49 2006
@@ -71,7 +71,12 @@
 axis2_conf_builder_process_transport_recvs(axis2_conf_builder_t *conf_builder,
                                     axis2_env_t **env,
                                     axis2_om_children_qname_iterator_t *trs_recvs);
-
+                                    
+static axis2_status_t 
+axis2_conf_builder_process_default_module_versions(
+                            axis2_conf_builder_t *conf_builder,
+                            axis2_env_t **env, 
+                            axis2_om_children_qname_iterator_t *module_versions);
 /************************** End of function prototypes ************************/
 
 AXIS2_DECLARE(axis2_conf_builder_t *) 
@@ -181,12 +186,14 @@
     axis2_qname_t *qtransportsender = NULL;
     axis2_qname_t *qtransportrecv = NULL;
     axis2_qname_t *qphaseorder = NULL;
+    axis2_qname_t *qdefmodver = NULL;
     axis2_om_children_qname_iterator_t *itr = NULL;
     axis2_om_children_qname_iterator_t *msg_recvs = NULL;
     axis2_om_children_qname_iterator_t *module_itr = NULL;
     axis2_om_children_qname_iterator_t *trs_senders = NULL;
     axis2_om_children_qname_iterator_t *trs_recvs = NULL;
     axis2_om_children_qname_iterator_t *phase_orders = NULL;
+    axis2_om_children_qname_iterator_t *def_mod_versions = NULL;
     axis2_om_element_t *conf_element = NULL;
     axis2_om_node_t *conf_node = NULL;
     axis2_om_element_t *disp_order_element = NULL;
@@ -298,6 +305,21 @@
     AXIS2_QNAME_FREE(qphaseorder, env);
     axis2_conf_builder_process_phase_orders(conf_builder, env, phase_orders);
 
+    /* Processing default module versions */
+    qdefmodver = axis2_qname_create(env, AXIS2_DEFAULT_MODULE_VERSION, NULL, 
+                        NULL);
+    def_mod_versions = AXIS2_OM_ELEMENT_GET_CHILDREN_WITH_QNAME(conf_element, 
+                                    env, qdefmodver, conf_node);
+    AXIS2_QNAME_FREE(qphaseorder, env);
+    if(NULL != def_mod_versions)
+    {
+        status = axis2_conf_builder_process_default_module_versions(conf_builder
+                        , env, def_mod_versions);
+        if(AXIS2_FAILURE == status)
+        {
+            return AXIS2_FAILURE;
+        }                        
+    }
     /* TODO processing Axis Storages */
     return AXIS2_SUCCESS;
 }
@@ -1074,6 +1096,62 @@
     return AXIS2_SUCCESS;
 }
 
+axis2_status_t AXIS2_CALL
+axis2_conf_builder_process_default_module_versions(
+                            axis2_conf_builder_t *conf_builder,
+                            axis2_env_t **env, 
+                            axis2_om_children_qname_iterator_t *module_versions)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK((*env)->error, module_versions, AXIS2_FAILURE);
+    
+    while (AXIS2_OM_CHILDREN_ITERATOR_HAS_NEXT(module_versions, env))
+    {
+        axis2_om_element_t *om_element = NULL;
+        axis2_char_t *name = NULL;
+        axis2_char_t *default_version = NULL;
+        axis2_qname_t *attribute_qname = NULL;
+        
+        om_element = (axis2_om_element_t *) 
+                        AXIS2_OM_CHILDREN_ITERATOR_NEXT(module_versions, env);
+        if(NULL == om_element)
+        {
+            continue;
+        }
+        attribute_qname = axis2_qname_create(env, AXIS2_ATTNAME, NULL, NULL);
+        if(NULL == attribute_qname)
+        {
+            continue;
+        }
+        name = AXIS2_OM_ELEMENT_GET_ATTRIBUTE_VALUE(om_element, env, 
+                                                    attribute_qname);
+        AXIS2_QNAME_FREE(attribute_qname, env);
+        attribute_qname = NULL;
+        if (NULL == name)
+        {
+            return AXIS2_FAILURE;
+        }
+        attribute_qname = axis2_qname_create(env, 
+                        AXIS2_ATTRIBUTE_DEFAULT_VERSION, NULL, NULL);
+        if(NULL == attribute_qname)
+        {
+            continue;
+        }
+        default_version = AXIS2_OM_ELEMENT_GET_ATTRIBUTE_VALUE(om_element, env, 
+                        attribute_qname);
+        AXIS2_QNAME_FREE(attribute_qname, env);
+        attribute_qname = NULL;
+        if (NULL == default_version) 
+        {
+            return AXIS2_FAILURE;
+        }
+        AXIS2_CONF_ADD_DEFAULT_MODULE_VERSION(
+                        AXIS2_INTF_TO_IMPL(conf_builder)->conf, env, name, 
+                        default_version);
+    }
+    return AXIS2_SUCCESS;
+}
+    
 /**
  * To process AxisObservers
  * @param oservers

Modified: webservices/axis2/trunk/c/modules/core/deployment/dep_engine.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/deployment/dep_engine.c?rev=395824&r1=395823&r2=395824&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/deployment/dep_engine.c (original)
+++ webservices/axis2/trunk/c/modules/core/deployment/dep_engine.c Fri Apr 21 02:38:49 2006
@@ -807,6 +807,9 @@
         return NULL;
     }
     AXIS2_CONF_SET_REPOS(dep_engine_impl->conf, env, dep_engine_impl->axis2_repos);
+    axis2_core_utils_calculate_default_module_version(env, 
+                            AXIS2_CONF_GET_MODULES(dep_engine_impl->conf, env), 
+                            dep_engine_impl->conf);
     status = axis2_dep_engine_validate_system_predefined_phases(dep_engine, env);
     if(AXIS2_SUCCESS != status)
     {
@@ -913,6 +916,9 @@
     }
     
     AXIS2_CONF_SET_REPOS(dep_engine_impl->conf, env, dep_engine_impl->axis2_repos);
+    axis2_core_utils_calculate_default_module_version(env, 
+                            AXIS2_CONF_GET_MODULES(dep_engine_impl->conf, env), 
+                            dep_engine_impl->conf);
     AXIS2_CONF_SET_PHASESINFO(dep_engine_impl->conf, env, dep_engine_impl->phases_info);
     status = axis2_dep_engine_engage_modules(dep_engine, env);
     if(AXIS2_FAILURE == status)

Modified: webservices/axis2/trunk/c/modules/core/deployment/module_builder.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/deployment/module_builder.c?rev=395824&r1=395823&r2=395824&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/deployment/module_builder.c (original)
+++ webservices/axis2/trunk/c/modules/core/deployment/module_builder.c Fri Apr 21 02:38:49
2006
@@ -191,7 +191,7 @@
         return AXIS2_FAILURE;
     }
     /* Setting Module Name */
-    qattname = axis2_qname_create(env, AXIS2_ATTNAME, NULL, NULL);
+    /*qattname = axis2_qname_create(env, AXIS2_ATTNAME, NULL, NULL);
     module_name_att = AXIS2_OM_ELEMENT_GET_ATTRIBUTE(module_element, env, 
         qattname);
     if(qattname)
@@ -229,7 +229,7 @@
         }
     }
     else
-    {
+    {*/
         axis2_arch_file_data_t *file_data = NULL;
         axis2_char_t *module_name = NULL;
         axis2_qname_t *module_qname = NULL;
@@ -242,7 +242,7 @@
         AXIS2_MODULE_DESC_SET_NAME(builder_impl->module_desc, env, module_qname);
         if(module_qname)
             AXIS2_QNAME_FREE(module_qname, env);
-    }
+    /*}*/
 
     /* Setting Module Dll Name , if it is there */
     

Modified: webservices/axis2/trunk/c/modules/core/engine/conf.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/engine/conf.c?rev=395824&r1=395823&r2=395824&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/engine/conf.c (original)
+++ webservices/axis2/trunk/c/modules/core/engine/conf.c Fri Apr 21 02:38:49 2006
@@ -15,11 +15,11 @@
  */
 
 #include <string.h>
-
 #include <axis2_conf.h>
 #include <axis2_dir_handler.h>
 #include <axis2_dep_engine.h>
 #include <axis2_arch_reader.h>
+#include <axis2_core_utils.h>
 
 
 typedef struct axis2_conf_impl axis2_conf_impl_t;
@@ -41,7 +41,11 @@
     /**
      * Field modules
      */
-    axis2_hash_t *modules;
+    /*axis2_hash_t *modules;*/
+    /*to store all the availble modules (including version)*/
+    axis2_hash_t *all_modules;
+    /*to store mapping between default version to module name*/
+    axis2_hash_t *name_to_version_map;
     /** private ArrayList inPhases; */
     axis2_array_list_t *out_phases;
     axis2_array_list_t *in_faultphases;
@@ -160,7 +164,7 @@
 axis2_conf_get_module(axis2_conf_t *conf,
                                         axis2_env_t **env,
                                         axis2_qname_t *qname);
-
+                                        
 axis2_array_list_t * AXIS2_CALL
 axis2_conf_get_engaged_modules(axis2_conf_t *conf,
                                         axis2_env_t **env);
@@ -288,6 +292,24 @@
 axis2_conf_set_repos(axis2_conf_t *conf,
                         axis2_env_t **env,
                         axis2_char_t *repos_path);
+                        
+axis2_char_t * AXIS2_CALL
+axis2_conf_get_default_module_version(axis2_conf_t *conf, axis2_env_t **env, 
+                                    axis2_char_t* module_name);
+                                    
+axis2_module_desc_t* AXIS2_CALL
+axis2_conf_get_default_module(axis2_conf_t *conf,axis2_env_t **env, 
+                                axis2_char_t *module_name);
+                                
+axis2_status_t AXIS2_CALL
+axis2_conf_add_default_module_version(axis2_conf_t *conf, axis2_env_t **env,
+                                        axis2_char_t *module_name, 
+                                        axis2_char_t *module_version);
+                                        
+axis2_status_t AXIS2_CALL
+axis2_conf_engage_module_with_version(axis2_conf_t *conf, axis2_env_t **env,
+                                            axis2_char_t *module_name,
+                                            axis2_char_t *version_id);
 
 /************************** End of function prototypes ************************/
 
@@ -311,7 +333,7 @@
 	
     config_impl->conf.param_container = NULL;
     config_impl->svc_grps = NULL;
-    config_impl->modules = NULL;
+    /*config_impl->modules = NULL;*/
     config_impl->engaged_modules = NULL;
     config_impl->in_phases_upto_and_including_post_dispatch = NULL;
    
@@ -325,6 +347,8 @@
     config_impl->faulty_modules = NULL;
     config_impl->axis2_repos = NULL;
     config_impl->dep_engine = NULL;
+    config_impl->all_modules = NULL;
+    config_impl->name_to_version_map = NULL;
     config_impl->conf.ops = NULL;
     
     config_impl->conf.param_container = (axis2_param_container_t *) 
@@ -360,13 +384,13 @@
         return NULL;
 	}
     
-    config_impl->modules = axis2_hash_make(env);		
+    /*config_impl->modules = axis2_hash_make(env);		
 	if(NULL == config_impl->modules)
 	{
         axis2_conf_free(&(config_impl->conf), env);
 		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
-	}
+	}*/
     
     config_impl->engaged_modules = axis2_array_list_create(env, 0);		
 	if(NULL == config_impl->engaged_modules)
@@ -477,7 +501,23 @@
         axis2_conf_free(&(config_impl->conf), env);
         AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
-    } 
+    }
+
+    config_impl->all_modules = axis2_hash_make(env);
+    if(NULL == config_impl->all_modules)
+    {
+        axis2_conf_free(&(config_impl->conf), env);
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+
+    config_impl->name_to_version_map = axis2_hash_make(env);
+    if(NULL == config_impl->name_to_version_map)
+    {
+        axis2_conf_free(&(config_impl->conf), env);
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
     
     config_impl->conf.ops = AXIS2_MALLOC((*env)->allocator,
         sizeof(axis2_conf_ops_t));
@@ -567,6 +607,14 @@
     config_impl->conf.ops->engage_module = axis2_conf_engage_module;
     config_impl->conf.ops->set_dep_engine = axis2_conf_set_dep_engine;
     
+    config_impl->conf.ops->get_default_module_version = 
+                        axis2_conf_get_default_module_version;
+    config_impl->conf.ops->get_default_module = axis2_conf_get_default_module;
+    config_impl->conf.ops->add_default_module_version = 
+                        axis2_conf_add_default_module_version;
+    config_impl->conf.ops->engage_module_with_version = 
+                        axis2_conf_engage_module_with_version;
+    
 	return &(config_impl->conf);	
 }	
 
@@ -654,7 +702,7 @@
         config_impl->transports_out = NULL;
     }
     
-    if(config_impl->modules)
+    /*if(config_impl->modules)
     {
         axis2_hash_index_t *hi = NULL;
         void *val = NULL;
@@ -675,6 +723,52 @@
         }
         axis2_hash_free(config_impl->modules, env);
         config_impl->modules = NULL;
+    }*/
+    
+    if(config_impl->all_modules)
+    {
+        axis2_hash_index_t *hi = NULL;
+        void *val = NULL;
+        for (hi = axis2_hash_first (config_impl->all_modules, env); hi;
+                 hi = axis2_hash_next ( env, hi))
+        {
+            axis2_module_desc_t *module_desc = NULL;
+
+            axis2_hash_this (hi, NULL, NULL, &val);
+            module_desc = (axis2_module_desc_t *) val;
+            if (module_desc)
+            {
+                AXIS2_MODULE_DESC_FREE (module_desc, env);
+                module_desc = NULL;
+            }
+            
+            val = NULL;
+        }
+        axis2_hash_free(config_impl->all_modules, env);
+        config_impl->all_modules = NULL;
+    }
+    
+    if(config_impl->name_to_version_map)
+    {
+        axis2_hash_index_t *hi = NULL;
+        void *val = NULL;
+        for (hi = axis2_hash_first (config_impl->name_to_version_map, env); hi;
+                 hi = axis2_hash_next ( env, hi))
+        {
+            axis2_char_t *module_ver = NULL;
+
+            axis2_hash_this (hi, NULL, NULL, &val);
+            module_ver = (axis2_char_t *) val;
+            if (module_ver)
+            {
+                AXIS2_FREE((*env)->allocator, module_ver);
+                module_ver = NULL;
+            }
+            
+            val = NULL;
+        }
+        axis2_hash_free(config_impl->name_to_version_map, env);
+        config_impl->name_to_version_map = NULL;
     }
     
     if(config_impl->engaged_modules)
@@ -1159,10 +1253,8 @@
 }
 
 /**
- * Method addTransport
- *
+ * Function add_transport_in
  * @param transport
- * @throws AxisFault
  */
 axis2_status_t AXIS2_CALL
 axis2_conf_add_transport_in(axis2_conf_t *conf,
@@ -1211,10 +1303,8 @@
 }
 
 /**
- * Method addTransport
- *
+ * Function add_transport_out
  * @param transport
- * @throws AxisFault
  */
 axis2_status_t AXIS2_CALL
 axis2_conf_add_transport_out(axis2_conf_t *conf,
@@ -1255,10 +1345,9 @@
 }
 
 /**
- * Method getModule
- *
+ * Function get_module
  * @param name
- * @return ModuleDescription
+ * @return axis2_module_desc_t*
  */
 axis2_module_desc_t *AXIS2_CALL
 axis2_conf_get_module(axis2_conf_t *conf,
@@ -1267,20 +1356,45 @@
 {
     axis2_conf_impl_t *conf_impl = NULL;
     axis2_char_t *name = NULL;
+    axis2_module_desc_t *ret = NULL;
+    axis2_char_t *module_name = NULL;
+    axis2_qname_t *mod_qname = NULL;
+    axis2_char_t *def_mod_ver = NULL;
     
     AXIS2_ENV_CHECK(env, NULL);
     AXIS2_PARAM_CHECK((*env)->error, qname, NULL);
     conf_impl = AXIS2_INTF_TO_IMPL(conf);
 
     name = AXIS2_QNAME_TO_STRING(qname, env);
-    return (axis2_module_desc_t *) axis2_hash_get(conf_impl->modules, 
+    ret =  (axis2_module_desc_t *) axis2_hash_get(conf_impl->all_modules, 
         name, AXIS2_HASH_KEY_STRING);
+    if(NULL != ret)
+    {
+        return ret;
+    }
+    module_name = AXIS2_QNAME_GET_LOCALPART(qname, env);
+    if(NULL == module_name)
+    {
+        return NULL;
+    }
+    def_mod_ver = AXIS2_CONF_GET_DEFAULT_MODULE_VERSION(conf, env, module_name);
+    mod_qname = axis2_core_utils_get_module_qname(env, name, def_mod_ver);
+    if(NULL == mod_qname)
+    {
+        return NULL;
+    }
+    name = AXIS2_QNAME_TO_STRING(mod_qname, env);
+    ret =  (axis2_module_desc_t *) axis2_hash_get(conf_impl->all_modules, 
+        name, AXIS2_HASH_KEY_STRING);
+    AXIS2_QNAME_FREE(mod_qname, env);
+    mod_qname = NULL;
+    return ret;
 }
 
+
 /**
- * Method getEngadgedModules
- *
- * @return  Collection
+ * Function get_engadged_modules
+ * @return  axis2_array_list_t*
  */
 axis2_array_list_t * AXIS2_CALL
 axis2_conf_get_engaged_modules(axis2_conf_t *conf,
@@ -1310,7 +1424,8 @@
 
 
 /**
- * @return ArrayList
+ * Function get_in_fault_flow
+ * @return axis2_array_list_t*
  */
 axis2_array_list_t * AXIS2_CALL
 axis2_conf_get_in_faultflow(axis2_conf_t *conf,
@@ -1431,21 +1546,32 @@
                                 axis2_qname_t *module_name) 
 {
     axis2_conf_impl_t *config_impl = NULL;
+    axis2_qname_t *def_mod_qname = NULL;
+    axis2_module_desc_t *def_mod = NULL;
     int i = 0;
     int size = 0;
     AXIS2_ENV_CHECK(env, AXIS2_FALSE);
     AXIS2_PARAM_CHECK((*env)->error, module_name, AXIS2_FALSE);
     config_impl = AXIS2_INTF_TO_IMPL(conf);
    
-   
+    def_mod = AXIS2_CONF_GET_DEFAULT_MODULE(conf, env, 
+                        AXIS2_QNAME_GET_LOCALPART(module_name, env));
+    if(NULL != def_mod)
+    {
+        def_mod_qname = AXIS2_MODULE_DESC_GET_NAME(def_mod, env);
+    }
     size = AXIS2_ARRAY_LIST_SIZE(config_impl->engaged_modules, env);
     for(i = 0; i < size; i++)
     {
         axis2_qname_t *qname = NULL;
         
+        
         qname = (axis2_qname_t *) AXIS2_ARRAY_LIST_GET(config_impl->
             engaged_modules, env, i);
-        if(AXIS2_TRUE == AXIS2_QNAME_EQUALS(module_name, env, qname))
+        
+        if(AXIS2_TRUE == AXIS2_QNAME_EQUALS(module_name, env, qname) ||
+            (NULL != def_mod_qname && AXIS2_TRUE == AXIS2_QNAME_EQUALS(
+            def_mod_qname, env, qname)))
         {
             return AXIS2_TRUE;
         }
@@ -1546,7 +1672,7 @@
     return AXIS2_INTF_TO_IMPL(conf)->out_phases;
 }
     
-    /**
+/**
  * @param list
  */
 axis2_status_t AXIS2_CALL
@@ -1593,7 +1719,7 @@
 }
     
 /**
- * @return HashMap
+ * @return axis2_hash_t*
  */
 axis2_hash_t *AXIS2_CALL
 axis2_conf_get_modules(axis2_conf_t *conf,
@@ -1601,12 +1727,11 @@
 {
     AXIS2_ENV_CHECK(env, NULL);
     
-    return AXIS2_INTF_TO_IMPL(conf)->modules;
+    return AXIS2_INTF_TO_IMPL(conf)->all_modules;
 }  
 
 /**
- * Method addMdoule
- *
+ * Method add_module
  * @param module
  */
 axis2_status_t AXIS2_CALL
@@ -1628,25 +1753,29 @@
     {
         return status;
     }
-    if(!config_impl->modules)
+    /* Do we need to do this ? */
+    /*if(!config_impl->modules)
     {
         config_impl->modules = axis2_hash_make(env);
         if(!config_impl->modules)
         {
             return AXIS2_FAILURE;
         }
+    }*/
+    if(!config_impl->all_modules)
+    {
+        return AXIS2_FAILURE;
     }
-
     module_qname = AXIS2_MODULE_DESC_GET_NAME(module, env);
     if (module_qname)
     {
         axis2_char_t *module_name = NULL;
 
         module_name = AXIS2_QNAME_TO_STRING(module_qname, env);
-        axis2_hash_set(config_impl->modules, module_name, 
+        axis2_hash_set(config_impl->all_modules, module_name, 
             AXIS2_HASH_KEY_STRING, module);
     }
-    
+    /* TODO we do not support module_name-SNAPSHOT.so case */
     return AXIS2_SUCCESS;
 }
 
@@ -1961,4 +2090,131 @@
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_INTF_TO_IMPL(conf)->dep_engine = dep_engine;
     return AXIS2_SUCCESS;
+}
+
+axis2_char_t * AXIS2_CALL
+axis2_conf_get_default_module_version(axis2_conf_t *conf, axis2_env_t **env, 
+                                    axis2_char_t* module_name)
+{
+    axis2_hash_t *def_ver_map = NULL;
+    AXIS2_ENV_CHECK(env, NULL);
+    AXIS2_PARAM_CHECK((*env)->error, module_name, NULL);
+    
+    def_ver_map = AXIS2_INTF_TO_IMPL(conf)->name_to_version_map;
+    if(NULL == def_ver_map)
+    {
+        return NULL;
+    }
+    return axis2_hash_get(def_ver_map, module_name, AXIS2_HASH_KEY_STRING);
+}
+
+axis2_module_desc_t* AXIS2_CALL
+axis2_conf_get_default_module(axis2_conf_t *conf,axis2_env_t **env, 
+                                axis2_char_t *module_name)
+{
+    axis2_module_desc_t *ret_mod = NULL;
+    axis2_char_t *mod_name = NULL;
+    axis2_char_t *mod_ver = NULL;
+    axis2_hash_t *all_modules = NULL;
+    axis2_qname_t *mod_qname = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    AXIS2_PARAM_CHECK((*env)->error, module_name, NULL);
+    
+    all_modules = AXIS2_INTF_TO_IMPL(conf)->all_modules;
+    mod_ver = AXIS2_CONF_GET_DEFAULT_MODULE_VERSION(conf, env, module_name);
+    
+    if(NULL == mod_ver)
+    {
+        mod_name = AXIS2_STRDUP(module_name, env);
+    }
+    else
+    {
+        axis2_char_t *tmp_name = NULL;
+        tmp_name = AXIS2_STRACAT(module_name, "-", env);
+        mod_name = AXIS2_STRACAT(tmp_name, mod_ver, env);
+        AXIS2_FREE((*env)->allocator, tmp_name);
+    }
+    mod_qname = axis2_qname_create(env, mod_name, NULL, NULL);
+    AXIS2_FREE((*env)->allocator, mod_name);
+    mod_name = NULL;
+    
+    if(NULL == mod_qname)
+    {
+        return NULL;
+    }
+    ret_mod = (axis2_module_desc_t *)axis2_hash_get(all_modules, 
+                    AXIS2_QNAME_TO_STRING(mod_qname, env), 
+                    AXIS2_HASH_KEY_STRING);
+                    
+    return ret_mod;                    
+}
+
+
+/**
+ * Adds a dafault module version , which can be done either programatically 
+ * or by using axis2.xml . The default module version is important if user asks
+ * to engage a module without given version ID, in which case, we will engage 
+ * the default version.
+ *
+ * @param module_name
+ * @param module_version
+ */
+axis2_status_t AXIS2_CALL
+axis2_conf_add_default_module_version(axis2_conf_t *conf, axis2_env_t **env,
+                                        axis2_char_t *module_name, 
+                                        axis2_char_t *module_version)
+{
+    axis2_hash_t *name_to_ver_map = NULL;
+    
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK((*env)->error, module_name, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK((*env)->error, module_version, AXIS2_FAILURE);
+    /*
+     * If we already have a default module version we don't put
+     * it again
+     */
+    name_to_ver_map = AXIS2_INTF_TO_IMPL(conf)->name_to_version_map;
+    
+    if (NULL == axis2_hash_get(name_to_ver_map, module_name, 
+                        AXIS2_HASH_KEY_STRING))
+    {
+        axis2_char_t *new_entry = AXIS2_STRDUP(module_version, env);
+        if(NULL == new_entry)
+        {
+            return AXIS2_FAILURE;
+        }
+        axis2_hash_set(name_to_ver_map,module_name, AXIS2_HASH_KEY_STRING, 
+            new_entry);
+        return AXIS2_SUCCESS;
+    }
+    return AXIS2_FAILURE;
+}
+
+/**
+ * Engages a module using given name and its version ID.
+ *
+ * @param module_name
+ * @param version_id
+ */
+axis2_status_t AXIS2_CALL
+axis2_conf_engage_module_with_version(axis2_conf_t *conf, axis2_env_t **env,
+                                            axis2_char_t *module_name,
+                                            axis2_char_t *version_id)
+{
+    axis2_qname_t *module_qname = NULL;
+    axis2_status_t status = AXIS2_FAILURE;
+    
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK((*env)->error, module_name, AXIS2_FAILURE);
+    
+    module_qname = axis2_core_utils_get_module_qname(env, module_name, 
+                                                            version_id);
+    if(NULL == module_qname)
+    {
+        return AXIS2_FAILURE;
+    }
+    status = AXIS2_CONF_ENGAGE_MODULE(conf, env, module_qname);
+    AXIS2_QNAME_FREE(module_qname, env);
+    return status;
 }

Modified: webservices/axis2/trunk/c/modules/core/util/axis2_core_utils.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/util/axis2_core_utils.h?rev=395824&r1=395823&r2=395824&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/util/axis2_core_utils.h (original)
+++ webservices/axis2/trunk/c/modules/core/util/axis2_core_utils.h Fri Apr 21 02:38:49 2006
@@ -22,12 +22,14 @@
 #include <axis2_error.h>
 #include <axis2_env.h>
 #include <axis2_msg_ctx.h>
+#include <axis2_qname.h>
 
 #ifdef __cplusplus
 extern "C"
 {
 #endif
 
+struct axis2_conf;
 /**
  * @defgroup axis2_core_utils Core Utils
  * @ingroup axis2_core_utils
@@ -40,6 +42,29 @@
     AXIS2_DECLARE(void)
     axis2_core_utils_reset_out_msg_ctx(axis2_env_t **env,
                                     axis2_msg_ctx_t *out_msg_ctx);
+                                    
+    AXIS2_DECLARE(axis2_qname_t*)
+    axis2_core_utils_get_module_qname(axis2_env_t **env, axis2_char_t *name, 
+                                    axis2_char_t *version);
+                                    
+    AXIS2_DECLARE(axis2_status_t)
+    axis2_core_utils_calculate_default_module_version(axis2_env_t **env, 
+                        axis2_hash_t *modules_map, struct axis2_conf *axis_conf);
+    
+    AXIS2_DECLARE(axis2_char_t *)
+    axis2_core_utils_get_module_name(axis2_env_t **env, 
+                                    axis2_char_t *module_name);
+                                    
+    AXIS2_DECLARE(axis2_char_t *)
+    axis2_core_utils_get_module_version(axis2_env_t **env, 
+                                        axis2_char_t *module_name);
+                                        
+    AXIS2_DECLARE(axis2_bool_t)
+    axis2_core_utils_is_latest_mod_ver(axis2_env_t **env, 
+                                        axis2_char_t *module_ver, 
+                                        axis2_char_t *current_def_ver);
+                                                                                
+                                    
 /** @} */
     
 #ifdef __cplusplus

Modified: webservices/axis2/trunk/c/modules/core/util/core_utils.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/util/core_utils.c?rev=395824&r1=395823&r2=395824&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/util/core_utils.c (original)
+++ webservices/axis2/trunk/c/modules/core/util/core_utils.c Fri Apr 21 02:38:49 2006
@@ -193,3 +193,196 @@
     return;
 }
 
+AXIS2_DECLARE(axis2_qname_t*)
+axis2_core_utils_get_module_qname(axis2_env_t **env, axis2_char_t *name, 
+                                axis2_char_t *version)
+{
+    axis2_qname_t *ret_qname = NULL;
+    AXIS2_ENV_CHECK(env, NULL);
+    AXIS2_PARAM_CHECK((*env)->error, name, NULL);
+    
+    if(version != NULL && 0 != AXIS2_STRLEN(version))
+    {
+        axis2_char_t * mod_name1 = NULL;
+        axis2_char_t * mod_name = NULL;
+        mod_name1 = AXIS2_STRACAT(name, "-", env);
+        if(NULL == mod_name1)
+        {
+            return NULL;
+        }
+        mod_name = AXIS2_STRACAT(mod_name1, version, env);
+        if(NULL == mod_name)
+        {
+            AXIS2_FREE((*env)->allocator, mod_name1);
+            mod_name1 = NULL;
+            return NULL;
+        }
+        ret_qname = axis2_qname_create(env, mod_name, NULL, NULL);
+        AXIS2_FREE((*env)->allocator, mod_name);
+        AXIS2_FREE((*env)->allocator, mod_name1);
+        return ret_qname;
+    }
+    ret_qname = axis2_qname_create(env, name, NULL, NULL);
+    return ret_qname;    
+}
+
+AXIS2_DECLARE(axis2_status_t)
+axis2_core_utils_calculate_default_module_version(axis2_env_t **env, 
+                        axis2_hash_t *modules_map, axis2_conf_t *axis_conf) 
+{
+    axis2_hash_t *default_modules = NULL;
+    axis2_hash_index_t *hi = NULL;
+    void *val = NULL;
+    
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK((*env)->error, modules_map, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK((*env)->error, axis_conf, AXIS2_FAILURE);
+    
+    default_modules = axis2_hash_make(env);
+    if(NULL == default_modules)
+    {
+        return AXIS2_FAILURE;
+    }
+    for (hi = axis2_hash_first (modules_map, env); NULL != hi;
+                        hi = axis2_hash_next (env, hi))
+    {
+        axis2_module_desc_t *mod_desc = NULL;
+        
+        axis2_hash_this (hi, NULL, NULL, &val);
+        mod_desc = (axis2_module_desc_t *) val;
+        if (NULL != mod_desc)
+        {
+            axis2_qname_t *module_qname = NULL;
+            module_qname = AXIS2_MODULE_DESC_GET_NAME(mod_desc, env);
+            if(NULL != module_qname)
+            {
+                axis2_char_t *mod_name_with_ver = NULL;
+                mod_name_with_ver = AXIS2_QNAME_GET_LOCALPART(module_qname, env);
+                if(NULL != mod_name_with_ver)
+                {
+                    axis2_char_t *module_name_str = NULL;
+                    axis2_char_t *module_ver_str = NULL;
+                    axis2_char_t *current_def_ver = NULL;
+                    
+                    module_name_str = axis2_core_utils_get_module_name(env,
+                        mod_name_with_ver);
+                    if(NULL == module_name_str)
+                    {
+                        return AXIS2_FAILURE;
+                    }
+                    module_ver_str = axis2_core_utils_get_module_version(env,
+                        mod_name_with_ver);  
+                    current_def_ver = axis2_hash_get(default_modules, 
+                        module_name_str, AXIS2_HASH_KEY_STRING);  
+                    if(NULL != current_def_ver)
+                    {
+                        if(NULL != module_ver_str && AXIS2_TRUE == 
+                            axis2_core_utils_is_latest_mod_ver(env, 
+                            module_ver_str, current_def_ver))
+                        {
+                            axis2_hash_set(default_modules, module_name_str, 
+                            AXIS2_HASH_KEY_STRING, module_ver_str);
+                        }
+                        else
+                        {
+                            if(NULL != module_name_str)
+                            {
+                                AXIS2_FREE((*env)->allocator, module_name_str);
+                                module_name_str = NULL;
+                            }
+                            if(NULL != module_ver_str)
+                            {
+                                AXIS2_FREE((*env)->allocator, module_ver_str);
+                                module_ver_str = NULL;                        
+                            }
+                        }
+                    }
+                    else
+                    {
+                        axis2_hash_set(default_modules, module_name_str, 
+                            AXIS2_HASH_KEY_STRING, module_ver_str);
+                    }
+                }                    
+            }            
+        }
+        val = NULL;
+    }
+    
+    hi = NULL;
+    val = NULL;
+    for (hi = axis2_hash_first (default_modules, env); NULL != hi;
+                        hi = axis2_hash_next (env, hi))
+    {
+        void *key_string = NULL;
+        axis2_hash_this(hi, (const void **)&key_string, NULL, &val);
+        if(NULL != key_string && NULL != val)
+        {
+            AXIS2_CONF_ADD_DEFAULT_MODULE_VERSION(axis_conf, env, 
+                        (axis2_char_t *)key_string, (axis2_char_t *)val);
+            AXIS2_LOG_DEBUG((*env)->log, AXIS2_LOG_SI, "Added default module"
+                        " version : %s for module : %s", 
+                        (axis2_char_t *)val, (axis2_char_t *)key_string);
+        }
+    }
+    return AXIS2_SUCCESS;
+}
+    
+AXIS2_DECLARE(axis2_char_t *)
+axis2_core_utils_get_module_name(axis2_env_t **env, axis2_char_t *module_name)
+{
+    axis2_char_t version_seperator = '-';
+    axis2_char_t *name = NULL;
+    axis2_char_t *version_sep_loc = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    AXIS2_PARAM_CHECK((*env)->error, module_name, NULL);
+    
+    name = AXIS2_STRDUP(module_name, env);
+    if(NULL == name)
+    {
+        return NULL;
+    }
+    version_sep_loc = AXIS2_RINDEX(name, version_seperator);
+    if(NULL != version_sep_loc)
+    {
+        *version_sep_loc = '\0';
+    }
+    return name;
+}
+
+AXIS2_DECLARE(axis2_char_t *)
+axis2_core_utils_get_module_version(axis2_env_t **env, axis2_char_t *module_name)
+{
+    axis2_char_t version_seperator = '-';
+    axis2_char_t *version_sep_loc = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    AXIS2_PARAM_CHECK((*env)->error, module_name, NULL);
+    
+    version_sep_loc = AXIS2_RINDEX(module_name, version_seperator);
+    if(NULL != version_sep_loc)
+    {
+        return AXIS2_STRDUP(version_sep_loc + sizeof(axis2_char_t), env);        
+    }
+    return NULL;
+}
+
+AXIS2_DECLARE(axis2_bool_t)
+axis2_core_utils_is_latest_mod_ver(axis2_env_t **env, 
+                        axis2_char_t *module_ver, axis2_char_t *current_def_ver)
+{
+    double cur_ver = 0.0;
+    double mod_ver = 0.0;
+    AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+    AXIS2_PARAM_CHECK((*env)->error, module_ver, AXIS2_FALSE);
+    AXIS2_PARAM_CHECK((*env)->error, current_def_ver, AXIS2_FALSE);
+    
+    cur_ver = atof(current_def_ver);
+    mod_ver = atof(module_ver);
+    
+    if(mod_ver > cur_ver)
+    {
+        return AXIS2_TRUE;
+    }
+    return AXIS2_FAILURE;    
+}

Modified: webservices/axis2/trunk/c/modules/util/dir_handler.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/dir_handler.c?rev=395824&r1=395823&r2=395824&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/dir_handler.c (original)
+++ webservices/axis2/trunk/c/modules/util/dir_handler.c Fri Apr 21 02:38:49 2006
@@ -370,10 +370,10 @@
     }
  
 	/* Check for filename extensions */
-	ptr = AXIS2_RINDEX(entry->d_name, '.');
+	/*ptr = AXIS2_RINDEX(entry->d_name, '.');
 	if (ptr != NULL)
     {
 		return (AXIS2_FALSE);
-    }
+    }*/
 	return AXIS2_TRUE;
 }

Modified: webservices/axis2/trunk/c/test/core/deployment/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/test/core/deployment/Makefile.am?rev=395824&r1=395823&r2=395824&view=diff
==============================================================================
--- webservices/axis2/trunk/c/test/core/deployment/Makefile.am (original)
+++ webservices/axis2/trunk/c/test/core/deployment/Makefile.am Fri Apr 21 02:38:49 2006
@@ -26,6 +26,7 @@
             -I$(top_builddir)/modules/core/transport \
             -I$(top_builddir)/modules/core/engine \
             -I$(top_builddir)/modules/core/clientapi \
+            -I$(top_builddir)/modules/core/util \
             -I$(top_builddir)/modules/platforms \
             -I$(top_builddir)/modules/xml/parser \
             -I$(top_builddir)/include

Modified: webservices/axis2/trunk/c/test/core/deployment/test_deployment.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/test/core/deployment/test_deployment.c?rev=395824&r1=395823&r2=395824&view=diff
==============================================================================
--- webservices/axis2/trunk/c/test/core/deployment/test_deployment.c (original)
+++ webservices/axis2/trunk/c/test/core/deployment/test_deployment.c Fri Apr 21 02:38:49 2006
@@ -12,6 +12,9 @@
 #include <axis2_log_default.h>
 #include <axis2_transport_sender.h>
 #include <axis2_transport_receiver.h>
+#include <axis2_core_utils.h>
+
+axis2_env_t *env = NULL;
 
 int axis2_test_dep_engine_load()
 {
@@ -20,17 +23,11 @@
     axis2_hash_t *svc_map = NULL;
     axis2_array_list_t *in_phases = NULL;
     axis2_char_t *axis2c_home = NULL;
-    axis2_env_t *env = NULL;
 
     printf("******************************************\n");
     printf("testing dep_engine_load method \n");
     printf("******************************************\n");
    
-	axis2_allocator_t *allocator = axis2_allocator_init (NULL);
-    axis2_error_t *error = axis2_error_create(allocator);
-    axis2_log_t *log = axis2_log_create(allocator, NULL, "test_deployment.log");
-    env = axis2_env_create_with_error_log(allocator, error, log);
-    env->log->level = AXIS2_LOG_LEVEL_INFO;
     
     axis2c_home = AXIS2_GETENV("AXIS2C_HOME");
     dep_engine = axis2_dep_engine_create_with_repos_name(&env, 
@@ -129,9 +126,6 @@
     printf("testing axis2_transport_recv load\n"); 
     printf("******************************************\n");
 
-    axis2_allocator_t *allocator = axis2_allocator_init (NULL);
-    axis2_env_t *env = axis2_env_create (allocator);
-    
     dll_desc = axis2_dll_desc_create(&env);
     
     axis2c_home = AXIS2_GETENV("AXIS2C_HOME");
@@ -165,8 +159,6 @@
     printf("testing axis2_transport_sender load\n"); 
     printf("******************************************\n");
 
-    axis2_allocator_t *allocator = axis2_allocator_init (NULL);
-    axis2_env_t *env = axis2_env_create (allocator);
     msg_ctx = (axis2_msg_ctx_t *) AXIS2_MALLOC(env->allocator, 5);
     dll_desc = axis2_dll_desc_create(&env);
     
@@ -188,10 +180,86 @@
     return 0;
 }
 
+int axis2_test_default_module_version()
+{
+    
+    axis2_conf_t *axis_conf = NULL;
+    axis2_qname_t *mod_qname1 = NULL;
+    axis2_qname_t *mod_qname2 = NULL;
+    axis2_qname_t *mod_qname3 = NULL;
+    axis2_qname_t *mod_qname4 = NULL;
+    axis2_qname_t *mod_qname5 = NULL;
+    axis2_module_desc_t *module1 = NULL;
+    axis2_module_desc_t *module2 = NULL;
+    axis2_module_desc_t *module3 = NULL;
+    axis2_module_desc_t *module4 = NULL;
+    axis2_module_desc_t *module5 = NULL;
+    axis2_module_desc_t *def_mod = NULL;
+
+    printf("******************************************\n");
+    printf("testing axis2_default_module_version\n");
+    printf("******************************************\n");
+    
+
+    axis_conf = axis2_conf_create(&env);
+    mod_qname1 = axis2_qname_create(&env, "module1", NULL, NULL);
+    module1 = axis2_module_desc_create_with_qname(&env, mod_qname1);
+    AXIS2_CONF_ADD_MODULE(axis_conf, &env, module1);
+    
+    mod_qname2 = axis2_qname_create(&env, "module2-0.90", NULL, NULL); 
+    module2 = axis2_module_desc_create_with_qname(&env, mod_qname2);
+    AXIS2_CONF_ADD_MODULE(axis_conf, &env, module2);
+
+    mod_qname3 = axis2_qname_create(&env, "module2-0.92", NULL, NULL);
+    module3 = axis2_module_desc_create_with_qname(&env, mod_qname3);
+    AXIS2_CONF_ADD_MODULE(axis_conf, &env, module3);
+    
+    mod_qname4 = axis2_qname_create(&env, "module2-0.91", NULL, NULL);
+    module4 = axis2_module_desc_create_with_qname(&env, mod_qname4);
+    AXIS2_CONF_ADD_MODULE(axis_conf, &env, module4);
+
+    mod_qname5 = axis2_qname_create(&env, "test_module-1.92", NULL, NULL);
+    module5 = axis2_module_desc_create_with_qname(&env, mod_qname5);
+    AXIS2_CONF_ADD_MODULE(axis_conf, &env, module5);
+
+    axis2_core_utils_calculate_default_module_version(&env, AXIS2_CONF_GET_MODULES(
+                        axis_conf, &env), axis_conf);
+    def_mod = AXIS2_CONF_GET_DEFAULT_MODULE(axis_conf, &env, "module1");
+    if(def_mod != module1)
+    {
+        printf("axis2_default_module_version (module1) .. FAILED\n");
+        return AXIS2_FAILURE;
+    }
+    def_mod = AXIS2_CONF_GET_DEFAULT_MODULE(axis_conf, &env, "module2");
+    if(def_mod != module3)
+    {
+        printf("axis2_default_module_version (module2) .. FAILED\n");
+        return AXIS2_FAILURE;
+    } 
+    def_mod = AXIS2_CONF_GET_DEFAULT_MODULE(axis_conf, &env, "test_module");
+    if(def_mod != module5)
+    {
+        printf("axis2_default_module_version (test_module) .. FAILED\n");
+        return AXIS2_FAILURE;
+    } 
+    printf("axis2_default_module_version  .. SUCCESS\n");
+    return AXIS2_SUCCESS; 
+}
+
 int main()
 {
+	axis2_allocator_t *allocator = NULL;
+    axis2_error_t *error = NULL;
+    axis2_log_t *log = NULL;
+
+    allocator = axis2_allocator_init (NULL);
+    error = axis2_error_create(allocator);
+    log = axis2_log_create(allocator, NULL, "test_deployment.log");
+    env = axis2_env_create_with_error_log(allocator, error, log);
+    env->log->level = AXIS2_LOG_LEVEL_INFO;
     /*axis2_test_transport_receiver_load();
     axis2_test_transport_sender_load();*/
     axis2_test_dep_engine_load();
+    axis2_test_default_module_version();
 	return 0;
 }



Mime
View raw message