/* {{{ axis2_environment create function */ axutil_env_t * wsf_env_create_svr ( axis2_char_t * path_tolog, int loglevel) { axutil_allocator_t *allocator = NULL; axutil_error_t *error = NULL; axutil_log_t *log = NULL; axis2_char_t log_path[1024]; axutil_env_t *env = NULL; axutil_thread_pool_t *thread_pool = NULL; const axis2_char_t *LOG_NAME = "wsf_ruby_server.log"; allocator = malloc (sizeof (axutil_allocator_t)); allocator->free_fn = wsf_free_wrapper; allocator->malloc_fn = wsf_malloc_wrapper; allocator->realloc = wsf_realloc_warpper; error = axutil_error_create (allocator); if (path_tolog && ( (0 == strcmp (path_tolog, "")) || (0 == strcmp (path_tolog, ".")) || (0 == strcmp (path_tolog, "./")))) { snprintf (log_path, sizeof(log_path), "%s", LOG_NAME); } else { snprintf (log_path, sizeof(log_path), "%s/%s", path_tolog, LOG_NAME); } thread_pool = axutil_thread_pool_init (allocator); log = axutil_log_create (allocator, NULL, log_path); env = axutil_env_create_with_error_log_thread_pool (allocator, error, log, thread_pool); env->log->level = loglevel; return env; }
AXIS2_EXTERN axutil_env_t *AXIS2_CALL axutil_init_thread_env( const axutil_env_t *system_env) { axutil_allocator_t * allocator = NULL; axutil_error_t *error = NULL; allocator = axutil_allocator_clone(system_env->allocator); error = axutil_error_create(allocator); return axutil_env_create_with_error_log_thread_pool(allocator, error, system_env->log, system_env-> thread_pool); }
/***************************** End of function headers ************************/ axutil_env_t * init_syetem_env( axutil_allocator_t * allocator, const axis2_char_t * log_file) { axutil_error_t *error = axutil_error_create(allocator); axutil_log_t *log = axutil_log_create(allocator, NULL, log_file); axutil_thread_pool_t *thread_pool = axutil_thread_pool_init(allocator); /* We need to init the parser in main thread before spawning child * threads */ axiom_xml_reader_init(); return axutil_env_create_with_error_log_thread_pool(allocator, error, log, thread_pool); }
AXIS2_EXTERN axutil_env_t *AXIS2_CALL axutil_env_create_all( const axis2_char_t *log_file, const axutil_log_levels_t log_level) { axutil_env_t *env = NULL; axutil_error_t *error = NULL; axutil_log_t *log = NULL; axutil_allocator_t *allocator = NULL; axutil_thread_pool_t *thread_pool = NULL; allocator = axutil_allocator_init(NULL); error = axutil_error_create(allocator); if(log_file) { log = axutil_log_create(allocator, NULL, log_file); } /* if log file name was not given or the log could not be create with given name, create default log */ if(!log) { log = axutil_log_create_default(allocator); } thread_pool = axutil_thread_pool_init(allocator); env = axutil_env_create_with_error_log_thread_pool(allocator, error, log, thread_pool); if(env->log) { /*if(AXIS2_LOG_LEVEL_CRITICAL <= log_level && log_level <= AXIS2_LOG_LEVEL_TRACE)*/ if (log_level <= AXIS2_LOG_LEVEL_TRACE) { env->log->level = log_level; } else { env->log->level = AXIS2_LOG_LEVEL_DEBUG; /* default log level is debug */ } } env->ref = 1; env->get_session_fn = NULL; env->set_session_fn = NULL; return env; }