You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2007/11/18 18:46:07 UTC
svn commit: r596104 [2/2] - in /webservices/axis2/trunk/c: ./ axiom/src/om/
include/ samples/server/echo/ src/core/clientapi/ src/core/deployment/
src/core/engine/ src/core/receivers/ src/core/transport/http/receiver/
src/core/transport/http/sender/ sr...
Modified: webservices/axis2/trunk/c/src/core/engine/conf.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/engine/conf.c?rev=596104&r1=596103&r2=596104&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/engine/conf.c (original)
+++ webservices/axis2/trunk/c/src/core/engine/conf.c Sun Nov 18 09:45:50 2007
@@ -51,6 +51,7 @@
axutil_hash_t *faulty_svcs;
axutil_hash_t *faulty_modules;
axis2_char_t *axis2_repo;
+ axis2_char_t *axis2_xml;
axis2_dep_engine_t *dep_engine;
axutil_array_list_t *handlers;
axis2_bool_t enable_mtom;
@@ -62,6 +63,9 @@
/** base description struct */
axis2_desc_t *base;
+
+ /** mark whether conf is build using axis2 xml*/
+ axis2_bool_t axis2_flag;
/* this is a hack to keep rampart_context at client side */
void *security_context;
@@ -85,29 +89,11 @@
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
}
+ memset ((void *)conf, 0, sizeof (axis2_conf_t));
- conf->param_container = NULL;
- conf->svc_grps = NULL;
- conf->engaged_modules = NULL;
- conf->in_phases_upto_and_including_post_dispatch = NULL;
- conf->out_phases = NULL;
- conf->in_fault_phases = NULL;
- conf->out_fault_phases = NULL;
- conf->phases_info = NULL;
- conf->all_svcs = NULL;
- conf->all_init_svcs = NULL;
- conf->msg_recvs = NULL;
- conf->faulty_svcs = NULL;
- conf->faulty_modules = NULL;
- conf->axis2_repo = NULL;
- conf->dep_engine = NULL;
- conf->all_modules = NULL;
- conf->name_to_version_map = NULL;
- conf->handlers = NULL;
conf->enable_mtom = AXIS2_FALSE;
conf->enable_security = AXIS2_FALSE;
- conf->base = NULL;
- conf->security_context = NULL;
+ conf->axis2_flag = AXIS2_FALSE;
conf->param_container = (axutil_param_container_t *)
axutil_param_container_create(env);
@@ -1398,6 +1384,7 @@
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
AXIS2_PARAM_CHECK(env->error, module_ref, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK (env->error, conf, AXIS2_FAILURE);
module_desc = axis2_conf_get_module(conf, env, module_ref);
if (!module_desc)
@@ -1411,6 +1398,10 @@
axis2_char_t *temp_path2 = NULL;
axis2_char_t *temp_path3 = NULL;
axis2_char_t *path = NULL;
+ axutil_param_t *module_dir_param;
+ axis2_char_t *module_dir;
+ axis2_bool_t flag;
+ axis2_char_t *axis2_xml;
arch_reader = axis2_arch_reader_create(env);
if (!arch_reader)
@@ -1421,25 +1412,65 @@
file =
(axutil_file_t *) axis2_arch_reader_create_module_arch(env,
file_name);
- repos_path = axis2_conf_get_repo(conf, env);
- temp_path1 = axutil_stracat(env, repos_path, AXIS2_PATH_SEP_STR);
- temp_path2 = axutil_stracat(env, temp_path1, AXIS2_MODULE_FOLDER);
- temp_path3 = axutil_stracat(env, temp_path2, AXIS2_PATH_SEP_STR);
- path = axutil_stracat(env, temp_path3, file_name);
- AXIS2_FREE(env->allocator, temp_path1);
- AXIS2_FREE(env->allocator, temp_path2);
- AXIS2_FREE(env->allocator, temp_path3);
+ /* this flag is to check whether conf is build using axis2
+ * xml instead of a repo. */
+ flag = axis2_conf_get_axis2_flag (conf, env);
+
+ if (flag == AXIS2_FALSE)
+ {
+ repos_path = axis2_conf_get_repo(conf, env);
+ temp_path1 = axutil_stracat(env, repos_path, AXIS2_PATH_SEP_STR);
+ temp_path2 = axutil_stracat(env, temp_path1, AXIS2_MODULE_FOLDER);
+ temp_path3 = axutil_stracat(env, temp_path2, AXIS2_PATH_SEP_STR);
+ path = axutil_stracat(env, temp_path3, file_name);
+ AXIS2_FREE(env->allocator, temp_path1);
+ AXIS2_FREE(env->allocator, temp_path2);
+ AXIS2_FREE(env->allocator, temp_path3);
+ }
+ else
+ {
+ /**
+ * this case is to obtain module path from the axis2.xml
+ */
+ axis2_xml = (axis2_char_t *)axis2_conf_get_axis2_xml (conf, env);
+ module_dir_param = axis2_conf_get_param (conf, env, "moduleDir");
+ module_dir = (axis2_char_t *)
+ axutil_param_get_value (module_dir_param, env);
+ temp_path1 = axutil_strcat (env,
+ module_dir,
+ AXIS2_PATH_SEP_STR, NULL);
+ path = axutil_strcat (env, temp_path1, file_name, NULL);
+ }
+
axutil_file_set_path(file, env, path);
file_data = axis2_arch_file_data_create_with_type_and_file(env,
AXIS2_MODULE,
file);
- dep_engine = axis2_dep_engine_create_with_repos_name(env, repos_path);
+ if (!flag)
+ {
+ dep_engine =
+ axis2_dep_engine_create_with_repos_name(env, repos_path);
+ }
+ else
+ {
+ dep_engine =
+ axis2_dep_engine_create_with_axis2_xml (env, axis2_xml);
+ }
+
axis2_dep_engine_set_current_file_item(dep_engine, env, file_data);
+
+ /* this module_dir set the path of the module directory
+ * petaining to this module. This value will use inside the
+ * axis2_dep_engine_build_module function
+ */
+
+ axis2_dep_engine_set_module_dir (dep_engine, env, path);
module_desc =
axis2_dep_engine_build_module(dep_engine, env, file, conf);
is_new_module = AXIS2_TRUE;
}
+
if (module_desc)
{
int size = 0;
@@ -1524,6 +1555,28 @@
return AXIS2_SUCCESS;
}
+
+AXIS2_EXTERN const axis2_char_t *AXIS2_CALL
+axis2_conf_get_axis2_xml(
+ const axis2_conf_t * conf,
+ const axutil_env_t * env)
+{
+ return axutil_strdup (env, conf->axis2_xml);
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+axis2_conf_set_axis2_xml(
+ axis2_conf_t * conf,
+ const axutil_env_t * env,
+ axis2_char_t * axis2_xml)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK (env->error, axis2_xml, AXIS2_FAILURE);
+ conf->axis2_xml = axutil_strdup(env, axis2_xml);
+ return AXIS2_SUCCESS;
+}
+
+
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_conf_set_dep_engine(
axis2_conf_t * conf,
@@ -1668,6 +1721,25 @@
axis2_bool_t enable_mtom)
{
conf->enable_mtom = enable_mtom;
+ return AXIS2_SUCCESS;
+}
+
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+axis2_conf_get_axis2_flag(
+ axis2_conf_t * conf,
+ const axutil_env_t * env)
+{
+ return conf->axis2_flag;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+axis2_conf_set_axis2_flag(
+ axis2_conf_t * conf,
+ const axutil_env_t * env,
+ axis2_bool_t axis2_flag)
+{
+ conf->axis2_flag = axis2_flag;
return AXIS2_SUCCESS;
}
Modified: webservices/axis2/trunk/c/src/core/engine/engine.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/engine/engine.c?rev=596104&r1=596103&r2=596104&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/engine/engine.c (original)
+++ webservices/axis2/trunk/c/src/core/engine/engine.c Sun Nov 18 09:45:50 2007
@@ -181,7 +181,7 @@
}
else
{
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
"Transport out is not set in message context");
return AXIS2_FAILURE;
}
@@ -401,7 +401,7 @@
}
else
{
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
"Transport out is not set in message context");
return AXIS2_FAILURE;
}
Modified: webservices/axis2/trunk/c/src/core/receivers/raw_xml_in_out_msg_recv.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/receivers/raw_xml_in_out_msg_recv.c?rev=596104&r1=596103&r2=596104&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/receivers/raw_xml_in_out_msg_recv.c (original)
+++ webservices/axis2/trunk/c/src/core/receivers/raw_xml_in_out_msg_recv.c Sun Nov 18 09:45:50 2007
@@ -53,8 +53,9 @@
return NULL;
}
- axis2_msg_recv_set_invoke_business_logic(msg_recv, env,
- axis2_raw_xml_in_out_msg_recv_invoke_business_logic_sync);
+ axis2_msg_recv_set_invoke_business_logic(
+ msg_recv, env,
+ axis2_raw_xml_in_out_msg_recv_invoke_business_logic_sync);
return msg_recv;
}
Modified: webservices/axis2/trunk/c/src/core/transport/http/receiver/http_receiver.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/http/receiver/http_receiver.c?rev=596104&r1=596103&r2=596104&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/http/receiver/http_receiver.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/http/receiver/http_receiver.c Sun Nov 18 09:45:50 2007
@@ -134,6 +134,56 @@
return &(server_impl->http_server);
}
+
+AXIS2_EXTERN axis2_transport_receiver_t *AXIS2_CALL
+axis2_http_server_create_with_file(
+ const axutil_env_t * env,
+ const axis2_char_t * file,
+ const int port)
+{
+ axis2_http_server_impl_t *server_impl = NULL;
+ AXIS2_ENV_CHECK(env, NULL);
+ server_impl = (axis2_http_server_impl_t *) AXIS2_MALLOC
+ (env->allocator, sizeof(axis2_http_server_impl_t));
+
+ if (!server_impl)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
+ server_impl->svr_thread = NULL;
+ server_impl->conf_ctx = NULL;
+ server_impl->conf_ctx_private = NULL;
+ server_impl->port = port;
+
+ server_impl->http_server.ops = &http_transport_receiver_ops_var;
+
+ if (file)
+ {
+
+ /**
+ * We first create a private conf ctx which is owned by this server
+ * we only free this private conf context. We should never free the
+ * server_impl->conf_ctx because it may own to any other object which
+ * may lead to double free
+ */
+ server_impl->conf_ctx_private =
+ axis2_build_conf_ctx_with_file (env, file);
+
+ if (!server_impl->conf_ctx_private)
+ {
+ axis2_http_server_free((axis2_transport_receiver_t *) server_impl,
+ env);
+ return NULL;
+ }
+ server_impl->conf_ctx = server_impl->conf_ctx_private;
+ }
+
+ return &(server_impl->http_server);
+}
+
+
void AXIS2_CALL
axis2_http_server_free(
axis2_transport_receiver_t * server,
@@ -163,6 +213,7 @@
AXIS2_FREE(env->allocator, server_impl);
return;
}
+
axis2_status_t AXIS2_CALL
axis2_http_server_init(
Modified: webservices/axis2/trunk/c/src/core/transport/http/sender/http_client.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/http/sender/http_client.c?rev=596104&r1=596103&r2=596104&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/http/sender/http_client.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/http/sender/http_client.c Sun Nov 18 09:45:50 2007
@@ -179,11 +179,12 @@
}
else
{
- client->sockfd = axutil_network_handler_open_socket(env,
- axutil_url_get_server
- (client->url, env),
- axutil_url_get_port
- (client->url, env));
+ client->sockfd =
+ axutil_network_handler_open_socket(env,
+ axutil_url_get_server
+ (client->url, env),
+ axutil_url_get_port
+ (client->url, env));
}
if (client->sockfd < 0)
{
@@ -211,23 +212,24 @@
#ifdef AXIS2_SSL_ENABLED
if (AXIS2_TRUE == client->proxy_enabled)
{
- if (AXIS2_SUCCESS != axis2_http_client_connect_ssl_host(client, env,
- axutil_url_get_server
- (client->
- url, env),
- axutil_url_get_port
- (client->
- url, env)))
+ if (AXIS2_SUCCESS !=
+ axis2_http_client_connect_ssl_host(client, env,
+ axutil_url_get_server
+ (client->url, env),
+ axutil_url_get_port
+ (client->
+ url, env)))
{
return AXIS2_FAILURE;
}
}
- client->data_stream = axutil_stream_create_ssl(env,
- client->sockfd,
- axis2_http_client_get_server_cert
- (client, env),
- axis2_http_client_get_key_file
- (client, env), ssl_pp);
+ client->data_stream =
+ axutil_stream_create_ssl(env,
+ client->sockfd,
+ axis2_http_client_get_server_cert
+ (client, env),
+ axis2_http_client_get_key_file
+ (client, env), ssl_pp);
#else
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_TRANSPORT_PROTOCOL,
AXIS2_FAILURE);
@@ -469,13 +471,11 @@
while (AXIS2_HTTP_RESPONSE_OK_CODE_VAL > http_status);
client->response = axis2_http_simple_response_create_default(env);
- axis2_http_simple_response_set_status_line(client->response, env,
- axis2_http_status_line_get_http_version
- (status_line, env),
- axis2_http_status_line_get_status_code
- (status_line, env),
- axis2_http_status_line_get_reason_phrase
- (status_line, env));
+ axis2_http_simple_response_set_status_line(
+ client->response, env,
+ axis2_http_status_line_get_http_version (status_line, env),
+ axis2_http_status_line_get_status_code (status_line, env),
+ axis2_http_status_line_get_reason_phrase (status_line, env));
/* now read the headers */
memset(str_header, 0, 512);
@@ -522,8 +522,9 @@
status_line = NULL;
}
if (AXIS2_FALSE ==
- axis2_http_simple_response_contains_header(client->response, env,
- AXIS2_HTTP_HEADER_CONTENT_TYPE)
+ axis2_http_simple_response_contains_header(
+ client->response, env,
+ AXIS2_HTTP_HEADER_CONTENT_TYPE)
&& 202 != status_code &&
axis2_http_simple_response_get_content_length(client->response,
env) > 0)
Modified: webservices/axis2/trunk/c/src/core/transport/http/server/simple_axis2_server/http_server_main.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/http/server/simple_axis2_server/http_server_main.c?rev=596104&r1=596103&r2=596104&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/http/server/simple_axis2_server/http_server_main.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/http/server/simple_axis2_server/http_server_main.c Sun Nov 18 09:45:50 2007
@@ -1,4 +1,3 @@
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -35,6 +34,8 @@
AXIS2_IMPORT extern int axis2_http_socket_read_timeout;
AXIS2_IMPORT extern axis2_char_t *axis2_request_url_prefix;
+#define DEFAULT_REPO_PATH "../"
+
/***************************** Function headers *******************************/
axutil_env_t *init_syetem_env(
axutil_allocator_t * allocator,
@@ -100,11 +101,15 @@
extern char *optarg;
extern int optopt;
int c;
+ unsigned int len;
int log_file_size = AXUTIL_LOG_FILE_SIZE;
+ unsigned int file_flag = 0;
axutil_log_levels_t log_level = AXIS2_LOG_LEVEL_DEBUG;
const axis2_char_t *log_file = "axis2.log";
+ const axis2_char_t *repo_path = DEFAULT_REPO_PATH;
int port = 9090;
- const axis2_char_t *repo_path = "../";
+ axis2_status_t status;
+
/* Set the service URL prefix to be used. This could default to services if not
set with AXIS2_REQUEST_URL_PREFIX macro at compile time */
@@ -178,8 +183,30 @@
AXIS2_LOG_INFO(env->log, "Repo location : %s", repo_path);
AXIS2_LOG_INFO(env->log, "Read Timeout : %d ms",
axis2_http_socket_read_timeout);
-
- server = axis2_http_server_create(env, repo_path, port);
+
+ status = axutil_file_handler_access (repo_path, AXIS2_R_OK);
+ if (status == AXIS2_SUCCESS)
+ {
+ len = strlen (repo_path);
+ if (!strcmp ((repo_path + (len - 9)), "axis2.xml"))
+ {
+ file_flag = 1;
+ }
+ }
+ else
+ {
+ AXIS2_LOG_WARNING (env->log, AXIS2_LOG_SI, "provided repo path %s is "
+ "not exsist or no permissions to read, set "
+ "repo_path to DEFAULT_REPO_PATH", repo_path);
+ repo_path = DEFAULT_REPO_PATH;
+ }
+
+
+ if (!file_flag)
+ server = axis2_http_server_create(env, repo_path, port);
+ else
+ server = axis2_http_server_create_with_file (env, repo_path, port);
+
if (!server)
{
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
Modified: webservices/axis2/trunk/c/util/include/axutil_error.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/include/axutil_error.h?rev=596104&r1=596103&r2=596104&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/include/axutil_error.h (original)
+++ webservices/axis2/trunk/c/util/include/axutil_error.h Sun Nov 18 09:45:50 2007
@@ -37,7 +37,7 @@
#define USER_ERROR_CODES_START (SAVAN_ERROR_CODES_START + AXUTIL_ERROR_MESSAGE_BLOCK_SIZE)
/* AXUTIL_ERROR_MAX define the maximum size of the error array */
-#define AXUTIL_ERROR_MAX (USER_ERROR_CODES_START+AXUTIL_ERROR_MESSAGE_BLOCK_SIZE)
+#define AXUTIL_ERROR_MAX (USER_ERROR_CODES_START + AXUTIL_ERROR_MESSAGE_BLOCK_SIZE)
/**
Modified: webservices/axis2/trunk/c/util/src/dir_handler.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/dir_handler.c?rev=596104&r1=596103&r2=596104&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/dir_handler.c (original)
+++ webservices/axis2/trunk/c/util/src/dir_handler.c Sun Nov 18 09:45:50 2007
@@ -190,6 +190,8 @@
file_list = axutil_array_list_create(env, 0);
if (!getcwd(cwd, 500))
exit(1);
+
+ /* pathname is path of services directory or modules directory. */
chdir(pathname);
axis2_archive_extract();
@@ -200,7 +202,7 @@
if (count <= 0)
{
axutil_array_list_free(file_list, env);
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "No files in the path %s.",
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "No files in the path %s.",
pathname);
return NULL;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org