You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by da...@apache.org on 2005/12/28 06:36:56 UTC
svn commit: r359402 - in /webservices/axis2/trunk/c: ./ include/ modules/
modules/core/addr/src/ modules/core/clientapi/src/
modules/core/context/src/ modules/core/deployment/src/
modules/core/description/src/ modules/core/engine/src/ modules/core/hand...
Author: damitha
Date: Tue Dec 27 21:36:01 2005
New Revision: 359402
URL: http://svn.apache.org/viewcvs?rev=359402&view=rev
Log:
Added dir handler code and test cases for it. Also made changes in Makefile.am's
to include path for platforms
Added:
webservices/axis2/trunk/c/modules/util/src/axis2_dir_handler.h
webservices/axis2/trunk/c/modules/util/src/dir_handler.c
webservices/axis2/trunk/c/test/unit/util/util_dir_handler_test.c
webservices/axis2/trunk/c/test/unit/util/util_dir_handler_test.h
Modified:
webservices/axis2/trunk/c/configure.ac
webservices/axis2/trunk/c/include/axis2.h
webservices/axis2/trunk/c/include/axis2_class_loader.h
webservices/axis2/trunk/c/modules/Makefile.am
webservices/axis2/trunk/c/modules/core/addr/src/Makefile.am
webservices/axis2/trunk/c/modules/core/clientapi/src/Makefile.am
webservices/axis2/trunk/c/modules/core/context/src/Makefile.am
webservices/axis2/trunk/c/modules/core/deployment/src/Makefile.am
webservices/axis2/trunk/c/modules/core/deployment/src/ws_info.c
webservices/axis2/trunk/c/modules/core/deployment/src/ws_info_list.c
webservices/axis2/trunk/c/modules/core/description/src/svc.c
webservices/axis2/trunk/c/modules/core/engine/src/Makefile.am
webservices/axis2/trunk/c/modules/core/handlers/src/Makefile.am
webservices/axis2/trunk/c/modules/core/phaseresolver/src/Makefile.am
webservices/axis2/trunk/c/modules/core/transport/http/src/Makefile.am
webservices/axis2/trunk/c/modules/core/transport/src/Makefile.am
webservices/axis2/trunk/c/modules/platforms/unix/axis2_unix.h
webservices/axis2/trunk/c/modules/util/src/Makefile.am
webservices/axis2/trunk/c/modules/wsdl/src/Makefile.am
webservices/axis2/trunk/c/modules/xml/om/src/Makefile.am
webservices/axis2/trunk/c/modules/xml/parser/guththila/src/Makefile.am
webservices/axis2/trunk/c/modules/xml/parser/libxml2/src/Makefile.am
webservices/axis2/trunk/c/modules/xml/soap/src/Makefile.am
webservices/axis2/trunk/c/test/unit/util/Makefile.am
webservices/axis2/trunk/c/test/unit/util/util_test.c
webservices/axis2/trunk/c/test/unit/util/util_test.h
Modified: webservices/axis2/trunk/c/configure.ac
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/configure.ac?rev=359402&r1=359401&r2=359402&view=diff
==============================================================================
--- webservices/axis2/trunk/c/configure.ac (original)
+++ webservices/axis2/trunk/c/configure.ac Tue Dec 27 21:36:01 2005
@@ -22,7 +22,8 @@
AC_CHECK_LIB(dl, dlopen)
AC_CHECK_LIB(cutest, CuTestInit)
-CFLAGS="$CFLAGS -ansi -Wall -D_LARGEFILE64_SOURCE -g3 -O2"
+#CFLAGS="$CFLAGS -ansi -Wall -D_LARGEFILE64_SOURCE -g3 -O2"
+CFLAGS="$CFLAGS -ansi -Wall -D_LARGEFILE64_SOURCE -g"
#CFLAGS="$CFLAGS -Wall -ansi -Wshadow -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -g -O2 -pthread"
dnl Checks for header files.
Modified: webservices/axis2/trunk/c/include/axis2.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2.h?rev=359402&r1=359401&r2=359402&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2.h (original)
+++ webservices/axis2/trunk/c/include/axis2.h Tue Dec 27 21:36:01 2005
@@ -22,8 +22,7 @@
* @brief Axis2c specific global declarations
*/
-#include <stdlib.h>
-#include <stdio.h>
+#include <axis2_platform_auto_sense.h>
#include <axis2_env.h>
/** This macro is called to check whether structure on which function is called
Modified: webservices/axis2/trunk/c/include/axis2_class_loader.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_class_loader.h?rev=359402&r1=359401&r2=359402&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_class_loader.h (original)
+++ webservices/axis2/trunk/c/include/axis2_class_loader.h Tue Dec 27 21:36:01 2005
@@ -29,7 +29,6 @@
#include <axis2_dll_desc.h>
#include <axis2_svc_skeleton.h>
#include <axis2_param.h>
-#include <axis2_platform_auto_sense.h>
#ifdef __cplusplus
extern "C"
Modified: webservices/axis2/trunk/c/modules/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/Makefile.am?rev=359402&r1=359401&r2=359402&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/Makefile.am (original)
+++ webservices/axis2/trunk/c/modules/Makefile.am Tue Dec 27 21:36:01 2005
@@ -1 +1 @@
-SUBDIRS = util common xml wsdl core
+SUBDIRS = util xml wsdl core
Modified: webservices/axis2/trunk/c/modules/core/addr/src/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/addr/src/Makefile.am?rev=359402&r1=359401&r2=359402&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/addr/src/Makefile.am (original)
+++ webservices/axis2/trunk/c/modules/core/addr/src/Makefile.am Tue Dec 27 21:36:01 2005
@@ -5,4 +5,5 @@
libaxis2_addr_la_LIBADD =
INCLUDES = -I${CUTEST_HOME}/include \
-I$(top_builddir)/include \
- -I$(top_builddir)/modules/util/src
+ -I$(top_builddir)/modules/util/src \
+ -I$(top_builddir)/modules/platforms
Modified: webservices/axis2/trunk/c/modules/core/clientapi/src/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/clientapi/src/Makefile.am?rev=359402&r1=359401&r2=359402&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/clientapi/src/Makefile.am (original)
+++ webservices/axis2/trunk/c/modules/core/clientapi/src/Makefile.am Tue Dec 27 21:36:01 2005
@@ -10,4 +10,5 @@
-I$(top_builddir)/modules/wsdl/src \
-I$(top_builddir)/modules/core/description/src \
-I$(top_builddir)/modules/core/transport \
+ -I$(top_builddir)/modules/platforms \
-I$(top_builddir)/modules/xml/parser
Modified: webservices/axis2/trunk/c/modules/core/context/src/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/context/src/Makefile.am?rev=359402&r1=359401&r2=359402&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/context/src/Makefile.am (original)
+++ webservices/axis2/trunk/c/modules/core/context/src/Makefile.am Tue Dec 27 21:36:01 2005
@@ -14,4 +14,5 @@
-I$(top_builddir)/modules/util/src \
-I$(top_builddir)/modules/wsdl/src \
-I$(top_builddir)/modules/core/description/src \
- -I$(top_builddir)/modules/core/transport
+ -I$(top_builddir)/modules/core/transport \
+ -I$(top_builddir)/modules/platforms
Modified: webservices/axis2/trunk/c/modules/core/deployment/src/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/deployment/src/Makefile.am?rev=359402&r1=359401&r2=359402&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/deployment/src/Makefile.am (original)
+++ webservices/axis2/trunk/c/modules/core/deployment/src/Makefile.am Tue Dec 27 21:36:01 2005
@@ -3,7 +3,6 @@
libaxis2_deployment_la_SOURCES = phases_info.c \
desc_builder.c \
dep_engine.c \
- ws_info_list.c \
arch_reader.c \
arch_file_data.c
Modified: webservices/axis2/trunk/c/modules/core/deployment/src/ws_info.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/deployment/src/ws_info.c?rev=359402&r1=359401&r2=359402&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/deployment/src/ws_info.c (original)
+++ webservices/axis2/trunk/c/modules/core/deployment/src/ws_info.c Tue Dec 27 21:36:01 2005
@@ -56,7 +56,7 @@
axis2_ws_info_impl_t *ws_info_impl = NULL;
AXIS2_ENV_CHECK(env, NULL);
- AXIS2_FUNC_PARAM_CHECK((*env)->error, file_name, NULL);
+ AXIS2_PARAM_CHECK((*env)->error, file_name, NULL);
ws_info_impl = (axis2_ws_info_impl_t *) AXIS2_MALLOC((*env)->
allocator, sizeof(axis2_ws_info_impl_t));
@@ -73,7 +73,7 @@
ws_info_impl->type = 0;
ws_info_impl->ws_info.ops = NULL;
- ws_info_impl->file_name = AXIS2_STRDUP((*env)->allocator, file_name);
+ ws_info_impl->file_name = AXIS2_STRDUP(file_name, env);
if(!ws_info_impl->file_name)
{
axis2_ws_info_free(&(ws_info_impl->ws_info), env);
@@ -107,7 +107,7 @@
axis2_ws_info_impl_t *ws_info_impl = NULL;
AXIS2_ENV_CHECK(env, NULL);
- AXIS2_FUNC_PARAM_CHECK((*env)->error, file_name, NULL);
+ AXIS2_PARAM_CHECK((*env)->error, file_name, NULL);
ws_info_impl = (axis2_ws_info_impl_t *)
axis2_ws_info_create_with_file_name_and_last_modified_date(env,
@@ -160,7 +160,7 @@
axis2_env_t **env)
{
AXIS2_FUNC_PARAM_CHECK(ws_info, env, NULL);
- return AXIS2_INTF_TO_IMPL(ws_info)->filename;
+ return AXIS2_INTF_TO_IMPL(ws_info)->file_name;
}
axis2_status_t AXIS2_CALL
@@ -168,15 +168,28 @@
axis2_env_t **env,
axis2_char_t *file_name)
{
+ axis2_ws_info_impl_t *ws_info_impl = NULL;
+
+ AXIS2_FUNC_PARAM_CHECK(ws_info, env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK((*env)->error, file_name, AXIS2_FAILURE);
- this.filename = filename;
+ ws_info_impl = AXIS2_INTF_TO_IMPL(ws_info);
+ if(ws_info_impl->file_name)
+ {
+ AXIS2_FREE((*env)->allocator, ws_info_impl->file_name);
+ ws_info_impl->file_name = NULL;
+ }
+ ws_info_impl->file_name = file_name;
+ return AXIS2_SUCCESS;
}
long AXIS2_CALL
axis2_ws_info_get_last_modified_date(axis2_ws_info_t *ws_info,
axis2_env_t **env)
{
- return lastmodifieddate;
+ AXIS2_FUNC_PARAM_CHECK(ws_info, env, AXIS2_FAILURE);
+
+ return AXIS2_INTF_TO_IMPL(ws_info)->last_modified_date;
}
axis2_status_t AXIS2_CALL
@@ -184,12 +197,15 @@
axis2_env_t **env,
long last_modified_date)
{
- this.lastmodifieddate = lastmodifieddate;
+ AXIS2_FUNC_PARAM_CHECK(ws_info, env, AXIS2_FAILURE);
+ AXIS2_INTF_TO_IMPL(ws_info)->last_modified_date = last_modified_date;
+ return AXIS2_SUCCESS;
}
int AXIS2_CALL
axis2_ws_info_get_type(axis2_ws_info_t *ws_info,
axis2_env_t **env)
{
- return type;
+ AXIS2_FUNC_PARAM_CHECK(ws_info, env, AXIS2_FAILURE);
+ return AXIS2_INTF_TO_IMPL(ws_info)->type;
}
Modified: webservices/axis2/trunk/c/modules/core/deployment/src/ws_info_list.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/deployment/src/ws_info_list.c?rev=359402&r1=359401&r2=359402&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/deployment/src/ws_info_list.c (original)
+++ webservices/axis2/trunk/c/modules/core/deployment/src/ws_info_list.c Tue Dec 27 21:36:01 2005
@@ -96,3 +96,221 @@
return AXIS2_SUCCESS;
}
+
+/**
+ * This is to store all the jar files in a specified folder (WEB_INF)
+ */
+private static List jarlist = new ArrayList();
+
+/**
+ * All the curently updated jars
+ */
+public List currentjars = new ArrayList();
+
+/**
+ * Referance to DeploymentEngine to make update
+ */
+private DeploymentEngine deployer;
+
+public WSInfoList(DeploymentEngine deploy_engine) {
+ deployer = deploy_engine;
+}
+
+/**
+ * This method is used to initialize the vector
+ */
+axis2_status_t AXIS2_CALL
+axis2_ws_info_list_init(axis2_ws_info_list_t *info_list,
+ axis2_env_t **env)
+{
+ jarlist.clear();
+}
+
+/**
+ * First it check whether the file is already available in the
+ * system call isFileExist , if it is not deployed yet then it will add
+ * that to jarlist and to the deployment engine as new service or module
+ * in adding new item to jarlist it first create optimice and requird object to
+ * keep those infor call WSInfo and that will be added to jarist and actual
+ * jar file will be added to DeploymentEngine
+ * <p/>
+ * If it is alredy exsit then it check whether it has been updated
+ * then change the last update date of the wsInfo and added two entries to
+ * DeploymentEngine one for New Deployment and other for undeployment
+ * @param file actual jar files for either Module or service
+ * @param type indicate either Service or Module
+ */
+axis2_status_t AXIS2_CALL
+axis2_ws_info_list_add_ws_info_item(axis2_ws_info_list_t *info_list,
+ axis2_env_t **env,
+ File file,
+ int type)
+{
+ switch (type) {
+ case SERVICE:
+ {
+ if (!isFileExist(file.getName())) { // chacking whether the file is already deployed
+ WSInfo wsInfo = new WSInfo(file.getName(),
+ file.lastModified(),
+ SERVICE);
+ jarlist.add(wsInfo);
+ ArchiveFileData archiveFileData = new ArchiveFileData(file, SERVICE);
+ deployer.addWSToDeploy(archiveFileData);//to inform that new web service is deployed
+ } else {
+ if (deployer.isHotUpdate()) {
+ WSInfo tempWSInfo = getFileItem(file.getName());
+ if (isModified(file, tempWSInfo)) { // caheck whether file is updated
+ tempWSInfo.setLastModifiedDate(file.lastModified());
+ WSInfo wsInfo = new WSInfo(tempWSInfo.getFilename(),
+ tempWSInfo.getLastmodifieddate(),
+ SERVICE);
+ deployer.addWSToUndeploy(wsInfo); // add entry to undeploy list
+ ArchiveFileData archiveFileData = new ArchiveFileData(file, SERVICE);
+ deployer.addWSToDeploy(archiveFileData); // add entry to deploylist
+
+ }
+ }
+ }
+ break;
+ }
+ case MODULE:
+ {
+ if (!isFileExist(file.getName())) { // chacking whether the file is already deployed
+ WSInfo wsInfo = new WSInfo(file.getName(),
+ file.lastModified(),
+ MODULE);
+ jarlist.add(wsInfo);
+ ArchiveFileData archiveFileData = new ArchiveFileData(file, MODULE);
+ deployer.addWSToDeploy(archiveFileData);//to inform that new web service is deployed
+ } else {
+ if (deployer.isHotUpdate()) {
+ WSInfo tempWSInfo = getFileItem(file.getName());
+ if (isModified(file, tempWSInfo)) {
+ tempWSInfo.setLastModifiedDate(file.lastModified());
+ WSInfo wsInfo = new WSInfo(tempWSInfo.getFilename(),
+ tempWSInfo.getLastmodifieddate(),
+ MODULE);
+ deployer.addWSToUndeploy(wsInfo); // add entry to undeploy list
+ ArchiveFileData archiveFileData = new ArchiveFileData(file, MODULE);
+ deployer.addWSToDeploy(archiveFileData); // add entry to deploylist
+
+ }
+ }
+ }
+ break;
+ }
+ }
+ String jarname = file.getName();
+ currentjars.add(jarname);
+}
+
+/**
+ * This method is to use to check the file exist and if so
+ * it will return related wsinfo object to the file else return null;
+ *
+ * @param filename
+ */
+axis2_ws_info_t *AXIS2_CALL
+axis2_ws_info_list_get_file_item(axis2_ws_info_list_t *info_list,
+ axis2_env_t **env,
+ axis2_char_t *file_name)
+{
+ int sise = jarlist.size();
+ for (int i = 0; i < sise; i++) {
+ WSInfo wsInfo = (WSInfo) jarlist.get(i);
+ if (wsInfo.getFilename().equals(filename)) {
+ return wsInfo;
+ }
+ }
+ return null;
+}
+
+/**
+ * comapre the last update dates of both files and if those are differ
+ * that will assume as the file is been modified
+ *
+ * @param file
+ * @param wsInfo
+ */
+axis2_bool_t AXIS2_CALL
+axis2_ws_info_list_is_modified(axis2_ws_info_list_t *info_list,
+ axis2_env_t **env,
+ File file,
+ axis2_ws_info_t *ws_info)
+{
+ return (wsInfo.getLastmodifieddate() != file.lastModified());
+}
+
+/**
+ * to check whether the file is alredy in the list
+ *
+ * @param filename
+ */
+axis2_bool_t AXIS2_CALL
+axis2_ws_info_list_is_file_exist(axis2_ws_info_list_t *info_list,
+ axis2_env_t **env,
+ axis2_char_t *file_name)
+{
+ return !(getFileItem(filename) == null);
+}
+
+/**
+ * this is to check , undeploye WS
+ * what this relly does is it caheck older jars files and
+ * current jars if name of the old jar file does not exit in the currecntjar
+ * list then it is assumed that the jar file has been removed
+ * that is hot undeployment
+ */
+axis2_status_t AXIS2_CALL
+axis2_ws_info_list_check_for_undeploy(axis2_ws_info_list_t *info_list,
+ axis2_env_t **env)
+{
+ Iterator iter = jarlist.listIterator();
+ int size = currentjars.size();
+ List tempvector = new ArrayList();
+ tempvector.clear();
+ String filename;
+ boolean exist ;
+ while (iter.hasNext()) {
+ WSInfo fileitem = (WSInfo) iter.next();
+ exist = false;
+ for (int i = 0; i < size; i++) {
+ filename = (String) currentjars.get(i);
+ if (filename.equals(fileitem.getFilename())) {
+ exist = true;
+ break;
+ }
+ }
+
+ if (!exist) {
+ tempvector.add(fileitem);
+ WSInfo wsInfo = new WSInfo(fileitem.getFilename(),
+ fileitem.getLastmodifieddate());
+ deployer.addWSToUndeploy(wsInfo);//this is to be undeploye
+ }
+
+ }
+
+ for (int i = 0; i < tempvector.size(); i++) {
+ WSInfo fileItem = (WSInfo) tempvector.get(i);
+ jarlist.remove(fileItem);
+ }
+ tempvector.clear();
+ currentjars.clear();
+}
+
+
+/**
+ *
+ */
+axis2_status_t AXIS2_CALL
+axis2_ws_info_list_update(axis2_ws_info_list_t *info_list,
+ axis2_env_t **env)
+{
+ checkForUndeploye();
+ if (deployer.isHotUpdate()) {
+ deployer.unDeploy();
+ }
+ deployer.doDeploy();
+
+}
Modified: webservices/axis2/trunk/c/modules/core/description/src/svc.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/description/src/svc.c?rev=359402&r1=359401&r2=359402&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/description/src/svc.c (original)
+++ webservices/axis2/trunk/c/modules/core/description/src/svc.c Tue Dec 27 21:36:01 2005
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
#include <axis2_svc.h>
#include <axis2_addr.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=359402&r1=359401&r2=359402&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/engine/src/Makefile.am (original)
+++ webservices/axis2/trunk/c/modules/core/engine/src/Makefile.am Tue Dec 27 21:36:01 2005
@@ -20,4 +20,5 @@
-I$(top_builddir)/modules/util/src \
-I$(top_builddir)/modules/core/description/src \
-I$(top_builddir)/modules/wsdl/src \
- -I$(top_builddir)/modules/core/transport
+ -I$(top_builddir)/modules/core/transport \
+ -I$(top_builddir)/modules/platforms
Modified: webservices/axis2/trunk/c/modules/core/handlers/src/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/handlers/src/Makefile.am?rev=359402&r1=359401&r2=359402&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/handlers/src/Makefile.am (original)
+++ webservices/axis2/trunk/c/modules/core/handlers/src/Makefile.am Tue Dec 27 21:36:01 2005
@@ -5,4 +5,5 @@
libaxis2_handlers_la_LIBADD =
INCLUDES = -I${CUTEST_HOME}/include \
-I$(top_builddir)/include \
- -I$(top_builddir)/modules/util/src
+ -I$(top_builddir)/modules/util/src \
+ -I$(top_builddir)/modules/platforms
Modified: webservices/axis2/trunk/c/modules/core/phaseresolver/src/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/phaseresolver/src/Makefile.am?rev=359402&r1=359401&r2=359402&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/phaseresolver/src/Makefile.am (original)
+++ webservices/axis2/trunk/c/modules/core/phaseresolver/src/Makefile.am Tue Dec 27 21:36:01 2005
@@ -9,4 +9,5 @@
-I$(top_builddir)/modules/util/src \
-I$(top_builddir)/modules/wsdl/src \
-I$(top_builddir)/modules/core/description/src \
- -I$(top_builddir)/modules/core/transport
+ -I$(top_builddir)/modules/core/transport \
+ -I$(top_builddir)/modules/platforms
Modified: webservices/axis2/trunk/c/modules/core/transport/http/src/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/src/Makefile.am?rev=359402&r1=359401&r2=359402&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/src/Makefile.am (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/src/Makefile.am Tue Dec 27 21:36:01 2005
@@ -16,4 +16,5 @@
-I$(top_builddir)/modules/wsdl/src\
-I$(top_builddir)/modules/core/transport\
-I$(top_builddir)/modules/core/transport/http/src\
- -I$(top_builddir)/modules/core/description/src
+ -I$(top_builddir)/modules/core/description/src \
+ -I$(top_builddir)/modules/platforms
Modified: webservices/axis2/trunk/c/modules/core/transport/src/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/src/Makefile.am?rev=359402&r1=359401&r2=359402&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/src/Makefile.am (original)
+++ webservices/axis2/trunk/c/modules/core/transport/src/Makefile.am Tue Dec 27 21:36:01 2005
@@ -6,4 +6,5 @@
libaxis2_transport_la_LIBADD =
INCLUDES = -I${CUTEST_HOME}/include -I$(top_builddir)/include \
-I$(top_builddir)/modules/util/src \
- -I$(top_builddir)/modules/core/transport
+ -I$(top_builddir)/modules/core/transport \
+ -I$(top_builddir)/modules/platforms
Modified: webservices/axis2/trunk/c/modules/platforms/unix/axis2_unix.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/platforms/unix/axis2_unix.h?rev=359402&r1=359401&r2=359402&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/platforms/unix/axis2_unix.h (original)
+++ webservices/axis2/trunk/c/modules/platforms/unix/axis2_unix.h Tue Dec 27 21:36:01 2005
@@ -94,6 +94,15 @@
#include <sys/timeb.h>
#include <unistd.h>
#include <errno.h>
+#include <sys/dir.h>
+#include <sys/param.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <strings.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
#define AXIS2_PLATFORM_SLEEP(x) sleep(0);
/**
@@ -139,6 +148,10 @@
#define AXIS2_PRINTF_UNSIGNED_LONGLONG_FORMAT_SPECIFIER "%llu"
#define AXIS2_PRINTF_UNSIGNED_LONGLONG_FORMAT_SPECIFIER_CHARS "llu"
+/**
+ * Platform specific path separator char
+ */
+#define AXIS2_PATH_SEP_CHAR "/"
/** @} */
#ifdef __cplusplus
Modified: webservices/axis2/trunk/c/modules/util/src/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/src/Makefile.am?rev=359402&r1=359401&r2=359402&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/src/Makefile.am (original)
+++ webservices/axis2/trunk/c/modules/util/src/Makefile.am Tue Dec 27 21:36:01 2005
@@ -11,7 +11,8 @@
qname.c \
array_list.c \
linked_list.c \
- utils.c
+ utils.c \
+ dir_handler.c
libaxis2_util_la_LIBADD =
INCLUDES = -I$(top_builddir)/include \
Added: webservices/axis2/trunk/c/modules/util/src/axis2_dir_handler.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/src/axis2_dir_handler.h?rev=359402&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/util/src/axis2_dir_handler.h (added)
+++ webservices/axis2/trunk/c/modules/util/src/axis2_dir_handler.h Tue Dec 27 21:36:01 2005
@@ -0,0 +1,66 @@
+/*
+ * 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_DIR_HANDLER_H
+#define AXIS2_DIR_HANDLER_H
+
+#include <axis2_defines.h>
+#include <axis2_error.h>
+#include <axis2_env.h>
+#include <axis2_string.h>
+#include <axis2_array_list.h>
+#include <axis2.h>
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ * @defgroup axis2_dir_handler Dir Handler
+ * @ingroup axis2_util
+ * @{
+ */
+ /**
+ * List the .zip or tar.gz files in the given path
+ * @param pathname path to the directory where your modules or services are
+ * @return array list of .zip or tar.gz file names
+ */
+ AXIS2_DECLARE(axis2_array_list_t *)
+ axis2_dir_handler_list_dir(axis2_env_t **env,
+ axis2_char_t *pathname);
+
+ /**
+ * @brief
+ * To store filename and timestamp of each module or service archive file
+ */
+ typedef struct axis2_arch_file
+ {
+ axis2_char_t *name;
+ time_t time_stamp;
+
+ } axis2_arch_file_t;
+
+#define AXIS2_LIST_DIR(env, pathname) axis2_list_dir(env, pathname)
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* AXIS2_DIR_HANDLER_H */
Added: webservices/axis2/trunk/c/modules/util/src/dir_handler.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/src/dir_handler.c?rev=359402&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/util/src/dir_handler.c (added)
+++ webservices/axis2/trunk/c/modules/util/src/dir_handler.c Tue Dec 27 21:36:01 2005
@@ -0,0 +1,129 @@
+/*
+ * 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_dir_handler.h>
+
+extern int alphasort();
+
+axis2_array_list_t *AXIS2_CALL
+axis2_dir_handler_list_dir(axis2_env_t **env,
+ axis2_char_t *pathname);
+
+/*int main(void)
+{
+ char *pathname = NULL;
+ pathname = strdup("/home/damitha/projects/c/install/lib");
+ list_dir(pathname);
+}
+*/
+
+/**
+ * List the .zip or tar.gz files in the given path
+ * @param pathname path to the directory where your modules or services are
+ * @return array list of .zip or tar.gz file names
+ */
+axis2_array_list_t *AXIS2_CALL
+axis2_dir_handler_list_dir(axis2_env_t **env,
+ axis2_char_t *pathname)
+{
+ axis2_array_list_t *file_list = NULL;
+ struct stat *buf = NULL;
+ int count,i;
+ struct direct **files = NULL;
+ int file_select();
+ axis2_status_t status = AXIS2_FAILURE;
+ int file_size = 0;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ file_list = axis2_array_list_create(env, 100);
+ count = scandir(pathname, &files, file_select, alphasort);
+
+ /* If no files found, make a non-selectable menu item */
+ if (count <= 0)
+ {
+ printf("No files in this directory:%s\n", pathname);
+ exit(0);
+ }
+ file_size = sizeof(axis2_arch_file_t);
+
+ for (i=1; i < count + 1 ; ++i)
+ {
+ int len = 0;
+ axis2_char_t *fname = NULL;
+ axis2_char_t *path_set_char = NULL;
+ axis2_arch_file_t *arch_file = NULL;
+ axis2_char_t *path = NULL;
+
+ fname = files[i-1]->d_name;
+ arch_file = (axis2_arch_file_t *) AXIS2_MALLOC((*env)->allocator, file_size);
+ if(!arch_file)
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ arch_file->name = fname;
+ len = strlen(pathname) + strlen(fname) + 3;
+ path = AXIS2_MALLOC((*env)->allocator, len);
+ if(!path)
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ strcpy(path, pathname);
+ strcat(path, AXIS2_PATH_SEP_CHAR);
+ strcat(path, fname);
+ buf = AXIS2_MALLOC((*env)->allocator, sizeof(struct stat));
+ if(!buf)
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ stat(path, buf);
+ arch_file->time_stamp = (time_t) buf->st_ctime;
+ status = AXIS2_ARRAY_LIST_ADD(file_list, env, arch_file);
+ if(path)
+ {
+ AXIS2_FREE((*env)->allocator, path);
+ path = NULL;
+ }
+ buf = NULL;
+ arch_file = NULL;
+ fname = NULL;
+ }
+
+ return file_list;
+}
+
+axis2_bool_t file_select(struct direct *entry)
+
+{
+ axis2_char_t *ptr;
+ axis2_char_t *rindex(const axis2_char_t *s, int c);
+
+ if ((strcmp(entry->d_name, ".")== 0) ||
+ (strcmp(entry->d_name, "..") == 0))
+ return (AXIS2_FALSE);
+
+ /* Check for filename extensions */
+ ptr = rindex(entry->d_name, '.');
+ if ((ptr != NULL) &&
+ ((strcmp(ptr, ".so") == 0)
+ || (strcmp(ptr, ".zip") == 0) ))
+ return (AXIS2_TRUE);
+ else
+ return(AXIS2_FALSE);
+}
Modified: webservices/axis2/trunk/c/modules/wsdl/src/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/wsdl/src/Makefile.am?rev=359402&r1=359401&r2=359402&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/wsdl/src/Makefile.am (original)
+++ webservices/axis2/trunk/c/modules/wsdl/src/Makefile.am Tue Dec 27 21:36:01 2005
@@ -22,4 +22,5 @@
-I${CUTEST_HOME}/include \
-I$(top_builddir)/modules/util/src \
-I$(top_builddir)/modules/core/description/src \
- -I$(top_builddir)/modules/core/transport
+ -I$(top_builddir)/modules/core/transport \
+ -I$(top_builddir)/modules/platforms
Modified: webservices/axis2/trunk/c/modules/xml/om/src/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/src/Makefile.am?rev=359402&r1=359401&r2=359402&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/src/Makefile.am (original)
+++ webservices/axis2/trunk/c/modules/xml/om/src/Makefile.am Tue Dec 27 21:36:01 2005
@@ -20,4 +20,5 @@
INCLUDES = -I$(top_builddir)/include \
-I${CUTEST_HOME}/include \
-I$(top_builddir)/modules/util/src \
- -I$(top_builddir)/modules/xml/parser
+ -I$(top_builddir)/modules/xml/parser \
+ -I$(top_builddir)/modules/platforms
Modified: webservices/axis2/trunk/c/modules/xml/parser/guththila/src/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/parser/guththila/src/Makefile.am?rev=359402&r1=359401&r2=359402&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/parser/guththila/src/Makefile.am (original)
+++ webservices/axis2/trunk/c/modules/xml/parser/guththila/src/Makefile.am Tue Dec 27 21:36:01 2005
@@ -8,5 +8,6 @@
INCLUDES = -I$(top_builddir)/include \
-I$(top_builddir)/modules/util/src \
-I$(top_builddir)/modules/xml/parser \
- -I${GUTHTHILA_INCLUDE}
+ -I${GUTHTHILA_INCLUDE} \
+ -I$(top_builddir)/modules/platforms
Modified: webservices/axis2/trunk/c/modules/xml/parser/libxml2/src/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/parser/libxml2/src/Makefile.am?rev=359402&r1=359401&r2=359402&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/parser/libxml2/src/Makefile.am (original)
+++ webservices/axis2/trunk/c/modules/xml/parser/libxml2/src/Makefile.am Tue Dec 27 21:36:01 2005
@@ -8,4 +8,5 @@
INCLUDES = -I$(top_builddir)/include \
-I$(top_builddir)/modules/util/src \
-I$(top_builddir)/modules/xml/parser \
- -I${LIBXML2_INCLUDE}
+ -I${LIBXML2_INCLUDE} \
+ -I$(top_builddir)/modules/platforms
Modified: webservices/axis2/trunk/c/modules/xml/soap/src/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/soap/src/Makefile.am?rev=359402&r1=359401&r2=359402&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/soap/src/Makefile.am (original)
+++ webservices/axis2/trunk/c/modules/xml/soap/src/Makefile.am Tue Dec 27 21:36:01 2005
@@ -1,4 +1,4 @@
-noinst_LTLIBRARIES = libaxis2_soap.la
+lib_LTLIBRARIES = libaxis2_soap.la
AM_CPPFLAGS = $(CPPFLAGS)
libaxis2_soap_la_SOURCES = axis2_soap_fault.c \
axis2_soap_fault_code.c \
@@ -16,4 +16,7 @@
soap_envelope.c
libaxis2_soap_la_LIBADD =
-INCLUDES = -I$(top_builddir)/include -I$(top_builddir)/modules/xml/parser -I$(top_builddir)/modules/util/src
+INCLUDES = -I$(top_builddir)/include \
+ -I$(top_builddir)/modules/xml/parser \
+ -I$(top_builddir)/modules/util/src \
+ -I$(top_builddir)/modules/platforms
Modified: webservices/axis2/trunk/c/test/unit/util/Makefile.am
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/test/unit/util/Makefile.am?rev=359402&r1=359401&r2=359402&view=diff
==============================================================================
--- webservices/axis2/trunk/c/test/unit/util/Makefile.am (original)
+++ webservices/axis2/trunk/c/test/unit/util/Makefile.am Tue Dec 27 21:36:01 2005
@@ -1,20 +1,22 @@
prgbindir=$(prefix)/bin/unit_test
prglibdir=$(prefix)/lib/unit_test
prglib_LTLIBRARIES = libtest_util.la
-AM_CPPFLAGS = $(CPPFLAGS) -g
+
libtest_util_la_SOURCES = util_hash_test.c \
util_stream_test.c \
util_log_test.c \
util_error_test.c \
util_test.c \
util_array_list_test.c\
- util_linked_list_test.c
+ util_linked_list_test.c \
+ util_dir_handler_test.c
include_HEADERS=$(top_builddir)/test/unit/util/*.h
INCLUDES = -I$(top_builddir)/include \
-I${CUTEST_HOME}/include \
- -I$(top_builddir)/modules/util/src
+ -I$(top_builddir)/modules/util/src \
+ -I$(top_builddir)/modules/platforms
prgbin_PROGRAMS = util_test
util_test_SOURCES = main.c
Added: webservices/axis2/trunk/c/test/unit/util/util_dir_handler_test.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/test/unit/util/util_dir_handler_test.c?rev=359402&view=auto
==============================================================================
--- webservices/axis2/trunk/c/test/unit/util/util_dir_handler_test.c (added)
+++ webservices/axis2/trunk/c/test/unit/util/util_dir_handler_test.c Tue Dec 27 21:36:01 2005
@@ -0,0 +1,37 @@
+#include <util_dir_handler_test.h>
+#include <axis2_string.h>
+
+void Testaxis2_dir_handler_list_dir(CuTest *tc)
+{
+ puts("axis2_dir_handler_list_test\n");
+
+ axis2_allocator_t *allocator = axis2_allocator_init (NULL);
+ axis2_env_t *env = axis2_env_create(allocator);
+
+ axis2_char_t *pathname = NULL;
+ axis2_array_list_t *file_list = NULL;
+ int size = 0;
+ axis2_char_t *expected = NULL;
+ axis2_char_t *actual = NULL;
+ int i = 0;
+
+ expected = AXIS2_STRDUP("libaxis2_util.so", &env);
+ pathname = AXIS2_STRDUP(
+ "/home/damitha/projects/c/test/unit/infiles/dir_handler", &env);
+ file_list = axis2_dir_handler_list_dir(&env, pathname);
+ size = AXIS2_ARRAY_LIST_SIZE(file_list, &env);
+
+ for (i = 0; i < size; i++)
+ {
+ axis2_arch_file_t *arch_file = NULL;
+ arch_file = (axis2_arch_file_t *) AXIS2_ARRAY_LIST_GET(file_list, &env, i);
+ if(0 == AXIS2_STRCMP(arch_file->name, expected))
+ {
+ actual = arch_file->name;
+ }
+ }
+
+ CuAssertStrEquals(tc, expected, actual);
+ AXIS2_FREE(env->allocator, expected);
+ AXIS2_FREE(env->allocator, pathname);
+}
Added: webservices/axis2/trunk/c/test/unit/util/util_dir_handler_test.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/test/unit/util/util_dir_handler_test.h?rev=359402&view=auto
==============================================================================
--- webservices/axis2/trunk/c/test/unit/util/util_dir_handler_test.h (added)
+++ webservices/axis2/trunk/c/test/unit/util/util_dir_handler_test.h Tue Dec 27 21:36:01 2005
@@ -0,0 +1,14 @@
+#ifndef UTIL_DIR_HANDLER_TEST_H
+#define UTIL_DIR_HANDLER_TEST_H
+
+#include <string.h>
+#include <stdio.h>
+#include <CuTest.h>
+#include <axis2_allocator.h>
+#include <axis2_env.h>
+#include "axis2_dir_handler.h"
+#include "axis2_string.h"
+
+void Testaxis2_dir_handler_list_dir(CuTest *tc);
+
+#endif /* UTIL_DIR_HANDLER_TEST_H*/
Modified: webservices/axis2/trunk/c/test/unit/util/util_test.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/test/unit/util/util_test.c?rev=359402&r1=359401&r2=359402&view=diff
==============================================================================
--- webservices/axis2/trunk/c/test/unit/util/util_test.c (original)
+++ webservices/axis2/trunk/c/test/unit/util/util_test.c Tue Dec 27 21:36:01 2005
@@ -13,5 +13,6 @@
SUITE_ADD_TEST(suite, Testaxis2_hash_while);
SUITE_ADD_TEST(suite, Testaxis2_array_list_get);
SUITE_ADD_TEST(suite, Testaxis2_linked_list_get);
+ SUITE_ADD_TEST(suite, Testaxis2_dir_handler_list_dir);
return suite;
}
Modified: webservices/axis2/trunk/c/test/unit/util/util_test.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/test/unit/util/util_test.h?rev=359402&r1=359401&r2=359402&view=diff
==============================================================================
--- webservices/axis2/trunk/c/test/unit/util/util_test.h (original)
+++ webservices/axis2/trunk/c/test/unit/util/util_test.h Tue Dec 27 21:36:01 2005
@@ -8,6 +8,7 @@
#include "util_array_list_test.h"
#include "util_linked_list_test.h"
#include "util_error_test.h"
+#include "util_dir_handler_test.h"
CuSuite* axis2_utilGetSuite();